LinuxQuestions.org
Download your favorite Linux distribution at LQ ISO.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - General
User Name
Password
Linux - General This Linux forum is for general Linux questions and discussion.
If it is Linux Related and doesn't seem to fit in any other forum then this is the place.

Notices


Reply
  Search this Thread
Old 11-08-2016, 02:32 AM   #1
Turbocapitalist
LQ Guru
 
Registered: Apr 2005
Distribution: Linux Mint, Devuan, OpenBSD
Posts: 7,289
Blog Entries: 3

Rep: Reputation: 3718Reputation: 3718Reputation: 3718Reputation: 3718Reputation: 3718Reputation: 3718Reputation: 3718Reputation: 3718Reputation: 3718Reputation: 3718Reputation: 3718
Creating encrypted swap on Ubuntu 14.04 LTS


I've tried to rearrange swap partitions on Ubuntu 14.04 LTS. Ostensibly I have created two separate encrypted swap partitions. However, they do not survive either hibernation or rebooting. I see that the required devices have disappeared:

Code:
$ sudo swapon -a
swapon: /dev/mapper/cryptswap1: stat failed: No such file or directory
swapon: /dev/mapper/cryptswap2: stat failed: No such file or directory
I can create them manually, but again they don't even survive hibernation, which is where I really need them. What should I be looking at to make the repair?

I've entries for swap in /etc/fstab by UUID or device name, but neither take.

I've entries in /etc/cryptab which refer to the right UUIDs:

Code:
cryptswap1 UUID=72292bd6-d8b8-4952-af17-b2c2af23284e /dev/urandom swap,cipher=aes-cbc-essiv:sha256
cryptswap2 UUID=cd9189b5-e44b-40a2-8d94-9a8d03326da3 /dev/urandom swap,cipher=aes-cbc-essiv:sha256
It seems that the system is not making the devices /dev/mapper/cryptswap1 and /dev/mapper/cryptswap2
 
Old 11-08-2016, 03:37 AM   #2
cepheus11
Member
 
Registered: Nov 2010
Location: Germany
Distribution: Gentoo
Posts: 286

Rep: Reputation: 91
What is the output of

Code:
blkid
?
 
Old 11-08-2016, 03:42 AM   #3
Turbocapitalist
LQ Guru
 
Registered: Apr 2005
Distribution: Linux Mint, Devuan, OpenBSD
Posts: 7,289

Original Poster
Blog Entries: 3

Rep: Reputation: 3718Reputation: 3718Reputation: 3718Reputation: 3718Reputation: 3718Reputation: 3718Reputation: 3718Reputation: 3718Reputation: 3718Reputation: 3718Reputation: 3718
The swap partitions, /dev/sda2 and /dev/sdb2, are not found apparently:

Code:
$ sudo blkid
/dev/sda1: UUID="1ed37aeb-20fe-10ed-f0a3-14554e7b37cc" UUID_SUB="f5f62732-59bf-0fa9-6fd0-ed63da2d3a22" LABEL="gazelle9:0" TYPE="linux_raid_member" 
/dev/sda3: UUID="2b8b9b55-a9c6-4427-9bd2-52a67dd649c6" UUID_SUB="674aa4f5-0ca8-48cf-aa3b-19884c565cf1" LABEL="gazp9:129" TYPE="linux_raid_member" 
/dev/sdb1: UUID="1ed37aeb-20fe-10ed-f0a3-14554e7b37cc" UUID_SUB="c2ffc9f1-1564-3b24-19ad-9a2a7ddf11d1" LABEL="gazelle9:0" TYPE="linux_raid_member" 
/dev/sdb3: UUID="2b8b9b55-a9c6-4427-9bd2-52a67dd649c6" UUID_SUB="805ef6cc-15bd-e61e-1c3d-a97bc9455065" LABEL="gazp9:129" TYPE="linux_raid_member" 
/dev/md0: UUID="427c17e1-3d02-4a3f-9730-4ed54992bddd" TYPE="ext4" 
/dev/md129: UUID="5e8a9dc2-35b3-429c-90f0-3250d9eb63b8" TYPE="ext4"
 
Old 11-08-2016, 04:35 AM   #4
cepheus11
Member
 
Registered: Nov 2010
Location: Germany
Distribution: Gentoo
Posts: 286

