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:


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:

Saturday, September 3, 2011

Firmware upgrade failed Android phone Samsung Galaxy Fit GT-S5670 (2.2.1 -> 2.3.x)

I was excited today when Samsung Kies offered firmware upgrade for my Android phone Samsung Galaxy Fit GT-S5670. This happened many months after buying the phone and similar upgrades were reportedly being offered in Europe since May 2011. Too bad, after following all the instructions, having new firmware downloaded for about half an hour and 'driver installed' message, this idiot Kies declares that upgrade failed. The phone had yellow logo depicting a worker with spade and written underneath 'Downloading...'. What a disappointment.

I tried upgrading on another Windows PC that does not have similar paranoid security software that may have prevented previous attempt. Kies does not offer the upgrade anymore :-(

The only positive aspect is that 'Emergency firmware restore' worked and my phone is restored to the last known working version. All data and apps intact.

Anyone else out there who experienced similar?

Saturday, August 20, 2011

DNS caching Linux for faster Internet access

If you are familiar with what is a DNS, please skip to next paragraph. Internet protocol enabled network interface on your computer typically receives its IP address and related parameters when the computer starts and enables this interface. When one refers Web sites by name, like in their browser software, that name (technically called domain name) is translated into a numeric address. That address is then used by browser to reach the desired Web site. This process of converting human readable name of a site into numeric address is served by another computer that can be reached over network connected to your computer. Such remote computer is called domain name server (DNS). It is assigned to you by your Internet service provider. You can even override that and choose the ones like Google public DNS.

So each such name lookup takes finite time for the request to travel to the name server and back, plus the time taken by the server for lookup. Typically these name-to-address mappings do not change rapidly over time. One can harness this fact to their advantage by saving the results of name lookups locally on their computer. This is called DNS caching.

djbdns, the DNS cache software
This site provides details on how to setup:

Some vital but missing points in the How-To instructions
  1. NetworkManager on Ubuntu was found diligently adding nameserver entries in /etc/resolv.conf as assigned by my router each time the network interface was brought up. This nullified the advantage of having a local cache and queries were anyways sent to the external name server over and over. So I set the DHCP settings to obtain only IP address from my router, sans the DNS address, as shown below:
    DHCP settings for network interface
  2. Now how do I know whether DNS cache is indeed being used for name resolution and how fast are subsequent/ repeat requests served by this cache? So there's this utility called dig (domain information groper). Here's sample output:

    $ dig  (first query)

    ; <<>> DiG 9.7.3 <<>>
    ;; global options: +cmd
    ;; Got answer:
    ;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 41195
    ;; flags: qr rd ra; QUERY: 1, ANSWER: 5, AUTHORITY: 0, ADDITIONAL: 0

    ;            IN    A

    ;; ANSWER SECTION:        300    IN    A        300    IN    A        300    IN    A        300    IN    A        300    IN    A

    ;; Query time: 301 msec
    ;; SERVER:
    ;; WHEN: Sat Aug 20 01:49:04 2011
    ;; MSG SIZE  rcvd: 108

    $ dig
      (second query)

    ;; Query time: 0 msec
    ;; SERVER:

    ;; WHEN: Sat Aug 20 01:49:08 2011
    ;; MSG SIZE  rcvd: 108

    $ dig
      (first query)

    ; <<>> DiG 9.7.3 <<>>
    ;; global options: +cmd
    ;; Got answer:
    ;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 38836
    ;; flags: qr rd ra; QUERY: 1, ANSWER: 5, AUTHORITY: 0, ADDITIONAL: 0

    ;            IN    A

    ;; ANSWER SECTION:        300    IN    A        300    IN    A        300    IN    A        300    IN    A        300    IN    A

    ;; Query time: 1713 msec
    ;; SERVER:

    ;; WHEN: Sat Aug 20 01:49:15 2011
    ;; MSG SIZE  rcvd: 110

    $ dig
      (second query)

    ;; Query time: 1 msec
    ;; SERVER:

    ;; WHEN: Sat Aug 20 01:49:18 2011
    ;; MSG SIZE  rcvd: 110

Saturday, June 4, 2011

My first Android phone experience!

So I'm a 3G enabled smartphone user even before I had thought  I would be. Following have happened:
  • the week immediately following the purchase, I went on road trip. Google Maps was tremendously useful navigating through unfamiliar crowded city roads leading to highways. We never had to stop once to ask for directions. Isn't that nice? For me, that alone recovered my investment in the phone :-). Too bad, Google Maps does not have navigation with voice prompt enabled for the country I live/ travel within.
  • used My Tracks app for the driving trip as well as on-feet trips to the nearby markets. My Tracks seems to have some bug while handling GPS data collected over 10 hours of continuous usage. After initial correct tracking for five hours or so, it started showing incorrect track of the path already traveled by road. I did not investigate enough whether it was error in the recording of data in CSV format or presentation of it when volumes are high. The market description claims that it is still an app under development. So I am expecting reliability improvements there.
  • was pleasantly surprised to get 3G coverage throughout the journey, including remote highway side locations
  • successfully worked remotely using 3G tethered as WiFi from my phone to the PC. Even attended remote presentations having slides and audio/ video. Ability of WiFi tethering was one of the main reason why I got my Android 2.2 phone.
  • as expected, got my shock of the first bill after having accessed data extensively over 3G. It was not a very rude shock, though as I was watchful of the usage. Thanks to wonderful apps like 3G Watchdog and APNdroid. Use WiFi wherever available instead of 3G HSPA or GPRS access. I was trying to be under the special data limits the operator had promised for a new 3G sign-up. The service provider has attributed the high bill amount to my voice calls, though. Need to sort that out.
  • I capture more personal moments with the camera handily available in the phone. Also, with that camera, now I scan documents readily that I would have stashed away for weekend chores. Can share with people right away. Like immediately following up on a correspondence received by ordinary post.
  • I impressed my colleagues with the things my phone can do with Google Goggles.
  • For some bragging: there are some people I know who have been using Android phones for close to an year now and still did not know of all the standard applications that make Android such a compelling platform. Now they know and have installed those apps :-)
  • My Android phone experience prompted many others to consider it favorably and they bought it. That's how Android has been successful and such a hit in short time. Google must have envisioned it earlier on the drawing boards.
  • There are so many useful apps at Android Market and so many of them free of cost. As a thank-you gesture, I translated 3G Watchdog app in two other languages. It is updated at the market with my humble contributions.
