Take the 2-minute tour ×
Ask Ubuntu is a question and answer site for Ubuntu users and developers. It's 100% free, no registration required.

Update 3:

I decided to reinstall the system from scratch to remove any old cruft lying around since I had been experiencing some other issues after the upgrade aswell. Howver, this issue persisted.

On a clean install, choosing to install using "encrypted home" leads to a broken encrypted swap configuration.

Update 2:

I fixed the partioning order that cfdisk complained about, but he issue persists. The swap is now on /dev/sda6, and I can get it up and running as follows:

~$ sudo mkswap /dev/sda6
Setting up swapspace version 1, size = 7998460 KiB
no label, UUID=18881d0f-d9ec-43be-a23f-0cbd78ea6d22

$sudo nano /etc/crypttab # Update crypttad with new UUID

$ sudo /etc/init.d/cryptdisks reload
 * Stopping remaining crypto disks...
 * cryptswap1 (stopped)...                                               [ OK ] 
 * Starting remaining crypto disks...                                        
 * cryptswap1 (starting)..
 * cryptswap1 (started)...                                               [ OK ] 
$ sudo swapon -a

$ls -l /dev/disk/by-uuid/
total 0
lrwxrwxrwx 1 root root 10 May 11 09:04 08b07f88-6da5-4b40-b062-42b3bb1c5f00 -> ../../sda3
lrwxrwxrwx 1 root root 10 May 11 09:08 18881d0f-d9ec-43be-a23f-0cbd78ea6d22 -> ../../sda6
lrwxrwxrwx 1 root root 10 May 11 09:04 19aa372c-05c8-4226-8f09-c54e5566e816 -> ../../sda5
lrwxrwxrwx 1 root root 10 May 11 09:04 A800B16E00B143DA -> ../../sda1
lrwxrwxrwx 1 root root 10 May 11 09:04 D28230E68230D129 -> ../../sda2
lrwxrwxrwx 1 root root 10 May 11 09:08 fcc8c419-8fec-4d4d-b55e-9e4c3b04d21d -> ../../dm-0

But after a reboot swap fails to activate and it once again looks like this:

$ ls -l /dev/disk/by-uuid/
total 0
lrwxrwxrwx 1 root root 10 May 11 09:12 08b07f88-6da5-4b40-b062-42b3bb1c5f00 -> ../../sda3
lrwxrwxrwx 1 root root 10 May 11 09:12 19aa372c-05c8-4226-8f09-c54e5566e816 -> ../../sda5
lrwxrwxrwx 1 root root 10 May 11 09:12 A800B16E00B143DA -> ../../sda1
lrwxrwxrwx 1 root root 10 May 11 09:12 D28230E68230D129 -> ../../sda2

My guess at the moment is that when setting up the disk as being encrypted linux no longer recognizes the partition type and therefore doesn't load it properly causing it to not register for it's UUID and therefore cryptswap can't find it causing the failure. But I don't know how to fix it..

Updated question:

Further testing revealed that I could get the swap up and running by running $ mkswap /dev/sda5

and then updating /etc/crypttab with the correct UUID and following the steps outlined here: How do I setup an encrypted swap file?

The problem however remains when I reboot the computer, the /dev/sda5 doesn't appear when I run

$ ls -l /dev/disk/by-uuid/

If I do:

$ cfdisk /dev/sda 

I get the following error:

FATAL ERROR: Bad logical partition 6: enlarged logical partitions overlap
                      Press any key to exit cfdisk

The graphical "Disks" utility doesn't complain about any error when opening the disk using it.

$ sudo fdisk -l

Disk /dev/sda: 256.1 GB, 256060514304 bytes
255 heads, 63 sectors/track, 31130 cylinders, total 500118192 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0x619aebf1

   Device Boot      Start         End      Blocks   Id  System
/dev/sda1   *        2048      206847      102400    7  HPFS/NTFS/exFAT
/dev/sda2          206848   100870143    50331648    7  HPFS/NTFS/exFAT
/dev/sda3       191397888   192397311      499712   83  Linux
/dev/sda4       192399358   500117503   153859073    5  Extended
/dev/sda5       484118528   500117503     7999488   82  Linux swap / Solaris
/dev/sda6       192399360   484118527   145859584   83  Linux

