Gentoo Archives: gentoo-user

From: Grant Taylor <gtaylor@×××××××××××××××××××××.net>
To: Gentoo-Users <gentoo-user@l.g.o>
Subject: [gentoo-user] HACK: Boot without an initramfs / initrd while maintaining a separate /usr file system.
Date: Mon, 05 Aug 2019 01:36:50
Message-Id: 2681c6ef-99d9-1017-4379-d0a76144e8ff@spamtrap.tnetconsulting.net
1 On 8/4/19 7:26 PM, Grant Taylor wrote:
2 > I am also using a bit of a hack that I think could be (re)used to allow
3 > /usr being a separate file system without /requiring/ an initramfs /
4 > initrd. (I'll reply in another email with details to avoid polluting
5 > this thread.)
6
7 I think that a variation of a technique I'm using for LUKS encrypted
8 /home on a VPS could be used to allow booting without an initramfs /
9 initrd while maintaining a separate /usr file system.
10
11 The problem is that /bin & /sbin would be symbolic links to /usr/bin &
12 /usr/sbin. So, any commands that would be needed to mount the /usr file
13 system would need to be directly accessible in /bin & /sbin paths, or
14 indirectly accessible in /usr/bin & /usr/sbin.
15
16 IMHO this is a whopper of a hack.
17
18 Create the bin and sbin directories inside of the /usr directory that is
19 the mount point so that they are on the underlying file system that /usr
20 is mounted over top of. Then copy the needed binaries to the /usr/bin &
21 /usr/sbin directories on the underlying file system. That way,
22 /sbin/fsck -> /usr/sbin/fsck still exists even before the real /usr is
23 mounted.
24
25 I did say this is a whopper of a hack.
26
27 It's trivial to access these directories even when the normal / full
28 /usr is mounted.
29
30 1) mkdir /mnt/root-underlay
31 2) mount -o bind / /mnt/root-underlay
32 3) ls /mnt/root-underlay/bin /mnt/root-underlay/sbin
33
34 This "technique" / "trick" / "hack" works because the /bin & /sbin
35 ""directories are sym-links to the /usr/bin & /usr/sbin directories.
36 There is nothing that means that the contents of (/usr)/(s)bin can't
37 change from one command invocation to another. The /(s)bin sym-links
38 just need to point to a valid directory. They can easily be on the
39 root-underlay file system that /usr gets mounted on top of.
40
41
42
43 --
44 Grant. . . .
45 unix || die

Replies