Thank you Google for making Android such a great experience:
  • for the robust, Linux based open source operating system and a great, extensible platform that makes my phone smart!
  • compelling, trustworthy applications readily available for free from the Google house itself. I searched for installed almost all of them from Google Inc.

Sunday, May 1, 2011

Samsung Galaxy Fit - WiFi issue (solved)

After a few days of using my new Android based phone, I noticed that WiFi would not turn on. It appeared occurring randomly. And the only way to get it to work was power off the phone and turn it back on. Going into flight mode (turn off all radios) and back did not help. Careful observation suggests that it has to with reclaiming the RAM using the following sequence of steps:
Task Manager -> RAM tab -> Clear memory button

The phone warns about gracefully closing applications before doing that. However I did not think it would affect WiFi, like it never affected the ability to connect to 3G or make a voice call. This may be an implementation issue in the Samsung phone I use. After I stopped clearing the used memory, the issue has not recurred.

Before coming up with this observation I also reported the issue to Samsung tech support on phone. As expected, initially the tech support started doubting trivial things without even completely understanding my issue. They promised to get back and I'm yet to hear (4 days and counting)...

What prompted a PalmPilot guy get an Android phone?

I have been an enthusiastic adopter of digital devices starting with a Casio digital diary since back in 1995. Today I have an Android based smart phone. In between, I used two different Palm Pilot devices. The first one was the original US Robotics made PDA, PalmPilot, bought in 1997 and the second was Palm Zire, bought in 2004. This is a personal perspective from my, a user's, point of view.

The Evolution

For the functionality they offered back then, though at a price that seems unreasonable today, I had liked those early devices and benefited from their use. Remarkably, all those devices have been in good working condition even today. It is only the additional functionality of newer devices that prompted an upgrade to new ones.

Durability speed; but rigidity
I have hard time accepting the fact that the early gadgets had such limited and fixed functionality. The Casio digital diary would offer mere personal information management: an address book, notepad, searching through those and miscellaneous utilities like a simple arithmetic calculator. For marginally improved functionality of existing utilities, one would have to buy different, higher-end device. No customization whatsoever. Today, a smart phone user retains the hardware and simply upgrades the software application.

PC Sync; but multiplicity
After being used to seeing 1GHz processors, double-digit GB RAM for portable devices these days, I was shocked to get my memory refreshed by the specifications and price of the PalmPilot device! Check out the wiki!

I still have the same master contact list I had entered over years in PalmPilot since 1997. Each time I had used the PDA to lookup a phone number and then dial it manually on a landline phone, I had wished that I could simply tap the phone number to call right from the PDA... or could compose and send an e-mail to the contact. I waited till year 2011 to avail that functionality! Technical capability was available for many years; just that I never found it compelling to pay the extra price--until affordable Android phones were available with high speed 3G data access. Being able to access the same data from a PC and then back it up was a big plus over Casio diary.

Though I had to carry two portable devices all the time: the PDA and the mobile phone for many years, I am glad I postponed getting a smart phone. Following factors played role in considering an Android device:
  • need for backup Internet access for PC
  • introduction of 3G by mobile service provider and offering limited data usage under my existing voice plan
  • my list of features in an ideal mobile phone (developed over years of mobile usage)
  • long pending need to integrate a PDA and a mobile device
  • need for a navigation device during travels
  • experience of using an iPod Touch and multiple limitations imposed by Apple App Store versus what I have gathered about the open Android market
  • experience of using Symbian, Windows and Linux operating systems as a software developer to appreciate their differences and individual strong points
  • enjoying benefits for using custom Linux kernel for PC and a hope to do similar with a mobile phone
  • infinite potential for developing own apps for my phone: self help!
  • arrival of multiple new and reasonably priced devices that made a compelling sense
Android (device): highly integrated, extensible, secured
Choosing a specific phone was rather simpler than I thought. I knew what I was looking for and what was unnecessary. Like mobile gaming was out of my typical use pattern. I chose the right priced phone from a reliable vendor: Samsung Galaxy Fit GT-S5670!

More about my first experience with Android in later posts....