Sample Header Ad - 728x90

Systemd, crypttab and starting units after decryption

0 votes
1 answer
979 views
I have an encrypted partition that I configured with crypttab like /etc/crypttab:
name UUID= none luks,noauto
and /etc/fstab
UUID= /mnt/mountpoint ext4 defaults,noauto 0,0
Now, I want the unit nfs-server.service to start up automatically once I manually decrypted the partition using systemctl start systemd-cryptsetup@name.service. With some advice on the #debian-Matrix-Channel I finally got
# systemctl edit nfs-server.service
[Unit]
After=systemd-cryptsetup@name.service
After=mnt-mountpoint.mount
Requires=mnt-mountpoint.mount
With this setup I can start the nfs-server after decrypting manually. Still, I'd prefer systemd to automatically start nfs-server (which in turn should already auto-mount the then decrypted partition). How do I need to edit the nfs-server.service (or maybe even another unit?) in order for systemd to start it automatically once I decrypted the partition? I guess I could similarly use the logic for other units to start automatically after the nfs-server.service?
Asked by famfop (136 rep)
Jan 2, 2023, 03:27 PM
Last activity: Jan 2, 2023, 04:40 PM