Showing posts with label xconfig. Show all posts
Showing posts with label xconfig. Show all posts

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:

CONFIG_DM_CRYPT=m
CONFIG_MD=y

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.
CONFIG_ECRYPT_FS=y


Backgrounder about crypt on Ubuntu:

Saturday, August 22, 2009

Compiling and installing latest stable Linux kernel for Ubuntu

Just finished installing the latest stable Linux kernel 2.6.30.5 on my PC running Ubuntu. It was not a tedious experience at all as some had hinted earlier. Primarily, thanks to the instructions available at Ubuntu forum:

http://ubuntuforums.org/showthread.php?t=56835

The procedure mentioned there is compatible with 'deb'. Though I have used Linux for software development for some time now, I am still a newbie for hands-on administration. This was my first ever experience with building and installing the kernel.

Few optimizations I applied using 'make xconfig'
  • chose specific processor instead of the existing 'generic 686' and disabled SMP stuff (CONFIG_SMP not defined)
  • changed timer interrupt frequency from 250 to 1000 Hz (CONFIG_HZ_1000=y) for increased responsiveness
  • disabled support for lots of vendor hardware I knew I will never have: laptops, backlit display, touchscreen, etc.
  • opted out unwanted file systems
  • disabled lots of debug stuff--this one is not for meant for development
  • opted out ATM stuff from networking support. Yes, I know what I am doing! Left most of the rest unchanged. Don't have the patience for now to make sure... Perhaps I could have turned off routing, some rarely used QoS schedulers, etc. It's just a poor desktop PC.
Perceived improvements in experience
Kernel build time:
Removing unwanted stuff also saved compilation time by about an hour, that too, with 'nice -n 5 make make-kpkg ...'. Did not really want to simply watch the build happen. It allowed using the PC for normal daily usage. Without nice, even GDM failed to respond when I wanted to switch user :-).
Kernel image size:
3.4M vmlinuz-2.6.28-14-generic
7.3M initrd.img-2.6.28-14-generic
2.4M vmlinuz-2.6.30.5-custom
6.4M initrd.img-2.6.30.5-custom
(CONFIG_KERNEL_BZIP2=y)
Memory savings: (free -m)
12MB more user RAM available upon shell load
6M more buffered RAM available
Application performance:
OpenOffice Writer load time reduced by 1.25 seconds
Miscellaneous:
Bootup time reduction by 1.57s
Shutdown time reduction by 3.1s

Mouse, bash output and other UI interactions seem a bit more responsive.

Nothing is known to be broken while using the freshly compiled kernel, yet :-)

Plus, now I know what is running in the kernel for having created .config from scratch before kernel code compile. Happier :-)