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.
  • I think I had an encrypted swap partition, because I chose to encrypt my home directory during the installation. I believe that's what the line with /dev/mapper/cryptswap1 ... in my /etc/fstab is all about.
  • I did something to bork my swap because on the next boot, I got a message (paraphrased):

    The disk drive for /dev/mapper/cryptswap1 is not ready yet or not present. Wait to continue. Press S to skip or M to manually recover.

    (As a side note, pressing S or M seemed to do nothing different from just waiting.)

  • Here's what I've tried:

    1. This tutorial on how to fix the swap partition not mounting. However, in the above, the mkswap command fails because the device is busy.
    2. So I booted from a live USB, ran GParted to reformat the swap partition (which showed up as an unknown fs type), and chrooted into the broken system to try that tutorial again. I also adjusted /etc/initramfs-tools/conf.d/resume and /etc/fstab to reflect the new UUID generated from formatting the partition as a swap. That still didn't work; instead of /dev/mapper/cryptswap1 not present, "The disk drive with UUID=[swap partition's UUID] is not ready yet or not present..."
    3. So I decided to start afresh as though I never had created a swap partition in the first place. From the Live USB, I deleted the swap partition altogether (which, again showed up in GParted as an unknown fs type), removed the swap and cryptswap entries in /etc/fstab as well as removed /etc/initramfs-tools/conf.d/resume and /etc/crypttab. At this point the main system shouldn't be considered broken because there is no swap partition and no instructions to mount one, right? I didn't get any errors during startup. I followed the same instructions to create and encrypt the swap partition, starting with creating a partition for the swap, though I think fdisk said a reboot was necessary to see changes.
  • I was confident the 3rd process above would work, but the problem yet persists.

  • Some relevant info (/dev/sda8 is the swap partition):

    • /etc/fstab file:

      # /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/sda6 during installation
      UUID=4c11e82c-5fe9-49d5-92d9-cdaa6865c991 /               ext4    errors=remount-ro 0       1
      # /boot was on /dev/sda5 during installation
      UUID=4031413e-e89f-49a9-b54c-e887286bb15e /boot           ext4    defaults        0       2
      # /home was on /dev/sda7 during installation
      UUID=d5bbfc6f-482a-464e-9f26-fd213230ae84 /home           ext4    defaults        0       2
      # swap was on /dev/sda8 during installation
      UUID=5da2c720-8787-4332-9317-7d96cf1e9b80 none            swap    sw              0       0
      /dev/mapper/cryptswap1 none swap sw 0 0
      
    • output of sudo mount:

      /dev/sda6 on / type ext4 (rw,errors=remount-ro)
      proc on /proc type proc (rw,noexec,nosuid,nodev)
      sysfs on /sys type sysfs (rw,noexec,nosuid,nodev)
      none on /sys/fs/fuse/connections type fusectl (rw)
      none on /sys/kernel/debug type debugfs (rw)
      none on /sys/kernel/security type securityfs (rw)
      udev on /dev type devtmpfs (rw,mode=0755)
      devpts on /dev/pts type devpts (rw,noexec,nosuid,gid=5,mode=0620)
      tmpfs on /run type tmpfs (rw,noexec,nosuid,size=10%,mode=0755)
      none on /run/lock type tmpfs (rw,noexec,nosuid,nodev,size=5242880)
      none on /run/shm type tmpfs (rw,nosuid,nodev)
      /dev/sda5 on /boot type ext4 (rw)
      /dev/sda7 on /home type ext4 (rw)
      /home/undisclosed/.Private on /home/undisclosed type ecryptfs (ecryptfs_check_dev_ruid,ecryptfs_cipher=aes,ecryptfs_key_bytes=16,ecryptfs_unlink_sigs,ecryptfs_sig=cbae1771abd34009,ecryptfs_fnek_sig=7cefe2f59aab8e58)
      gvfs-fuse-daemon on /home/undisclosed/.gvfs type fuse.gvfs-fuse-daemon (rw,nosuid,nodev,user=undisclosed)
      
    • output of sudo blkid (note that /dev/sda8 is missing):

      /dev/sda1: LABEL="SYSTEM" UUID="960490E80490CC9D" TYPE="ntfs" 
      /dev/sda2: UUID="D4043140043126C0" TYPE="ntfs" 
      /dev/sda3: LABEL="Shared" UUID="80F613E1F613D5EE" TYPE="ntfs" 
      /dev/sda5: UUID="4031413e-e89f-49a9-b54c-e887286bb15e" TYPE="ext4" 
      /dev/sda6: UUID="4c11e82c-5fe9-49d5-92d9-cdaa6865c991" TYPE="ext4" 
      /dev/sda7: UUID="d5bbfc6f-482a-464e-9f26-fd213230ae84" TYPE="ext4" 
      /dev/mapper/cryptswap1: UUID="41fa147a-3e2c-4e61-b29b-3f240fffbba0" TYPE="swap" 
      
    • output of sudo fdisk -l:

      Disk /dev/mapper/cryptswap1 doesn't contain a valid partition table
      
      Disk /dev/sda: 320.1 GB, 320072933376 bytes
      255 heads, 63 sectors/track, 38913 cylinders, total 625142448 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: 0xdec3fed2
      
         Device Boot      Start         End      Blocks   Id  System
      /dev/sda1   *        2048      409599      203776    7  HPFS/NTFS/exFAT
      /dev/sda2          409600   210135039   104862720    7  HPFS/NTFS/exFAT
      /dev/sda3       210135040   415422463   102643712    7  HPFS/NTFS/exFAT
      /dev/sda4       415424510   625141759   104858625    5  Extended
      /dev/sda5       415424512   415922175      248832   83  Linux
      /dev/sda6       415924224   515921919    49998848   83  Linux
      /dev/sda7       515923968   621389823    52732928   83  Linux
      /dev/sda8       621391872   625141759     1874944   82  Linux swap / Solaris
      
      Disk /dev/mapper/cryptswap1: 1919 MB, 1919942656 bytes
      255 heads, 63 sectors/track, 233 cylinders, total 3749888 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: 0xaf5321b5
      
    • /etc/initramfs-tools/conf.d/resume file:

      RESUME=UUID=5da2c720-8787-4332-9317-7d96cf1e9b80
      
    • /etc/crypttab file:

      cryptswap1 /dev/sda8 /dev/urandom swap,cipher=aes-cbc-essiv:sha256
      
    • output of sudo swapon -as:

      Filename                Type        Size    Used    Priority
      /dev/mapper/cryptswap1                  partition   1874940 0   -1
      
    • output of sudo free -m:

                   total       used       free     shared    buffers     cached
      Mem:          1476       1296        179          0         35        671
      -/+ buffers/cache:        590        886
      Swap:         1830          0       1830
      

