Open mcassaniti opened 2 years ago
The "cheapest" solutions I have found so far after looking at the code for systemd-hibernate-resume-generator
is to automatically create an fstab line similar to the following which would need to run quite early:
# Label line taken straight from the command line
# Specifies a timeout to wait for the swap partition to be available
PARTLABEL=swap sw swap x-systemd.device-timeout=15 0 0
The other (possibly better) option is the kernel command line argument resumeflags=x-systemd.device-timeout=15
.
Describe the bug When I use a standalone
usr
partition and also usesystemd-repart
to setup the remainder of the partition table (root
andswap
partitions mainly), the unitsysusr-usr.mount
does not become activated. After several hours debugging I can confirm that the issue comes from ordering issues between:local-fs-pre.target
(the FS check forsysusr-usr.mount
is done bysystemd-fsck-usr.service
which is waiting onlocal-fs-pre.target
)systemd-hibernate-resume@.service
which is waiting on/dev/disk/by-partlabel/swap
and should run beforelocal-fs-pre.target
/dev/disk/by-partlabel/swap
which will not get generated untilsystemd-repart.service
runs.The unit
sysusr-usr.mount
does have the correct path to mount and points to the correct partition.If I remove
resume=PARTLABEL=swap
everything works. I should note that after the initial partition setup everything works just fine since both theroot
andswap
partitions exist.Distribution used Ubuntu 22.10 (in development). Happy to try another distribution on request. Ubuntu 22.04 does not have
systemd-repart
.Dracut version 056-3
Init system systemd v251 but I believe v249 supports
systemd-repart
.To Reproduce
usr
partition/usr/lib/repart.d
files to create aroot
andswap
partition. See the documentation here.mount.usr=
kernel command line argument, along with aresume=
argument. The full kernel command line does not require any other arguments and should not have aroot=
argument. I'd recommend settingrd.timeout=15
./dev/gpt-auto-root
will timeout.Expected behavior
The ordering of units should go roughly like this:
/dev/mapper/usr
.usr
partition is properly checked.usr
partition is mounted at/sysusr/usr
from the generated unit thatsystemd-fstab-generator
created./sysusr/usr
is mounted thesystemd-repart.service
unit should run which will create theroot
andswap
partitions along with the subsequent file systems./etc/crypttab
should now take place.systemd-repart
could for example be configured to use a key that is part of the RAM disk (yes I know that is unwise) or there could be relevant settings to load./sysroot
should be mounted./sysusr/usr
should either be unmounted or moved to/sysroot/usr
.initrd-fs.target
should be lined up and ready for boot.Additional context
In theory this should all work. I've been taking inspiration from the Fitting Everything Together blog post from Lennart Poettering.
Why not just edit the kernel command line later after the initial setup? Good question. Because secure boot doesn't allow editing the kernel command line and we really don't want to bundle two kernels to get things setup if that can be avoided.