Swap Space Not Activated On Boot

sktsee sktseer at gmail.com
Wed Sep 3 16:04:57 UTC 2014


On Wed, 03 Sep 2014 08:38:05 -0700, NoOp wrote:

> On 09/03/2014 06:57 AM, sktsee wrote:
>> On Tue, 02 Sep 2014 19:17:24 -0700, NoOp wrote:
>> 
>>> On 09/02/2014 04:46 PM, sktsee wrote:
>>>> On Sun, 31 Aug 2014 13:26:18 -0700, maihoaomv wrote:
>>>> 
>>>>> i installed  linux mint 17 xfce a month or so ago on my laptop. i
>>>>> encrypted my home folder at installation but cryptswap wouldn't work
>>>>> at the time. with some help from the linux mint  forum i managed to
>>>>> get swap to work (most of the time). the problem i'm having now is
>>>>> cryptswap doesn't always start at boot time. it worked most of the
>>>>> time at first but over time it's gotten to where it almost never
>>>>> starts. i have to manually start it with sudo swapon -a.
>>>>> 
>>>>> hopefully someone can show me what i'm doing wrong and help with
>>>>> solve this problem.
>>>>> thanks
>>>> 
>>>> [snip]
>>>> 
>>>> Edit the cryptswap1 entry in /etc/crypttab to identify the swap
>>>> device by its device path (/dev/sda2), or by its disk by-id path
>>>> (example: /dev/disk/by-id/ata-HDMANUFACTURER-MODEL-SERIALNUM-part2).
>>>> If you have multiple hard disks attached to your system then use disk
>>>> by-id.
>>>> So your crypttab should contain a line like this:
>>>> 
>>>> cryptswap1   /dev/sda2    /dev/urandom
>>>> swap,cipher=aes-cbc-essiv:sha256
>>>> 
>>>> 
>>> Read the bug reports that I posted to earlier...
>> 
>> I presume you're referring to this post? http://news.gmane.org/find-
>> root.php?message_id=lp2a1q%249h%241%40ger.gmane.org
>> 
>> If so, the first bug report highlights the problems with using UUID's
>> to identify the swap device in /etc/crypttab and using the device path
>> if you have multiple disks attached to your system. This is why I
>> suggested to OP to use disk by-id as a source device. This is
>> recommended by the cryptsetup FAQ.
>> 
>> As to the second bug report, that's just race condition brought about
>> because of the interplay between the mountall and cryptdisks* jobs. I
>> see that error too, but once the system finishes booting I have an
>> encrypted swap present. And so far, its been persistent across boots.
>> 
>> 
> Sorry... specifically:
> <https://bugs.launchpad.net/ubuntu/+source/cryptsetup/+bug/1153661/
comments/19>
> "Unfortunately, replacing UUID's by /dev/xxxx will not work if you boot
> from USB. Example: I boot external usb drives and usb sticks for testing
> etc. If I boot with one plugged in, the /dev/sdxx will change. See
>  #953875 comments 10 & 11:
> 
> <https://bugs.launchpad.net/ubuntu/+source/ecryptfs-utils/+bug/953875/
comments/10>
> <https://bugs.launchpad.net/ubuntu/+source/ecryptfs-utils/+bug/953875/
comments/11>"
> 
> Just having bootable usb drives connected can/will change the /dev/sdX
> and so I've not been able to find a method to reliably mount encrypted
> swap in this situation.


Yes, as I've mentioned twice now, you should use specify disk by-id as 
the source device in /etc/crypttab if you have multiple hard drives 
attached to your system to avoid the issue with device path changes on 
boot. AFAICT, no one in the bug reports used disk by-id, they just used a 
UUID or the device path (/dev/sdx).

-- 
sktsee





More information about the ubuntu-users mailing list