[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

RE: Encrypted swap with cryptsetup won't mount at startup




> From: somebody.mozfr@gmail.com
> Date: Tue, 11 Aug 2015 10:08:05 +0200
>
> -----BEGIN PGP SIGNED MESSAGE-----
> Hash: SHA256
>
> On 11/08/2015 09:38, Arno Schuring wrote:
>> On one of my machines I've gotten this (kinda) working by removing
>> the systemd generator and manually creating a service file around
>> cryptdisks_start and cryptdisks_stop.
>
>
> As I have never wrote a systemd unit, and I can't find a simple doc on
> how to do it, can you show me the service file you wrote ?

This is my /etc/systemd/system/systemd-cryptsetup@cryptswap0.service.
The naming matters, as it should override the systemd-generator name.
The filename suffix (@cryptswap0) and Before= line should match
what you have in /etc/crypttab:

[Unit]
Description=Hack to prevent systemd soiling itself on auto-unlocked encrypted volumes
#BindTo=dev-%i.device
Before=dev-mapper-cryptswap0.swap
DefaultDependencies=no
IgnoreOnIsolate=yes

[Service]
Type=oneshot
ExecStart=/usr/sbin/cryptdisks_start %i
ExecStop=/usr/sbin/cryptdisks_stop %i
RemainAfterExit=yes

I have a similar one for my luks-backed lvm volume, but with
Before=lvm2.service instead of Before=$device.


Regards,
Arno

 		 	   		  

Reply to: