7

Helo

I have a fresh install of 14.04 on a laptop with an SSD hard drive. When installing I turned on Full Disk Encryption as well as encryption of home folder.

Partitioning was left to the installer with no changes made by me.

Would anyone know why my swap is not getting turned on, and how to fix it?

My fstab

/dev/mapper/ubuntu--vg-root /               ext4    errors=remount-ro 0       1
# /boot was on /dev/sda1 during installation
UUID=54b1c8ac-4c47-4d8a-a748-e15b1d6eb2ba /boot           ext2    defaults        0       2
/dev/mapper/ubuntu--vg-swap_1 none            swap    sw              0       0
/dev/sr0        /media/floppy0  auto    rw,user,noauto,exec,utf8 0       0
/dev/mapper/cryptswap1 none swap sw 0 0

my crypttab

sda5_crypt UUID=59a0e1c9-2517-4434-b9bd-c3633047190d none luks,discard
cryptswap1 UUID=171441f7-054f-423a-ad8b-eba623bf67c9 /dev/urandom swap,cipher=aes-cbc-essiv:sha256

swapon -s reports:

Filename                Type        Size    Used    Priority

free reports:

             total       used       free     shared    buffers     cached
Mem:       3740660    3463264     277396     310880      37924    1643064
-/+ buffers/cache:    1782276    1958384
Swap:            0          0          0

If I try to enable swap I get

sudo swapon -a
swapon: /dev/mapper/ubuntu--vg-swap_1: read swap header failed: Invalid argument
swapon: /dev/mapper/cryptswap1: stat failed: No such file or directory

fdisk reports

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: 0x000965cc

   Device Boot      Start         End      Blocks   Id  System
/dev/sda1   *        2048      499711      248832   83  Linux
/dev/sda2          501758   500117503   249807873    5  Extended
/dev/sda5          501760   500117503   249807872   83  Linux

Disk /dev/mapper/sda5_crypt: 255.8 GB, 255801163776 bytes
255 heads, 63 sectors/track, 31099 cylinders, total 499611648 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: 0x00000000

Disk /dev/mapper/sda5_crypt doesn't contain a valid partition table

Disk /dev/mapper/ubuntu--vg-root: 251.8 GB, 251821817856 bytes
255 heads, 63 sectors/track, 30615 cylinders, total 491839488 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: 0x00000000

Disk /dev/mapper/ubuntu--vg-root doesn't contain a valid partition table

Disk /dev/mapper/ubuntu--vg-swap_1: 3976 MB, 3976200192 bytes
255 heads, 63 sectors/track, 483 cylinders, total 7766016 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: 0x00000000

Disk /dev/mapper/ubuntu--vg-swap_1 doesn't contain a valid partition table

blkid reports

/dev/sda1: UUID="54b1c8ac-4c47-4d8a-a748-e15b1d6eb2ba" TYPE="ext2" 
/dev/sda5: UUID="59a0e1c9-2517-4434-b9bd-c3633047190d" TYPE="crypto_LUKS" 
/dev/mapper/sda5_crypt: UUID="nbHinG-ylK8-KGxN-FTXP-GYnd-yhcj-zbJ3qd" TYPE="LVM2_member" 
/dev/mapper/ubuntu--vg-root: UUID="93d6000b-74cb-47a6-9535-9f5a49c95c0e" TYPE="ext4"
Jan Geep
  • 2,017

3 Answers3

10

I experienced this with Linux Mint 17 (based on 14.04) and searched for a solution without success.

I did a little investigation as you had above and it showed that while an entry existed in crypttab, that UUID didn't actually exist when viewing the blkid output. So, I issued a sudo mkswap /dev/mapper/mint--vg-swap_1 and copied the newly generated UUID into my crypttab file's cryptswap1 entry and rebooted. My swap problem is solved!

Your entry for mkswap will be specific to your distro and according to the information above should be /dev/mapper/ubuntu--vg-swap_1. YMMV.

user289445
  • 101
  • 4
3

I had the same issue and I succeed to solved it with the existed comments, thanks guys :). Here the following steps I followed, my home is encrypted and I have a dedicated swap partition.

Log on via CLI with the root account and format swap partition

sudo mkswap /dev/sdaX

Check the swap partition UUID

sudo blkid /dev/sdaX

Add the following line in the /etc/fstab

UUID=XXXXXXXXXX none swap sw 0 0

Note! I disable the line /dev/mapper/cryptswap1 none swap sw 0 0 but I assume my swap should not be encrypted...

If someone know how to do the same with an encrypted swap, I will appreciate :).

kasiu
  • 31
1

Do you really need swap? How much ram do you have? Swap can unnecessarily shorten the lives of SSD systems with plenty of ram...

It looks to me like somehow your swap partition didn't get created during setup although you do have a uuid for it. I'm not really sure how that happened...I guess it depends on a lot of factors. The unfortunate recommendation I have for you is to go without a swap partition if you have at least 4 gb of ram or simply reinstall from the start.

The guide I like most, although it takes a lot more manual work is here.

Hope that helps...