Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[rhcos-4.9] buildextend-live: fix /run/media/iso mount flake booting from disk #2460

Merged
merged 1 commit into from Sep 23, 2021
Merged

[rhcos-4.9] buildextend-live: fix /run/media/iso mount flake booting from disk #2460

merged 1 commit into from Sep 23, 2021

Conversation

bgilbert
Copy link
Contributor

When booting the RHCOS live ISO image from a USB stick or other disk device, boot sometimes fails with the following error:

[    9.410095] systemd[1]: Reached target Initrd Root Device.
[    9.415226] systemd[1]: Mounting /run/media/iso...
[    9.498191] ISOFS: Unable to identify CD-ROM format.
[    9.499552] mount[722]: mount: /run/media/iso: wrong fs type, bad option, bad superblock on /dev/sda2, missing codepage or helper program, or other error.
Failed to mount /run/media/iso.
See 'systemctl status run-media-iso.mount' for details.

35coreos-live/live-generator creates run-media-iso.mount, which mounts the ISO from /dev/disk/by-label/rhcos-<version>. The latter should point to /dev/sda1, but in this case it's pointing to /dev/sda2, which is efiboot.img. /dev/sda2 does not have a filesystem label, but because of systemd/systemd#14408, 60-persistent-storage.rules falls back to using the filesystem label from /dev/sda (the whole-disk device) when evaluating symlinks for /dev/sda2. As a result, /dev/sda1 and /dev/sda2 race to own the /dev/disk/by-label symlink, and if sda2 wins, the mount fails.

CD and virtual CD boot are not affected because CD-ROM devices are not partitionable. FCOS is not affected because the udev rules on FCOS include systemd/systemd#14485.

Fix the race by giving efiboot.img its own filesystem label, preventing the buggy udev rules from reusing the label from the ISO 9660 filesystem. This seems like a reasonable thing to do anyway (the non-live images label the ESP as EFI-SYSTEM) and it's free.

Fixes https://bugzilla.redhat.com/show_bug.cgi?id=2007089. Backports #2458.

When booting the RHCOS live ISO image from a USB stick or other disk
device, boot sometimes fails with the following error:

[    9.410095] systemd[1]: Reached target Initrd Root Device.
[    9.415226] systemd[1]: Mounting /run/media/iso...
[    9.498191] ISOFS: Unable to identify CD-ROM format.
[    9.499552] mount[722]: mount: /run/media/iso: wrong fs type, bad
    option, bad superblock on /dev/sda2, missing codepage or helper
    program, or other error.
Failed to mount /run/media/iso.
See 'systemctl status run-media-iso.mount' for details.

35coreos-live/live-generator creates run-media-iso.mount, which mounts
the ISO from /dev/disk/by-label/rhcos-<version>.  The latter should point
to /dev/sda1, but in this case it's pointing to /dev/sda2, which is
efiboot.img.  /dev/sda2 does not have a filesystem label, but because of
systemd/systemd#14408,
60-persistent-storage.rules falls back to using the filesystem label from
/dev/sda (the whole-disk device) when evaluating symlinks for /dev/sda2.
As a result, /dev/sda1 and /dev/sda2 race to own the /dev/disk/by-label
symlink, and if sda2 wins, the mount fails.

CD and virtual CD boot are not affected because CD-ROM devices are not
partitionable.  FCOS is not affected because the udev rules on FCOS
include systemd/systemd#14485.

Fix the race by giving efiboot.img its own filesystem label, preventing
the buggy udev rules from reusing the label from the ISO 9660 filesystem.
This seems like a reasonable thing to do anyway (the non-live images
label the ESP as EFI-SYSTEM) and it's free.

Fixes https://bugzilla.redhat.com/show_bug.cgi?id=2007089.
@bgilbert bgilbert merged commit 4b37664 into coreos:rhcos-4.9 Sep 23, 2021
@bgilbert bgilbert deleted the EFI-SYSTEM-bp/rhcos-4.9 branch September 23, 2021 20:15
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants