Super User is a question and answer site for computer enthusiasts and power users. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

My computer has quite some memory (6GB) which is enough for most of what I do. A while back I was messing with my swap, turning it on and off with sudo swapon -a and sudo swapoff -a. In then end I must have left it turned off, since I now seem to have 0MBs of swap.

No problem normally, but I am now running some hefty analyses which are now using about 5GB of my swap and growing. So in order to avoid the analyses to terminate I wanted to turn on my swap again. So I ran "sudo swapon -a", but unfortunately this results in:

swapon: /dev/mapper/cryptswap1: stat() has failed: File or folder does not exist.

(I translated the output from Dutch to English, so the words may be off a little bit).

Does anybody know how I can enable my swap again? Since I don't want to halt my analyses, it is of course quite important that I can do it while the machine is running.

[EDIT] I'm on Ubuntu 12.04 and the contents of my fstab are as follows:

# <file system> <mount point>   <type>  <options>       <dump>  <pass>
proc            /proc           proc    nodev,noexec,nosuid 0       0
# / was on /dev/sda1 during installation
UUID=f2ef1c1b-f606-44ed-9405-979fb6fa8ca4 /               ext4    errors=remount-ro 0       1
# /home was on /dev/sda3 during installation
UUID=7a1f29ef-3fcd-40ce-8e2a-4b9181a46863 /home           ext4    defaults        0       2
# swap was on /dev/sda2 during installation
#UUID=d0ef2314-6a84-432d-94f8-0d46c91c3d99 none            swap    sw              0       0
/dev/mapper/cryptswap1 none swap sw 0 0
share|improve this question

migrated from Jun 24 '13 at 9:35

This question came from our site for professional and enthusiast programmers.

Which version of linux? – Aaron Digulla Jun 24 '13 at 9:41
Do you try to swap to a partition or to a file ? If partition: Is there swap defined in /etc/fstab? If a file, which file. Is it still present? Can you rerun mkswap on that file? Did you try to use encrypted swap (/dev/mapper/cryptswap1 seems to indicate that). Please add more information. – Hennes Jun 24 '13 at 9:44
@AaronDigulla - I'm on Ubuntu 12.04. Added it to my question. – kramer65 Jun 24 '13 at 9:56
@Hennes - I've barely done anything with fstab or swaps, apart from swapon and swapoff. I didn't even know you could swap to a partition as well as a file, so I hope you can bear with me. I added the contents of fstab to my question. Does that tell you anything? – kramer65 Jun 24 '13 at 9:56

Make sure the volume you are trying to access exists. From the looks you had an LVM or something else using the device mapper and your swap-volume was deleted or renamed from the mapper.

So you have to either recreate it or update your swap definition to the renamed device path.

share|improve this answer
Sorry, but your answer is a bit like Greek to me. I don't know what a device mapper is and I wouldn't know how to "update my swap definition to the renamed device path". Could you maybe explain it a little bit more simple? At which files do I have to look (I added fstab to my initial question) and which commands do I have to run? – kramer65 Jun 24 '13 at 10:00
The device mapper is a part of the linux file systems, enabling you to use devices that are mapped together(like LVM or Fake-RAID storages). Please try sudo lvdisplay -C to see if you are using LVM storage. – MKzero Jun 24 '13 at 13:57
Ah, thanks for the explanation. When running sudo lvdisplay -C I get an error saying: "sudo: lvdisplay: command not found". So I guess I am using something else (right?). Would you have any idea what I should do now? – kramer65 Jun 24 '13 at 16:02
That seems about right. Just noticed your fstab has the last line before the actual swap commented out. It shows that the mapper is used on the plain device that is encrypted. This line shows also a swap. You can try re-crypt /dev/sda2. Just google for "encrypted swap ubuntu" on how to do that. – MKzero Jun 24 '13 at 19:56

The text /dev/mapper/cryptswap1 in the output means two things:

  1. You use LVM (Logical Volume Manager) to manage your partitions
  2. The swap partition is encrypted

So the error you get can mean two things:

  1. There is something wrong with your LVM. Try sudo lvmdump to see what the current status of LVM is. That might give you a clue.
  2. You didn't specify the correct password during boot and the system couldn't decrypt the swap partition.

Also check your boot.log and other log files in /var/log/ for errors. That might give you an idea what's wrong.

share|improve this answer
1) sudo: lvmdump: command not found. 2) I always log in using my normal password which hasn't changed in ages. I think I indeed selected "encrypted" wherever possible when I installed Ubuntu, so could it have something to do with the fact that I disabled swap using 'sudo swapoff -a' and after that rebooted (many times in fact)? – kramer65 Jun 24 '13 at 10:19
Oh, and 3) I can't find any errors in boot.log. Would you have any other tip on how I could proceed from here? – kramer65 Jun 24 '13 at 10:25
1) try sudo /sbin/lvmdump 2) The system should ask a password before the login screen, while you can see text on a black screen. This link might also help: – Aaron Digulla Jun 24 '13 at 10:25
1) sudo: /sbin/lvmdump: command not found. 2) I've never seen my pc ask for a password before my login screen. The link you give revers to Ubuntu 5.10 and 6.06, is that information still valid? (ps. thanks for your efforts!) – kramer65 Jun 24 '13 at 10:32

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .