Friday, July 13, 2012

Got swap partition back - Ubuntu 12.04 custom kernel

I am making efforts to save time for others, and to show how not to name symbols, how not to miss information required for kernel config help, and broken sanity checks.

Many days after I started using custom built kernel with Ubuntu 12.04 LTS, I noticed that the swap partition was missing. During a busy session involving Google Chrome, the biggest memory hog of all apps I use, VirtualBox, LibreOffice, etc., the system was thrashing non-stop. I had to power off the PC to gain any control! The swap was present with the stock kernel. So, the obvious candidate was tried: update-initramfs. No change.

Inspection of fstab config revealed that cryptswap is being used now! So far, I did not have any of the related settings in my custom config. Worse, there was no hint while wading through the config to let me know of this change and the needful config setting. That is the real culprit!

$ cat /etc/fstab...
# swap was on /dev/sdaX during installation
#UUID=xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxx none  swap  sw  0  0
/dev/mapper/cryptswap1 none swap sw 0 0

$ cat /etc/crypttab 
cryptswap1 /dev/sdaX /dev/urandom swap,cipher=aes-cbc-xxx...
$ file  /dev/mapper/cryptswap1 
/dev/mapper/cryptswap1: symbolic link to `../dm-0'

These config flags are hidden under apparently unrelated sub-part "Multiple device driver support (RAID and LVM)" under Drivers config:


These flags cannot be searched under xconfig. You will have to enable "Device mapper support" and only then they appear in search. Due to bad inter-dependent code, the compilation fails on usage of debug output function/ macros; so you will have to also enable "RAID support". For brevity I have not listed config settings that get enabled due to that.

Encrypted file system config is (still!?) under experimental. I learned that earlier, similarly the hard way. It will be nice if these changes are available on the Ubuntu wiki that lists instructions for building custom kernels using Ubuntu released kernel code.

Backgrounder about crypt on Ubuntu:

No comments:

Post a Comment