While typing up 2 important details I had forgotten to mention, I
figured out the clue: the cryptdisks initscript never actually ran
before either, and the whole thing just worked thanks to
systemd-cryptsetup that got removed during the upgrade (not sure why)
The 2 clues I was writing:
a) now I'm wondering if before debian stable to debian testing upgrade I
did, cryptsetup commands of /etc/crypttab were happening elsewhere in
systemd and that /etc/init.d/cryptdisks was never actually run
2) after the upgrade, while debugging, I had these:
sauron:/etc/systemd/system# l /lib/systemd/system/cryptdisks-early.service
/lib/systemd/system/cryptdisks.service
lrwxrwxrwx 1 root root 9 Oct 18 07:47
/lib/systemd/system/cryptdisks-early.service -> /dev/null
lrwxrwxrwx 1 root root 9 Oct 18 07:47 /lib/systemd/system/cryptdisks.service ->
/dev/null
masking the service, and I deleted those 2 files, but now I see that
they were there all along in an older backup, so it looks like
/etc/init.d/cryptdisks was apparently never run as intended but somehow
my disks were decrypted anyway, so I never noticed.
>From there, I finally realized that there is a seperate
systemd-cryptsetup package that somehow
was missing from my system after the upgrade. No idea why :-/
Obviously, things work better with it, and this list is probably not the
right place to figure out why the debian apt install upgrade dropped
that package somehow (it was very big upgrade).
But, this is still a bit of black magic/black box to me, and I would at
least love to learn from all this:
1) why did the original /etc/init.d/cryptdisks initscript work fine
after boot, but refused to ever run (probably dependency hang, but I got
not useful message or debug about it) when I tried to run it from the
incomplete boot rescue shell.
2) why I failed to make my own /lib/systemd/system/cryptdisks.service
that did anything (pasted in original message below)
3) why systemd had to make cryptdisks special and take it over with some
internal binary (probably some edge case reason)?
Thanks,
Marc
On Mon, Oct 28, 2024 at 12:19:10AM -0700, Marc MERLIN wrote:
> This is on debian testing (trix)
> ii cryptsetup 2:2.7.5-1amd64disk encryption support -
> startup scripts
> ii systemd256.7-2 amd64system and service manager
>
> So I see that for some reason systemd still uses an initscript, latest
> version in debian testing, and it seems
> like the deps are wrong, so nothing starts it. The boot also hangs and fails
> to succeed due to filesytems in fstab
> waiting to be decyrpted
> sauron:~# dpkg -L cryptsetup | grep /etc
> /etc
> /etc/default
> /etc/default/cryptdisks
> /etc/init.d
> /etc/init.d/cryptdisks
> /etc/init.d/cryptdisks-early
>
> systemd-sysv-generator[2541]: SysV service '/etc/init.d/cryptdisks' lacks a
> native systemd unit file. ~ Automatically generating a unit file for
> compatibility. Please update package to include a native systemd uni>
> systemd-sysv-generator[2541]: SysV service '/etc/init.d/cryptdisks-early'
> lacks a native systemd unit file. ~ Automatically generating a unit file for
> compatibility. Please update package to include a native syste>
> systemd-sysv-generator[2541]: Overwriting existing symlink
> /run/systemd/generator.late/cryptdisks.service with real service.
>
> It is not started by anything at boot, although it used to, but no idea how
>
> Now, I need to start it manually at boot with
> sauron:~# systemctl start cryptdisks.service
> sauron:~# dmsetup ls
> cryptroot (253:0)
> eswap (253:1)
> pool1 (253:2)
> pool2 (253:3)
> pool3 (253:4)
> pool4 (253:5)
>
> but this only works if the boot succeeds to completion.
> And for that to happy, I need to comment out all the filesystems in /etc/fstab
> that rely on decrypted filetsystems
>
> for instance:
> #LABEL=btrfs_pool1 /mnt/btrfs_pool1 btrfs
> defaults,nofail,compress=lzo,skip_balance,space_cache=v2,noatime,subvolid=0
> 0 0
>
>
> if I uncomment it, systemd hangs on trying to mount the FS with missing
> device
>
> sauron:~# cat /etc/crypttab
> cryptroot
> /dev/disk/by-id/nvme-Samsung_SSD_970_EVO_Plus_2TB_S4Z7NG0M709677T-part7
> /.cppwd luks,discard
> pool1
> /dev/disk/by-id/nvme-Samsung_SSD_970_EVO_Plus_2TB_S4Z7NG0M709677T-part8
> /.cppwd luks,discard
>
> So two main I don't understand are:
> How can I get cryptdisks.service not to refuse to start at boot and tell me
> what dep it's missing?
> if my filesystems are in /etc/fstab, they fail to mount with
> Oct 27 22:22:59 sauron.svh.merlins.org systemd[1]:
> dev-disk-by\x2dlabel-btrfs_pool1.device: Job
> dev-disk-by\x2dlabel-btrfs_pool1.device/start timed out.
> Oct 27 22:22:59 sauron.svh.merlins.org systemd[1]: Timed out waiting for
> device dev-disk-by\x2dlabel-btrfs_pool1.device -
> /dev/disk/by-label/btrfs_pool1.
> Oct 27 22:22:59 sauron.svh.merlins.org systemd[1]: Dependency failed for
>