So, how can this be fixed?

share|improve this question
add comment

2 Answers

Did you find a solution? I have the same problem.

By the way, your resume UUID and swap UUID do not mach, like mine. I tried matching them but the UUID of cryptswap1 keeps changing because the partition is randomly redone at boot.

Also, it's perfectly normal to have gparted see the swap as unknown, that's because it's an encrypted partition made with a random key, unrecoverable after reboot.

share|improve this answer
add comment

I had the same problem when using an encrypted swap partition. Neither the general Swap FAQ, Puny Geek's solution to the "cryptswap1 is not ready yet or not present" message nor Braiam's answer to this question solved the problem for me - sometimes the swap was available, sometimes it wasn't. After many reboots and some poking around, I think I have found the underlying reason:

The path to the swap partition like /dev/sda3 is sometimes different, e.g. /dev/sdb3. Since the file /etc/crypttab by default seems to identify the swap partition through this path, sometimes it would find it (if that partition happens to get the same path at boot) or not (if the partition gets a different path assigned at boot).

Seems like I wasn't the only one with that problem becasue as described here, a better solution would be to bind the swap partition through it's drive ID instead of its /dev/sd* path. This can be found by running

ls -l /dev/disk/by-id/

which lists the disk IDs for all partitions including the swap, which in my case was

ata-TOSHIBA_MQ01UBD100_73JATD5GT-part3 -> ../../sdb3

Double check in a program like Disk Utility that the -> ../../sdb* part of this line is indeed the partition you intend to use for swapping, as this (as I said before) can sometimes change names. As always, keep this in mind:

Caution: fiddling with cryptsetup and disk devices is dangerous for data and OS. I personally made a full backup on a separate disk and then umplugged it to be sure it wouldn’t be involved in any mishap.

Then edit your /etc/crypttab file by using the ID link instead of the "raw" path, in my case this line is

cryptswap1 /dev/disk/by-id/ata-TOSHIBA_MQ01UBD100_73JATD5GT-part3 /dev/urandom swap,cipher=aes-cbc-essiv:sha256

I think this method should be the default for new installations, as one apparently can never be sure of the /dev/sd* paths... which I find somewhat worrying as I have the feeling that there are way more scripts and software out there which still rely on these paths (instead of IDs, labels or UUIDs) to stay the same across reboots.

TODO:

I haven't checked if resuming out of hibernation still works with this setup, as this seems to rely on a UUID (which my swap partition didn't have), as stated on this page: https://altinukshini.wordpress.com/2012/10/15/devmappercryptswap1-is-not-ready-yet-or-not-present/

Update:

Hibernation seems to work fine so far. Hope this solves these problems for others as well!

share|improve this answer
add comment

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.