sys-apps/util-linux-2.16.1 installs /sbin/switch_root, which conflicts with dracut's patched /usr/sbin/switch_root, causing dracut to use /sbin/switch_root instead when generating the initramfs. This zeroes the effect of dracut-002-unmount.patch and again causes problems with OpenRC (/dev/pts not being mounted). The attached patch fixes this by making dracut install switch_root to /usr/share/dracut/modules.d/99base/switch_root instead of /usr/sbin/switch_root, and forcing usage of this program.
Created attachment 210240 [details, diff] fix switch_root issue
09 Dec 2009; Lance Albertson <ramereth@gentoo.org> +dracut-002-r1.ebuild, +files/dracut-002-makefile-add-with_switch_root.patch, +dracut-003.ebuild: Version bump, fix switch_root issues #293178, & remove system deps Force package dep >=sys-apps/util-linux-2.16 which includes switch_root by default. Otherwise dracut would have a file conflict with util-linux. Backport upstream Makefile patch b3611b525 for version 002 instead of patch included in the bug report. Please ensure that the patch I used works as intended. Thanks for the bug report!
No, your changes do not fix the issue because, as I have already mentioned, the switch-root program from util-linux is not patched with dracut-002-unmount.patch. This causes OpenRC to fail. Without the patch, switch-root will move the /dev, /dev/pts, /proc and /sys filesystems to the new root before starting /sbin/init. OpenRC however does not expect this, and will attempt to mount new filesystems over the existing ones, failing to mount /dev/pts because it will see the old one (shadowed by the new /dev) in /proc/mounts. A solution is to patch switch-root to unmount these filesystems instead of moving them, which is what dracut-002-unmount.patch does. Because we don't want to patch the one in util-linux (as it is a standard utility, documented in the manpage to move those filesystems), we should ship a patched switch-root with dracut. Another solution would be to fix OpenRC to expect these filesystems to be mounted.
(In reply to comment #3) > No, your changes do not fix the issue because, as I have already mentioned, > the switch-root program from util-linux is not patched with > dracut-002-unmount.patch. Sorry I missed that detail in your bug report. I was mainly looking at the filename conflict with util-linux. > This causes OpenRC to fail. Without the patch, switch-root will move the > /dev, /dev/pts, /proc and /sys filesystems to the new root before starting > /sbin/init. OpenRC however does not expect this, and will attempt to mount > new filesystems over the existing ones, failing to mount /dev/pts because it > will see the old one (shadowed by the new /dev) in /proc/mounts. > > A solution is to patch switch-root to unmount these filesystems instead of > moving them, which is what dracut-002-unmount.patch does. Because we don't > want to patch the one in util-linux (as it is a standard utility, documented > in the manpage to move those filesystems), we should ship a patched > switch-root with dracut. > > Another solution would be to fix OpenRC to expect these filesystems to be > mounted. Considering upstream is preferring the use the switch_root which is included with util-linux, I would rather not patch it to work in the manner you describe. Its kind of a bug with dracut, but openrc should also be able to sanely deal with situations like that. Since you're the one dealing with this problem more than me, I suggest you email the dracut mailing list [1] and tell them about it and get some ideas on how better they could resolve it. They're pretty open about ideas and I'd prefer to stick with what upstream does instead of "forking" from it. [1] http://fedoraproject.org/wiki/Dracut#Communicate
>=sys-fs/udev-146-r2 works with /dev already mounted.