Partition table entries are not in disk order

Original question:

After upgrading to 14.04 (from 13.04) my computer has been experiencing severe slowdowns, when running top i noticed kswap0 taking up alot of cpu time. I also noticed that I didn't have any swap space!

$ sudo swapon -a
swapon: /dev/mapper/cryptswap1: stat failed: No such file or directory

There seems to be some problem with my encrypted swap setup (didn't even know that I had one)

$ cat /etc/crypttab 
cryptswap1 UUID=abe3c568-c8fd-4dfb-b8e9-0520d442dd61 /dev/urandom swap,cipher=aes-cbc-essiv:sha256

$ ls -l /dev/disk/by-uuid/
total 0
lrwxrwxrwx 1 root root 10 May  6 11:00 08b07f88-6da5-4b40-b062-42b3bb1c5f00 -> ../../sda3
lrwxrwxrwx 1 root root 10 May  6 11:00 19aa372c-05c8-4226-8f09-c54e5566e816 -> ../../sda6
lrwxrwxrwx 1 root root 10 May  6 11:00 A800B16E00B143DA -> ../../sda1
lrwxrwxrwx 1 root root 10 May  6 11:00 D28230E68230D129 -> ../../sda2

And looking at my fstab

$ cat /etc/fstab
# /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).
#
# <file system> <mount point>   <type>  <options>       <dump>  <pass>
# / was on /dev/sda6 during installation
UUID=19aa372c-05c8-4226-8f09-c54e5566e816 /               ext4    errors=remount-ro 0       1
# /boot was on /dev/sda3 during installation
UUID=08b07f88-6da5-4b40-b062-42b3bb1c5f00 /boot           ext2    defaults        0       2
# swap was on /dev/sda5 during installation
#UUID=abe3c568-c8fd-4dfb-b8e9-0520d442dd61 none            swap    sw              0       0
/dev/mapper/cryptswap1 none swap sw 0 0

My guess is that there is something wrong the the setup of sda5, but I don't know how to fix it since it is setup up to be encrypted. Would appreciate some help as how to proceed.

share|improve this question
    
I don't know anything about encrypted partitions, but that first error suggests that the swap partition hasn't been mounted. Also the mounting line for it in the /etc/fstab is commented out. I would try just uncommenting that line and restarting to check if that fixes it –  Anake May 8 at 10:38
    
I'm quite sure that it is supposed to be commented out and the cryptswap1 line is responsible for mounting it indirectly using the information in /etc/crypttab. Your suggestion would surely mount it in an unencrypted fashion? –  ajn May 8 at 10:47
1  
Will this work? https://ubuntuforums.org/showthread.php?t=2224129 I am unsure about some of the commands and I don't want to screw up Ubuntu. –  Simon May 15 at 23:07
    
It looks similiar to what I tried, I would expect it to work for one reboot then stop working again once you've activated the encrypted swap for the first time. –  ajn May 16 at 6:10
    
For the moment I've just gone back to using regular swap. The main scenario I'm using encryption against is if someone steals my laptop and someone with moderate linux skills decided to poke around to see if they can find something interesting, i.e most likely just try to boot using usb and mount my home partition. I don't have anything that I believe someone would find valuable enough to try to start recovering fragments of it from the swap. It really should be an install option to use encrypted home + regular swap. –  ajn May 16 at 6:11

2 Answers 2

I have this problem, as did the people in question 332625. Some combination of suspend and reboot loses the UUID of your swap partition (as the comment in your /etc/fstab says, confirm this with sudo blkd), so the line in your /etc/crypttab to use that UUID as encrypted swap fails.

I'm having no luck switching /etc/crypttab to use the partition's /dev name (/dev/sda6 in your case) or dev/disk/by-id/ name instead of the vanishing UUID.

Abandoning encrypted swap is the easiest and so far best solution, sadly.

share|improve this answer
    
this issue is very old i wonder why they didn't fixed it already, now i am facing the same problem with my desktop and can't get it running, fixed it on my laptop in the past but can't remember how :( –  tomasb Jul 18 at 19:28

Have a look at this. I fixed this issue by simply replacing UUID=... with /dev/sda3 in /etc/crypttab.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.