System not mounting swap partition

Even though the swap partition exists, and set to load in fstab, it's still not being mounted.

fdisk returns this for the swap partition:

file system: /dev/sda5
      start: 1
        end: 244
     blocks: 1951744
         id: 82
     system: Linux swap / Solaris

and in my fstab it says

file system: /dev/sda5
mount point: none
       type: swap
    options: sw
       dump: 0
       pass: 0

and I can load it fine with swapon /dev/sda5 but it just won't load at boot.

Is there more information that I can give to help troubleshoot? I dont know what other info could be useful


As requested, full fstab file:

# <file system> <mount point>   <type>  <options>            <dump>  <pass>
proc            /proc           proc    nodev,noexec,nosuid  0       0
/dev/sda6       /               ext4    errors=remount-ro    0       1
/dev/sda5       none            swap    sw                   0       0
/dev/sr1        none            udf     rw,noauto            0       0

I was looking at the system log and I saw this, not sure what it means or if it's normal but:

Apr 29 17:57:24 caelan-ubuntu os-prober: debug: running /usr/lib/os-probes/50mounted-tests on /dev/sda5
Apr 29 17:57:24 caelan-ubuntu 50mounted-tests: debug: /dev/sda5 is a swap partition; skipping

output of mountall

mountall: Did not receive a reply. Possible causes include: the remote application did not send a reply, the message bus security policy blocked the reply, the reply timeout expired, or the network connection was broken.
mountall: Connection is closed

output of mountall -v

http://pastie.org/private/ras9mc7mf66yudnjoem4w

swap finished
...
local 4/4 remote 0/0 virtual 12/12 swap 0/0

not sure, still not loading swap... still can be added in commandline, and my windows partition is being mounted on boot, and that is in the fstab too.


This is going to sound stupid, but try it: reorder /etc/fstab to put the swap partition last.

It seems that mountall -v fails harmlessly when run as NON-root user, and its output can be used to diagnose why mountall doesn't work right at boot. Your last line of output from mountall -v includes the critical clue:

local 4/4 remote 0/0 virtual 12/12 swap 0/0

In other words, 0 swap drives mounted, 0 swap drives found in /etc/fstab.

Now why didn't mountall find your swap drive listed in /etc/fstab? Good question. This should probably be a bug against mountall. To diagnose it, I copied your /etc/fstab and ran mountall -v as non-root user. By editing /etc/fstab randomly and continuing to test mountall -v, I found how to change mountall's reported "swap 0/0". Just reordering the lines of /etc/fstab was enough to make it change to "swap 0/1", in other words, 1 swap drive found in /etc/fstab. With that, it may be enough to boot properly. If not, please post new result of mountall -v.


Thank you for your question. As I was looking at it, I discovered that my system had the same problem as yours after upgrading to Natty, yesterday. I believe the problem is that the UUID of the swap partition changed during the upgrade. Here is how I fixed it.

  1. Run sudo blkid. This will show the current UUID's of all partitions on the disk. I suspect you will see that the UUID of your swap partition now differs from the value in /etc/fstab.

  2. If it is different, run some text editor under sudo to edit /etc/fstab. Replace the value of the UUID with the current actual value as shown by the blkid command, above. Do not include the quotation marks.

  3. Save the file and reboot your system. Run free -m to make sure the change fixed the problem:

    $ free -m
                 total       used       free     shared    buffers     cached
    Mem:          1001        604        396          0        123        199
    -/+ buffers/cache:        281        719
    Swap:         1953          0       1953