systemd 254: ZFS /usr fix with systemd-stage-1

This commit is contained in:
Will Fancher 2023-08-02 14:56:25 -04:00
parent fdd898f8f7
commit 524714f7ea
2 changed files with 9 additions and 1 deletions

View File

@ -90,12 +90,17 @@ let
getPoolMounts = prefix: pool:
let
poolFSes = getPoolFilesystems pool;
# Remove the "/" suffix because even though most mountpoints
# won't have it, the "/" mountpoint will, and we can't have the
# trailing slash in "/sysroot/" in stage 1.
mountPoint = fs: escapeSystemdPath (prefix + (lib.removeSuffix "/" fs.mountPoint));
hasUsr = lib.any (fs: fs.mountPoint == "/usr") poolFSes;
in
map (x: "${mountPoint x}.mount") (getPoolFilesystems pool);
map (x: "${mountPoint x}.mount") poolFSes
++ lib.optional hasUsr "sysusr-usr.mount";
getKeyLocations = pool: if isBool cfgZfs.requestEncryptionCredentials then {
hasKeys = cfgZfs.requestEncryptionCredentials;

View File

@ -690,6 +690,9 @@ in {
"zpool create rpool /dev/vda2",
"zfs create -o mountpoint=legacy rpool/root",
"mount -t zfs rpool/root /mnt",
"zfs create -o mountpoint=legacy rpool/root/usr",
"mkdir /mnt/usr",
"mount -t zfs rpool/root/usr /mnt/usr",
"udevadm settle",
)
'';