Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 293178 - sys-kernel/dracut-002 is broken w/ sys-apps/util-linux-2.16.1, patch included
Summary: sys-kernel/dracut-002 is broken w/ sys-apps/util-linux-2.16.1, patch included
Status: RESOLVED INVALID
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: [OLD] Core system (show other bugs)
Hardware: All Linux
: High normal (vote)
Assignee: Lance Albertson (RETIRED)
URL:
Whiteboard:
Keywords: Inclusion
Depends on:
Blocks:
 
Reported: 2009-11-14 15:21 UTC by Ambroz Bizjak
Modified: 2021-07-27 08:46 UTC (History)
0 users

See Also:
Package list:
Runtime testing required: ---


Attachments
fix switch_root issue (dracut-002-use-embedded-switch_root.patch,1.56 KB, patch)
2009-11-14 15:21 UTC, Ambroz Bizjak
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Ambroz Bizjak 2009-11-14 15:21:00 UTC
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.
Comment 1 Ambroz Bizjak 2009-11-14 15:21:48 UTC
Created attachment 210240 [details, diff]
fix switch_root issue
Comment 2 Lance Albertson (RETIRED) gentoo-dev 2009-12-09 08:26:15 UTC
  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!
Comment 3 Ambroz Bizjak 2009-12-09 15:36:09 UTC
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.
Comment 4 Lance Albertson (RETIRED) gentoo-dev 2009-12-09 22:08:01 UTC
(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

Comment 5 Ambroz Bizjak 2009-12-13 10:16:23 UTC
>=sys-fs/udev-146-r2 works with /dev already mounted.