Cryptswap boot error - can't mount?

9,041

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.

Share:
9,041

Related videos on Youtube

woody
Author by

woody

Updated on September 18, 2022

Comments

  • woody
    woody over 1 year

    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?

  • woody
    woody over 11 years
    I edited my op to clarify my question. I want to fix the boot message I am getting. Not sure if cat /proc/swaps will help in that but i added it to my post
  • woody
    woody over 11 years
    Is it supposed to be sda5 or is it ok that my cat /proc/swaps is dm-0
  • woody
    woody over 11 years
    Thanks so much this finally fixed my problem and its mounting correctly!
  • FuzzyQ
    FuzzyQ over 11 years
    Glad it worked, congratulation!
  • Premek Brada
    Premek Brada about 10 years
    I tried this on the (upcoming) Ubuntu 14.04 and unfortunately the procedure did not help -- the swap got created at the last step with swapon /dev/mapper/cryptswap1 but it did not get mounted after reboot. It seems to me the workaround may not be able to help, due to issues described in this Launchpad bugreport discussion related to the issue (caveat: a technical discussion).
  • Nic Wortel
    Nic Wortel over 9 years
    This answer might be 1.5 years old, but still works! Thanks!