Ubuntu – Is the Swap (cryptswap) partition working properly

swap

I have a feeling it's not. I'm running Ubuntu 11.10 on a Toshiba Satellite L305-S5944 Laptop. Says I have 1.8 GiB of Ram (thought I had 2). When I look at the Resources tab in the System Monitor the Swap always says 0 bytes of 0 bytes. I tried reinstalling Ubuntu 11.10, but still says the same. Both times I choose the encrypt home directory option during install. Some times when I'm booting it says some thing like "could not mount cryptswap". Tried to get a screen shot but now it's not doing it. When I look at my hard disk in the Disk Utility it shows 3 partitions created during install: 248 GB ext 4, Extended 2.0 GB, and Unknown 2.0 GB. As you can see on the screen shots the partition called Unknown, has the Partition Type: Linux swap (0x82). Sorry wouldn't let me post images.

Been having problems with crashes and slow downs pretty regularly. Also I don't see a hibernate option when I click on the button in the upper right corner. So does it look like my swap space is not functioning properly?

It's my understanding that the swap space is encrypted. Is this why it's not registering in the System Monitor or is that indicating a problem?

Is there any way to test if the swap is functioning?

If it's not working, how would I make it work, looks like it's there already, just not working possibly?

The output of "free -m" is:

                total used free shared buffers cached 
Mem:            1883  1729 154  0      21      634 
-/+ buffers/cache:    1073 810 
Swap:           0     0    0 

Not sure whether it's LUKS or ecryptfs. All I did was click the check mark box that says "encrypt my home directory" or something similar during the normal installation process. I think it's ecryptfs cause I just checked the hidden files in my home folder and there's a hidden folder called ".ecryptfs"

ran blkid and the output was:

/dev/sda1: UUID="92a6b5e8-695f-4d54-a389-d5dd7c7b862e" TYPE="ext4" 
/dev/sdc1: LABEL="FreeAgent GoFlex Drive" UUID="04684AE3684AD2DA" TYPE="ntfs" 

sdc1 is my external HD. Also tried GParted and in addition to the sda1 it shows a sda 2 with a File System: "extended" and Size 1.87 GiB. It also shows a parition, sda5, nested inside sda2, with a File System "unknown" and size 1.87 GiB. Though next to the sda5 there is a red cirle with a "!" inside.

When I right on it and select "information" it says Status: Not mounted and at the bottom Warning: Unable to detect file system! Possible reasons are: -The file system is damaged -The file system is unknown to GParted -There is no file system available (unformatted) -The device entry /dev/sda5 is missing. Did I do something wrong during the install? I thought when I choose erase and use the whole hard drive that Ubuntu would create the swap automatically. Looks like it's there there but not working for some reason.

My /etc/fstab file looks like this:

# /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>
proc            /proc           proc    nodev,noexec,nosuid 0       0
# / was on /dev/sdb1 during installation
UUID=92a6b5e8-695f-4d54-a389-d5dd7c7b862e /               ext4    errors=remount-ro 0       1
# swap was on /dev/sdb5 during installation
#UUID=088145ec-4c28-43e4-b3de-9f6971b08704 none            swap    sw              0       0
/dev/mapper/cryptswap1 none swap sw 0 0

The output of sudo fdisk -l is:

Disk /dev/sda: 250.1 GB, 250059350016 bytes
255 heads, 63 sectors/track, 30401 cylinders, total 488397168 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: 0x0001d8e9

   Device Boot      Start         End      Blocks   Id  System
/dev/sda1   *        2048   484472831   242235392   83  Linux
/dev/sda2       484474878   488396799     1960961    5  Extended
/dev/sda5       484474880   488396799     1960960   82  Linux swap / Solaris

Disk /dev/sdc: 640.1 GB, 640135028224 bytes
1 heads, 63 sectors/track, 19845455 cylinders, total 1250263727 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: 0x2bc1313e

   Device Boot      Start         End      Blocks   Id  System
/dev/sdc1              63  1250258687   625129312+   7  HPFS/NTFS/exFAT

I noticed that my swap in the fstab was commented out so I deleted the # to uncomment and restarted though still not working.

Best Answer

No. I had the same issue. You have to make sure you have no swap on at all by running cat /proc/swaps. Then use mkswap to format the swap partition. Then in /etc/conf.d/dm-crypt (might be crypttab or something similar), you have to use the default urandom dmcrypt stuff at boot by adding these lines to the file:

swap=crypt-swap
target='/dev/sd*'

At least that's how I did it in Sabayon. Also if its acting up when you're booting and throwing you some random error about LUKS partitions, press e at the GRUB boot menu and remove "crypt_swap=/dev/sda5" from the kernel parameter line.

I'm a noob so don't blindly listen to me, but this is how I got where I am now.