Cryptswap boot error - can't mount?

I believe i have my swap set up but am not sure because on start up it says that it is something along the lines of "could not mount /dev/mapper/cryptswap1 M for manual S for skip". But it appears to be mounted? I have already tried this solution with no success.

When i run free -m the output is:

             total       used       free     shared    buffers     cached
Mem:          3887        769       3117          0         54        348
-/+ buffers/cache:        366       3520
Swap:         4026          0       4026

and sudo bklid is:

/dev/sda1: UUID="9fb3ccd6-3732-4989-bfa4-e943a09f1153" TYPE="ext4" 
/dev/mapper/cryptswap1: UUID="bd9fe154-8621-48b3-95d2-ae5c91f373fd" TYPE="swap"

and cat /etc/crypttab is:

cryptswap1 /dev/sda5 /dev/urandom swap,cipher=aes-cbc-essiv:sha256

my /etc/fstab is:

# /etc/fstab: static file system information.
#
# Use 'blkid' to print the universally unique identifier for a
# device; this may be used with UUID= as a more robust way to name devices
# that works even if disks are added and removed. See fstab(5).
#
#                
proc            /proc           proc    nodev,noexec,nosuid 0       0
# / was on /dev/sda1 during installation
UUID=9fb3ccd6-3732-4989-bfa4-e943a09f1153 /               ext4    
errors=remount-ro 0       1
# swap was on /dev/sda5 during installation
#UUID=bb0e378e-8742-435a-beda-ae7788a7c1b0 none            swap    
sw              0       0
/dev/mapper/cryptswap1 none swap sw 0 0

cat /proc/swaps output is:

Filename             Type        Size    Used    Priority
/dev/dm-0                               partition   4123644 0   -1

Is my swap not setup correctly or how can i fix my boot message?


Solution 1:

I happened to stumble upon this problem for 3 different releases of Ubuntu on two different computers. While most of the time the swap-partition was mounted despite the warning message, sometimes the GUI refused to start upon boot completion because of it.

Here's what I did as a workaround:

Open a terminal by pressing Ctrl + Alt + T.

Type gksudo gedit /etc/fstab and press Enter.

Search for the line that reads:

/dev/mapper/cryptswap1 none swap sw 0 0

Now enter the value noauto right after sw (separated by a comma), so it looks like this:

/dev/mapper/cryptswap1 none swap sw,noauto 0 0

Save and exit. This way, your swap partition won't be mounted while booting, thus the warning message won't appear or even hinder the login screen to appear.

Now type in a terminal

gksudo gedit /etc/rc.local

and enter the following lines before the entry exit 0:

sleep 10

swapon /dev/mapper/cryptswap1

If there's no entry exit 0, you'll have to enter it right beneath those two lines. Save and exit again. This will tell your system to wait 10 seconds after login to mount your encrypted swap partition.

Reboot your system. You should not get the warning message any longer. After login, wait some time, then open up a terminal again and type

free -m

Your output should look something like this:

fuzzyq@Samsung-R710:~$ free -m

              total       used       free     shared    buffers     cached

 Mem:          3949       3806        143          0         86       1783

 -/+ buffers/cache:       1936       2013

 Swap:         4095          0       4095

The last line is the important one. If there's a positive value showing for total swap, your swap partition was being mounted successfully.

Solution 2:

You don't mount swap file systems. You can however check that they're in use with:

cat /proc/swaps

which will show you all block devices configured to be used as swap.