Thursday, July 26, 2012

Recover non-responsive frozen Unity desktop GUI

Apparently the new Unity based desktop environment introduced in Ubuntu 12.04 has some stability issues to sort out. Once in a while, the GUI becomes non-responsive. Mouse pointer is alive, so is the keyboard CAPS lock kind of keys that give LED indications. Just that nothing happens on the UI. It's frozen. So, what do you do? Kind of obvious for some, but still...

  1. Login to a text-only terminal by pressing Ctrl+Alt+F1 (or F2..F6). This is assuming the keyboard is still responding.
  2. Run top at command prompt. You will see all your application programs running happily in the status shown. You need to kill compiz. That's the name of the program for Unity shell.
  3. Press 'k'. Enter PID for compiz. Press Enter. And then Enter again for the second time to accept the default kill signal [15] to send to compiz. That's it! You can logoff from terminal.
  4. Get back to X-Windows GUI by pressing Ctrl+Alt+F7. You shall see the GUI applications again. In a few seconds, the system will revive compiz and you shall see the Unity UI consisting of the app launch bar, the Dash, etc.

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: