Code: Select all
/dev/mapper/cswap none swap pri=1,defaults 0 0
Code: Select all
cswap /dev/disk/by-id/ata-SAMSUNG_SSD_PM851_mSATA_256GB_S1EVNYAF552489-part8 /dev/urandom swap,cipher=aes-cbc-essiv:sha256,size=256
Code: Select all
# cryptsetup status cswap
/dev/mapper/cswap is active and is in use.
type: PLAIN
cipher: aes-cbc-essiv:sha256
keysize: 256 bits
device: /dev/sda8
offset: 0 sectors
size: 23437312 sectors
mode: read/write
Code: Select all
# systemctl status dev-sda8.swap
● dev-sda8.swap - Swap Partition
Loaded: loaded (/run/systemd/generator.late/dev-sda8.swap; generated; vendor preset: enabled)
Active: failed (Result: exit-code) since Mon 2017-08-14 13:47:47 CEST; 1h 8min ago
What: /dev/sda8
Docs: man:systemd-gpt-auto-generator(8)
How can I prevent this?
EDIT:
Problem solved! The situation was similar to the one reported as a bug here https://bugs.debian.org/cgi-bin/bugrepo ... bug=772182. I will give a short description of what happens (in my opinion):
- 1. When Debian boots, the system daemon systemd activates quite a number of services and devices. One of these is the systemd-cryptsetup@cswap.service which takes care about the encrypted swap.
However, there is also the generator systemd-gpt-auto-generator which creates dev-sda8.swap. Later, dev-sda8.swap tries to switch on /dev/sda8 as swap and fails because swap space is already controlled by dev-mapper-cswap.swap.
2. It is therefore totally useless to stop, kill, or mask dev-sda8.swap since it gets dynamically created at every boot.
3. Now how on earth does systemd-gpt-auto-generator know that there should be a swap space on my partition /dev/sda8? The answer is that it reads the partition GUID code from the GPT (GUID Partition Table). This whole GUID talk can be quite confusing! You must distinguish the partition GUID code from the patition unique GUID! The latter is created when you partition the disk and is supposed to be unique all over the universe . On the other hand, the partition GUID code is just indicating the type of the partition: whether it is intended for Windows, Linux root, Linux home or whatever. I had set sda8 to type Linux swap which means a magic number of 0657FD6D-A4AB-43C4-84E5-0933C84B4F4F. When I corrected this number to 0FC63DAF-8483-4772-8E79-3D69D8477DE4 (Linux filesystem data) and rebooted, the error was gone.