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

Tom Gundersen teg at jklm.no
Tue Aug 2 11:48:59 EDT 2011

On Tue, Aug 2, 2011 at 5:40 PM, Thomas Bächler <thomas at archlinux.org> wrote:
> Am 02.08.2011 17:10, schrieb Tom Gundersen:
>> 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>.
> Heh, doesn't the "separate-usr-is-broken" in the URL say it all? (Didn't
> read it yet, will have to soon.)

I'd be very happy if we just agreed that "separate-usr-is-broken" and
stopped trying to support it, and closed all bugs as WONTFIX. I just
assumed that was going to be a no-go, so tried finding a workaround.

> The purpose of the initrd is to do as few things as possible to get to
> the "real" system. If we can support a system that gets to the point of
> mounting /usr without needing things from /usr, we do it. If we can't
> support it, there is no point in ugly workarounds - if it's broken by
> design, don't do it.
> I won't accept any patch that modifies the mkinitcpio core to support
> this. I might consider a patch that does this in a hook and thus keeps
> things modular, if you think it is necessary. For example, write a hook
> that adds a new mount handler:

The simple case of having /usr as a regular partition can be achieved
as simply as the below patch (which certainly could be wrapped in a
hook). The question is how complicated setups we want to support, or
if we should just give up altogether (which you alluded to above).

commit 6814b137178ad6a676b74ea57f91a3b0f8622171
Author: Tom Gundersen <teg at jklm.no>
Date:   Tue Aug 2 17:47:52 2011 +0200

    monut /usr

diff --git a/init b/init
index 9bcc21a..a7e7f2b 100644
--- a/init
+++ b/init
@@ -84,6 +84,9 @@ fi
 # Mount root at /new_root
 mkdir -p /new_root
 ${mount_handler:-default_mount_handler} /new_root
+cp /new_root/etc/fstab /etc/fstab
+mount /usr
+mount --move /usr /new_root/usr

 if [ "$(stat -c %D /)" = "$(stat -c %D /new_root)" ]; then

More information about the arch-projects mailing list