On Monday, 5 August 2019 02:36:31 BST Grant Taylor wrote: > On 8/4/19 7:26 PM, Grant Taylor wrote: > > I am also using a bit of a hack that I think could be (re)used to allow > > /usr being a separate file system without /requiring/ an initramfs / > > initrd. (I'll reply in another email with details to avoid polluting > > this thread.) > > I think that a variation of a technique I'm using for LUKS encrypted > /home on a VPS could be used to allow booting without an initramfs / > initrd while maintaining a separate /usr file system. > > The problem is that /bin & /sbin would be symbolic links to /usr/bin & > /usr/sbin. So, any commands that would be needed to mount the /usr file > system would need to be directly accessible in /bin & /sbin paths, or > indirectly accessible in /usr/bin & /usr/sbin. > > IMHO this is a whopper of a hack. > > Create the bin and sbin directories inside of the /usr directory that is > the mount point so that they are on the underlying file system that /usr > is mounted over top of. Then copy the needed binaries to the /usr/bin & > /usr/sbin directories on the underlying file system. That way, > /sbin/fsck -> /usr/sbin/fsck still exists even before the real /usr is > mounted. > > I did say this is a whopper of a hack. > > It's trivial to access these directories even when the normal / full > /usr is mounted. > > 1) mkdir /mnt/root-underlay > 2) mount -o bind / /mnt/root-underlay > 3) ls /mnt/root-underlay/bin /mnt/root-underlay/sbin > > This "technique" / "trick" / "hack" works because the /bin & /sbin > ""directories are sym-links to the /usr/bin & /usr/sbin directories. > There is nothing that means that the contents of (/usr)/(s)bin can't > change from one command invocation to another. The /(s)bin sym-links > just need to point to a valid directory. They can easily be on the > root-underlay file system that /usr gets mounted on top of.
Interesting concept, thanks for sharing. Unless I misunderstand how this will work, it will create duplication of the fs for /bin and /sbin, which will both use extra space and require managing. Will you mount -bind the underlying fs in fstab? How will you make sure installations of the same binaries are installed/copied in both underlying and mounted /usr/* fs and kept in sync? By changing all affected ebuilds? It is a hack alright, to restore the previous default /usr functionality, so a useful option to consider. If I were to be asked my preference would be to revert the systemd inspired changes which caused this loss of functionality. ;-) -- Regards, Mick
signature.asc
Description: This is a digitally signed message part.