Arch Linux

Please read this before reporting a bug:
https://wiki.archlinux.org/title/Bug_reporting_guidelines

Do NOT report bugs when a package is just outdated, or it is in the AUR. Use the 'flag out of date' link on the package page, or the Mailing List.

REPEAT: Do NOT report bugs for outdated packages!
Tasklist

FS#32609 - [arch-install-scripts] genfstab embeds temporary device mapper number in swap line of fstab

Attached to Project: Arch Linux
Opened by A Web (aweb) - Sunday, 11 November 2012, 18:24 GMT
Last edited by Dave Reisner (falconindy) - Saturday, 17 November 2012, 15:56 GMT
Task Type Bug Report
Category Packages: Extra
Status Closed
Assigned To Dave Reisner (falconindy)
Architecture All
Severity Low
Priority Normal
Reported Version
Due in Version Undecided
Due Date Undecided
Percent Complete 100%
Votes 1
Private No

Details

Description:

genfstab embeds device mapper numbers in swap lines. Since these numbers change on reboot (particularly between the install CD and booting from disk), they become incorrect on reboot, causing a difficult to track 60-second pause on every boot and resulting in swap being disabled.

Additional info:
* package version(s)

Confirmed in arch-install-scripts 8-1.

* config and/or log files etc.

Job dev-dm\x2d4.device/start timed out.
Timed out waiting for device dev-dm\x2d4.device.
Dependency failed for /dev/dm-4.
Job dev-dm\x2d4.swap/start failed with result 'dependency'.
Job dev-dm\x2d4.device/start failed with result 'timeout'.

Steps to reproduce:

Run genfstab when using lvm or dm-crypt or both for the swap partition.

For example, I am using lvm on a luks partition, and swap on a logical volume called /dev/mapper/decrypted-swap. If I run genfstab without the -U flag, I get output like the following:

# genfstab -p /
/dev/mapper/decrypted-root / ext4 rw,relatime,data=ordered 0 2
/dev/sda1 /boot ext2 rw,relatime 0 2
/dev/dm-4 none swap defaults 0 0

This is somewhat understandable in that /proc/swaps does not contain symbolic link paths for /dev/mapper/... the way /proc/mounts does, but it leads to a frustrating install experience. It took me several hours to understand why my system was stalling for 60 seconds every time I rebooted with some weird journalctl message about /dev/dm-4 timing out. (It was dm-4 when I installed because the install CD was using some device mapper numbers, but becomes /dev/dm-1 when I boot from disk.)

A fix to this would save people a lot of frustration. At a minimum, genfstab could check if the swap path matches /dev/dm-[0-9]* and if so issue a warning to stderr that device mapper numbers change and the user should either run genfstab -U or manually edit the swap line to contain a more permanent device name.

A slightly fancier fix would be to search /dev/mapper for a symbolic link pointing back to the appropriate /dev/dm-*, and to output that for the swap line.
This task depends upon

Closed by  Dave Reisner (falconindy)
Saturday, 17 November 2012, 15:56 GMT
Reason for closing:  Fixed
Additional comments about closing:  arch-install-scripts-9-1
Comment by Dave Reisner (falconindy) - Sunday, 11 November 2012, 19:17 GMT
This is why the -U and -L flags exist. There's an inherent "check your work" involved here. genfstab's output should never be blindly trusted.
Comment by A Web (aweb) - Sunday, 11 November 2012, 20:51 GMT
Note that -L does not help in this case. I agree -U avoids the problem, and that people should check the work. In my case, I ran it with just -p, saw that it was exactly what I wanted but was missing swap, ran swapon, and re-ran genfstab without checking. Dumb, maybe, but also something others may do. In any event, there's an opportunity to make the tool more useful here without much additional work.
Comment by Dave Reisner (falconindy) - Sunday, 11 November 2012, 20:58 GMT
Why does -L not help?
Comment by A Web (aweb) - Sunday, 11 November 2012, 21:29 GMT
Because mkswap doesn't label a partition by default (without -L):

# genfstab -pL /
...
/dev/dm-1 none swap defaults 0 0

If I explicitly label the swap using swaplabel, then it works, but I usually only label my file systems, not my swap, since there's only one swap partition on my systems and lvm gives it an acceptably unique name.

It's absolutely the case that, knowing what I know now, this will never again be a problem for me. On the other hand, this is the kind of small annoyance that is likely to turn people off of arch if they are just testing it out. Moreover, if genfstab found the /dev/mapper/... name, it would be more convenient for advanced users as well (just because I can edit my fstab after creating it doesn't mean that it's not easier not to).

And though the stakes are low, the fix is super simple, too. I've attached a short patch to fix the problem. It might not be in the right style, and might not be the most efficient way of handling it, but it shows that this is a trivial issue to deal with.
Comment by Dave Reisner (falconindy) - Sunday, 11 November 2012, 22:08 GMT
Sure, I just want to make sure I understand the extent of the problem (I don't use DM outside of VMs I use for testing). It didn't click right away that genfstab used DM naming for non-swap partitions (even by default), but it makes sense why this is the case.

Committed a fix: https://github.com/falconindy/arch-install-scripts/commit/3a7eb157d11cd8225965152e82d74724808f5d24. It'll be included with December's ISO.
Comment by A Web (aweb) - Sunday, 11 November 2012, 22:29 GMT
Thanks for your responsiveness. Your fix is much cleaner.

Loading...