<div dir="ltr"><div><div><div><div>TLDR: Why does cryptswap create /dev/mapper/cryptswap1, rather than the swap partition that pre-exists and do I need to keep both in /etc/fstab?<br></div><div><br>Last night I upgraded me server to 16.04 (RAID 1 with LVM). At reboot, it stalled with the message:<br><pre>Please enter passphrase for disk cryptswap1 on none!</pre>This halted the boot process and while any random key-mashing could get past it, it did present something of a problem.There's a few bugs* about it and after some head scratching I did manage to get around it.<br></div><br></div>My /etc/crypttab started out like this:<br><span style="font-family:monospace,monospace"><span style="font-family:monospace,monospace"># <target name> <source device>         <key file>      <options><br></span>cryptswap1 /dev/md-0 /dev/urandom swap,cipher=aes-cbc-essiv:sha256</span><br><br></div>I know that source device is wrong from a simple "ls /dev/mapper":<br><span style="font-family:monospace,monospace">crw-------  1 root root 10, 236 Nov  5 01:00 control<br>lrwxrwxrwx  1 root root       7 Nov  5 01:00 primary-home -> ../dm-2<br>lrwxrwxrwx  1 root root       7 Nov  5 01:00 primary-root -> ../dm-0<br>lrwxrwxrwx  1 root root       7 Nov  5 01:00 primary-swap -> ../dm-1</span><br><br></div>Great, it's trying to use my root partition! So I updated /etc/crypttab:<br><div><div><div><span style="font-family:monospace,monospace"># <target name> <source device>         <key file>      <options><br>cryptswap1 /dev/mapper/primary-swap /dev/urandom swap,cipher=aes-cbc-essiv:sha256</span><br><br></div><div>I then started the crypt swap with "sudo cryptdisks_start cryptswap1" and saw a new device appear:<br><span style="font-family:monospace,monospace">crw-------  1 root root 10, 236 Nov  5 01:00 control<br>lrwxrwxrwx  1 root root       7 Nov  5 01:00 cryptswap1 -> ../dm-3<br>lrwxrwxrwx  1 root root       7 Nov  5 01:00 primary-home -> ../dm-2<br>lrwxrwxrwx  1 root root       7 Nov  5 01:00 primary-root -> ../dm-0<br>lrwxrwxrwx  1 root root       7 Nov  5 01:00 primary-swap -> ../dm-1</span><br><br></div><div>However, "swapon" still failed with some moaning about and inability to read the header. Checking /etc/fstab revealed a potential problem:<br><span style="font-family:monospace,monospace"># <file system> <mount point>   <type>  <options>       <dump>  <pass><br>proc            /proc           proc    nodev,noexec,nosuid 0       0<br>/dev/mapper/primary-root /               ext4    errors=remount-ro 0       1<br>/dev/mapper/primary-home /home           ext4    defaults        0       2<br>/dev/mapper/primary-swap none            swap    sw              0       0<br>/dev/mapper/cryptswap1 none swap sw 0 0</span><br><br></div><div>Two swaps? Commenting out /dev/mapper/primary-swap seemed to solve it and booting now proceeds A-OK.<br><br></div><div>Great, it's fixed. I think.<br>Why this new device? Why not just use /dev/mapper/primary-swap?<br></div><div>And is it *really* fixed or just working by fluke?<br>Do I need to restore /dev/mapper/primary-swap and run two swaps somehow?<br></div><div>I've tried to find some documentation and either not succeeded or simply failed to understand (my excuse is the painkillers).<br></div><div><br></div><div>Disclaimer: This has been steadily upgraded from 12.04 and I don't recall string encrypted swap, but I deffo have encrypted home.<br><br></div><div>Yours in befuddlement,<br><br></div><div>Jason<br></div><div><br></div><div>* Seemingly related bugs:<br>1. <a href="https://bugs.launchpad.net/ubuntu/+source/ecryptfs-utils/+bug/1453738">https://bugs.launchpad.net/ubuntu/+source/ecryptfs-utils/+bug/1453738</a><br>2. <a href="https://bugs.launchpad.net/ubuntu/+source/ecryptfs-utils/+bug/953875">https://bugs.launchpad.net/ubuntu/+source/ecryptfs-utils/+bug/953875</a><br>3. <a href="https://bugs.launchpad.net/ubuntu/+source/systemd/+bug/1449555">https://bugs.launchpad.net/ubuntu/+source/systemd/+bug/1449555</a><br></div></div></div></div>