[arch-projects] [mkinitcpio] mounting /usr from the initrd

Dave Reisner d at falconindy.com
Tue Aug 2 11:40:17 EDT 2011

On Tue, Aug 02, 2011 at 05:10:48PM +0200, Tom Gundersen wrote:
> Hi guys,
> I have been thinking about sorting out /usr being a separate
> mountpoint. Mainly because I keep getting bug reports that turn out to
> be caused by this.
> The current status is that we move some tools from /usr to / in the
> hope that this will allow us to boot without /usr being mounted. This
> mostly works, but not quite, as there are still stuff left in /usr
> that are used by early boot (and mostly just fails silently).
> This website created by the systemd folks sums it up nicely (just
> replace "systemd" with "initscripts" everywhere):
> <http://www.freedesktop.org/wiki/Software/systemd/separate-usr-is-broken>.
> The solution they propose, and which I agree with, is to mount /usr
> from the initrd just as we mount / (an alternative solution is to just
> declare separate /usr as not supported, but I guess that would not
> make us popular).
> Before working up a patch, I wanted to hear if there are any
> objections to this approach, and in particular that Thomas agrees that
> it is the right way to go.
> The interface I suggest is to allow two new kernel options "usr" and
> "rootflags" that correspond to "root" and "rootflags". The pivot_root
> stuff I submitted recently will already take care of unmounting. The
> syntax could obviously be discussed, and I suggest getting in touch
> with the dracut guys to make sure we choose the same syntax (I don't
> think they yet have support for this, but I might be wrong).
> Any thoughts?
> Cheers,
> Tom
> PS
> A nice sideeffect is that once we have this we can simplify a lot of
> our PKGBUILDS as they never need to put stuff in / any more, and
> eventually /bin, /sbin and /lib will be empty and can just be
> symlinked to /usr/{{,s}bin,lib}.

This could be a fair bit of work in mkinitcpio, as we'll need to teach
it some new tricks... I have a few ideas for how to go about this, in no
particular order of preference...

1) introduce a new cmdline var, call it something like "latemount",
which could accept options like "/dev/sda2,/usr;/dev/sda3,/var".
2) add a new var in /etc/mkinitcpio.conf called LATEHOOKS or AFTERHOOKS,
which would be run after root is mounted (successfully).
3) add a new hook which pulls in /etc/fstab. A kernel cmdline option
could then specify a delimited list of sources or destinations which
would be passed to mount. This depends on busybox's mount not sucking.

Note that all of these assume that the user is intelligent enough to
figure out how exactly how to create this extra device before its
mounted. I'm not sure how we'd handle this if someone has /usr on an
encrypted LVM spliced mdadm array....


More information about the arch-projects mailing list