Rep: Reputation: 91
Quote:
Originally Posted by Turbocapitalist View Post
The swap partitions, /dev/sda2 and /dev/sdb2, are not found apparently:
Well, I did not expect them to have a UUID, because UUID is a filesystem property and swap filesystems get created at every reboot after the encryption is set up. But I did expect the partitions to appear in the blkid output and to have a PARTUUID. I don't know why they are not there. Can you see them in (g)parted or another partition manager?
 
Old 11-08-2016, 04:37 AM   #5
Turbocapitalist
LQ Guru
 
Registered: Apr 2005
Distribution: Linux Mint, Devuan, OpenBSD
Posts: 7,289

Original Poster
Blog Entries: 3

Rep: Reputation: 3718Reputation: 3718Reputation: 3718Reputation: 3718Reputation: 3718Reputation: 3718Reputation: 3718Reputation: 3718Reputation: 3718Reputation: 3718Reputation: 3718
Yes, they are both listed as "unkown". I can reformat them as swap, start swapping manually but they don't last through the first reboot or hibernation.
 
Old 11-08-2016, 04:31 PM   #6
syg00
LQ Veteran
 
Registered: Aug 2003
Location: Australia
Distribution: Lots ...
Posts: 21,119

Rep: Reputation: 4120Reputation: 4120Reputation: 4120Reputation: 4120Reputation: 4120Reputation: 4120Reputation: 4120Reputation: 4120Reputation: 4120Reputation: 4120Reputation: 4120
caveat: non_Ubuntu, non encrypted swap user.

Sounds like a train wreck looking for a place to happen.
If you want persistence across restarts (i.e. hibernation) why are you using a random key ?.
If you want luks containers re-opened on startup, you'll need the appropriate hooks in your initrd/initramfs - and in the correct order. For separate swap partitions you might need a custom hook as crypttab might not be available at resume.
What does your grub resume parameter(s) look like ?.

(use "lsblk -f" rather than blkid)
 
Old 11-08-2016, 09:57 PM   #7
Turbocapitalist
LQ Guru
 
Registered: Apr 2005
Distribution: Linux Mint, Devuan, OpenBSD
Posts: 7,289

Original Poster
Blog Entries: 3

Rep: Reputation: 3718Reputation: 3718Reputation: 3718Reputation: 3718Reputation: 3718Reputation: 3718Reputation: 3718Reputation: 3718Reputation: 3718Reputation: 3718Reputation: 3718
Quote:
Originally Posted by syg00 View Post
caveat: non_Ubuntu, non encrypted swap user.

Sounds like a train wreck looking for a place to happen.
If you want persistence across restarts (i.e. hibernation) why are you using a random key ?.
If you want luks containers re-opened on startup, you'll need the appropriate hooks in your initrd/initramfs - and in the correct order. For separate swap partitions you might need a custom hook as crypttab might not be available at resume.
What does your grub resume parameter(s) look like ?.

(use "lsblk -f" rather than blkid)
No. I do not want the contents of swap to persist across reboots. I want the existence of the swap partitions so that the machine may hibernate and wake normally.

The devices seem to disappear some time during either the reboot or, worse, during what should be a normal sleep / wake cycle. Currently, when I close the lid, it gives all appearances of going into hibernation but then when I open the lid, it powercycles itself. Either way, the swap devices themselves are missing from /dev/mapper/

Edit: See the output from swapon -a shown in the earlier post.

Last edited by Turbocapitalist; 11-09-2016 at 03:36 AM.
 
  


Reply

Tags
encrypted swap


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
LXer: Canonical Patches OpenSSL Regression in Ubuntu 16.04 LTS, 14.04 LTS and 12.04 LTS LXer Syndicated Linux News 0 09-27-2016 12:32 PM
LXer: Canonical Releases Snapcraft 2.17 Tool for Creating Snaps on Ubuntu 16.04 LTS LXer Syndicated Linux News 0 09-16-2016 10:32 PM
LXer: Ubuntu 12.04.5 LTS (Precise Pangolin) Released with Linux Kernel from Ubuntu 14.04 LTS LXer Syndicated Linux News 0 08-08-2014 08:00 AM
[SOLVED] [Ubuntu] Help on creating Swap Ramesh922 Linux - Newbie 13 12-10-2010 02:47 PM
Need Help Increasing Swap by creating a swap file froggo Red Hat 3 06-13-2006 08:04 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - General

All times are GMT -5. The time now is 12:23 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration