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

Fedora 26 failed to boot overlay #22

Open
c0b opened this issue Jul 15, 2017 · 5 comments
Open

Fedora 26 failed to boot overlay #22

c0b opened this issue Jul 15, 2017 · 5 comments

Comments

@c0b
Copy link

c0b commented Jul 15, 2017

with unmodified Fedora liveiso image, what I usually do is to append a special parameter rd.break=pre-pivot on grub command line, then the dracut initramfs image will break into a debug shell before pivot, then I can manually type in a few key commands from the 01-liveoverlayfs.sh like modprobe ... overlay, and mkdir /run/{sysroot,upper,work} and the mount, quit the shell and dracut continues to boot up into a desktop with / mounted on top of overlayfs;
this works for the past 25, 24, ... a few prior versions, but stops working on Fedora 26

it failed at this line

https://github.com/probonopd/SystemImageKit/blob/b44abfa/boot/iso/additional-initramfs/dracut-overlayfs-support/usr/lib/dracut/hooks/pre-pivot/01-liveoverlayfs.sh#L30

mount /run/initramfs/squashfs/LiveOS/rootfs.img /run/sysroot

error is:

mount: /dev/loop2 is already mounted or /run/sysroot busy
@probonopd
Copy link
Owner

Thanks @c0b for analyzing this, do you know how to fix it?

@c0b
Copy link
Author

c0b commented Jul 17, 2017

I think the root cause is the program mount in Fedora 26 must be a new version becomes clever, it detects in the case if need to setup a loop device, it checks if the file is already setup on some existing loop device, which is true at the moment of pre-pivot, because some where in the dracut bootup scripts has already setup the /LiveOS/rootfs.img from the squashfs file at /dev/loop2, and device-mapper is using the loop device in an exclusive way, this is my theory why mount failed and says /dev/loop2 already in-use; there might be two solutions:

  1. dmsetup remove_all before the rootfs.img mount, since the overlay don't use any device-mapper at all, it may be safe to get rid of all device-mapper, but I remember for F25/24 it failed at some later step of dracut not remember details;

  2. manually setup another duplicate loop device for the rootfs.img, for the older version of mount it didn't check existing loop device and always setup a new loop device:

    # losetup -f /run/initramfs/squashfs/LiveOS/rootfs.img
    .... some output here, suppose it find next free loop device is /dev/loop4
    # mount -v -o ro /dev/loop4 /run/sysroot
    .... the verbose flag isn't really necessary, but I'd always like to be verbose

I am using the 2nd solution as workaround, it indeed works; I also need enforcing=0 to avoid some stupid selinux layer, after boot into overlay based Live desktop, it's safe to run dmsetup remove_all and losetup -d /dev/loop* (this one only mark all loop devices to be lazy delete, since device-mapper removed, some loop devices in-use by device-mapper will be deleted immediately and others used by overlay will continue serve, till system shutdown...)

@c0b
Copy link
Author

c0b commented Aug 20, 2017

@probonopd as the workaround is figured out does work for fedora 26, do you want an update of this 01-liveoverlayfs.sh#L30 file? as you mentioned in dracutdevs/dracut#104 I am the original author derek exposed the fedora overlay problem at https://lists.fedoraproject.org/pipermail/users/2015-July/463627.html

@probonopd
Copy link
Owner

I'd happily accept a Pull Request, as long as it has enough if statements so as to not interfere with previous versions of Fedora, CentOS, and the like.

@probonopd
Copy link
Owner

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

No branches or pull requests

2 participants