Fix VirtualBox host-only network adapter after Linux upgrade

This note relates to:

  • virtualbox-3.2
  • Ubuntu 10.04
  • linux-2.6.32-24-generic

After upgrading the latest kernel, VirtualBox stopped working. More specifically, VirtualBox complained that a host-only adapter, previously available, had disappeared and, consequently, could not start the intended virtual machine that was dependent on it.

The root cause appears to be that the VirtualBox kernel modules needed to be re-generated. Nevertheless, here is the process to fix it:

  1. Reconfigure VirtualBox
  2. Reboot Ubuntu

In details:

After this, VirtualBox performs as expected.

Reinstall Grub2 after installing Windows

This note relates to:

  • grub2 version 1.98
  • Ubuntu 10.04
  • Windows 7

Reference: Ubuntu Guide

If you install (or re-install) Windows after you have been using Linux for a while, you might find out that the disk’s MBR (Master Boot Record) has been overwritten to point directly to Windows. This notes explains how to set up the MBR to point to the original grub.

Here are the general steps:

  1. Boot from Ubuntu Live CD
  2. Figure out which partition holds your GRUB boot
  3. Recover MBR
  4. Add new version of Windows to GRUB

Following are the steps in details.

Find your Ubuntu 10.04 Live CD and Boot from it

Self-explanatory. In theory, any live CD that uses Grub 2 should work.

Figure out boot partition

Using a partition editor, you can review the available partitions and remind yourself the name of the partition where the boot is located. On the Ubuntu Live CD, “gparted” is the command. It is available under the System > Administration menu.

You can add “gparted” in a Debian-based system with the following command:

Restore Master Boot Record (MBR)

Run the following commands, substituting with the correct partition names:

After this, remove Live CD, close tray and reboot. The original grub2 should load.

Add Windows to Grub2

Re-running the “update grub” should allow grub2 to discover Windows:

That should do it. Good luck.

How to force 32-bit installation via WUBI

This note relates to WUBI for Ubuntu 10.04.

Reference: Can I force Wubi to download and install a 32 bit version of Ubuntu?

On machines that feature a 64-bit processor and not much memory (less than 1GB), it might be beneficial to install a 32-bit version of Ubuntu as opposed to a 64-bit version. This reason is that the performance price in processing is probably less than the performance price in swapping due to restricted memory. 64-bit versions of kernels and applications tend to use more memory than their 32-bit counterparts.

WUBI detects the computer configuration and selects the most appropriate version of Ubuntu. On a machine equipped with a 64-bit processor, it generally elects to use a 64-bit version of Ubuntu.

To force WUBI to use a 32-bit version of Ubuntu, use the “–32bit” command line option. Instead of starting WUBI via its icon, open a command-line prompt and run:

Continue the remainder of the installation as usual.

Ubuntu inside Windows using WUBI

WUBI is an Ubuntu installer that enables a user to run Ubuntu without having to repartition a Windows disk. In my opinion, this is by far the best approach to allow users stuck in Windows land to try Ubuntu.

Get it here:

I have recommended WUBI to many in the past, and it has always been successful. Obviously, I am a fervent Ubuntu user. But, the push for Ubuntu, or any Linux distribution, is not so much for “infecting” the rest of the world. The main reason I bring it up is for development reasons. It is so much easier to install and configure development tools in Linux, that effort required in explaining the same steps in Windows is becoming impractical.

However, until WUBI came along, the dilemma was between explaining how to install development tools in Windows, or how to install a fresh OS alongside Windows. With WUBI, it is so easy to install Ubuntu “inside” Windows that the contest is trivial.

WUBI creates a large file within Windows and installs Ubuntu into it. Then, it tweaks the Windows boot manager to allow booting into Ubuntu. When Ubuntu is running, it “sees” the the special file has its hard disk. This process eliminates the need to repartition a hard drive, a specialised activity that can go wrong even for experts.

If, by any chance, a user wanted to remove WUBI from his/her system, an uninstaller is provided, which simply reclaims the space needed by the Ubuntu files. No messy removal, no repartitioning.

With Ubuntu 10.04 LTS, it seems that WUBI is now officially supported by Ubuntu. I do not know when that change came about, but it is a welcomed one. This means that users of WUBI can expect future seamless transitions to new versions of the OS.

If you have not tried Ubuntu yet and are running Windows, I recommend to take a little bit of time (an evening) and try WUBI.

Backup package configuration on Ubuntu

If your Ubuntu machine crashes, you can always restore it fairly quickly since Ubuntu is a breeze to install. If you backup your data, then you are cooking with gas. However, after years of installing various packages, it might take a while to remember them all.


The article referenced above shows how to save the list of all installed packages, as well as how to reinstall them all. The commands are shown below:

1. To get a list of all packages currently installed

2. To install all packages obtained by such a list

A comprehensive backup process should include that list as well as a copy of /etc

Karmic 9.10 Install Problems with SATA Drives

Middle of the night, trying to re-install Ubuntu on a crashed machine. Worse of luck.

Turns out, I am attempting to install Karmic 9.10 on a platform with a newly formatted SATA drive. Here are the symptoms:
1. Boot up using Desktop i386 Live CD
2. Select installing Ubuntu
3. Go through installer dialogs: language, time, keyboard. Those are fine
4. Select partition dialog fails to show any drives

Booting into live desktop and using GParted shows the drive just fine. So what is going on?


Turns out, there is interactions between dmraid and SATA drives. Quick solution:
1. Boot into live desktop
2. Start Synaptic Package Manager
3. Search for “dmraid”
4. Uninstall all “dmraid” related packages
5. Proceed with install

GWT apps using Maven and Eclipse

Used to be that getting a GWT project together using Maven and Eclipse was a tedious and frustrating task. Times have changed so that the process is quite a bit easier.

Eclipse 3.5
Google plugin for Eclipse 1.32
gwt-maven-plugin 1.2
Maven plugin for Eclipse 0.10.0

Install the Google plugin for Eclipse into eclipse specifying the update site url through Eclipse’s Help->Install New Software->Add… and specify the url

If you have a previous version of the m2 plugin you will need to uninstall it as the 0.10.0 version will not upgrade properly otherwise. Install the Maven plugin.

From Eclipse, create a new Maven project:
File->New->Other->Maven->Maven Project

Do not check Create a simple project as we want to do archetype selection, but fill the rest in as you see fit then click Next.

Select either Nexus Indexer or All Catalogs as the catalog, then scroll down the list looking for a Group Id of org.codehaus.mojo with an Artifact Id of gwt-maven-plugin and choose the highest version (1.2 at this time) then click Next.

Fill in your Group Id and your Artifact Id and the rest of the fields and click Finish.

The next set of the instructions are mostly from

In Eclipse, select your project then choose Project->Properties->Google->Web Toolkit and click Use Google Web Toolkit.

Then click on Web Application (Project->Properties->Google->Web Application and change the War Directory to src/main/webapp and uncheck Launch and deploy from this directory then click OK.

Open the pom.xml file under your project and check some Properties values. You want gwt-version to be 2.0.3 and maven.compiler.source and maven.compiler.source to be 1.6.

Right click on your project and select Run As->Maven Clean, then Run As->Maven Package.

Right-click your project and select Run As->Web Application. The first time you do this, you’ll have to select the location of the exploded WAR directory (by default it should be /target/).

If everything works out fine, you are now running in hosted mode. Click on the Development Mode view tab down where the Console tab is and copy and paste the URL shown there into a browser to see your app running.

GWT development/hosted mode is now running out of the WAR directory created by Maven. You can step through and debug your code as usual. If you make changes, it is sometimes possible to have your running application reflect those changes without restarting your debugging session:

  • If you change client-side code, just click Refresh in your browser.
  • To have server-side code changes reflected, your project’s build output path must be set to /target//WEB-INF/classes (Project properties > Java Build Path > Source > Default output folder). Then, when you change a server-side class click the Reload web server button in the Development Mode view.
  • If you change resource or configuration files in your WAR directory (HTML, JSP, CSS, etc.), you’ll have to terminate the launch configuration, run mvn clean package, and then launch again.

SysRq and Inspiron 1720

While trying to figure out while my laptop, a Dell Inspiron 1720, has been freezing occasionally, I found out that you can use SysRq codes to communicate directly with the Linux kernel to get system operations done even while the machine is locked up. This is handy as it allows you to specify a sequence of actions to safely sync your disks prior to rebooting your computer. Then you don’t have to go through the trouble of running fsck on your filesystems.

The typical sequence that you are told to input is to hold down Alt+SysRq and then slowly type r e i s u b. This presents a slight problem on the Inspiron 1720 since the SysRq key is shared with F11. Accessing the SysRq key requires pressing the Fn key but you must not have the Fn key depressed while you type the subsequent letters or they are interpreted as something different. I have found the easiest way to perform this magical little finger dance is to use your right hand to press the right Alt key with your thumb and the SysRq with a finger. So the sequence is:

Left hand: Press and hold “Fn” key (between Ctrl and the Windows key)
Right hand: Press and hold “Alt” + “SysRq” keys (Alt+F11)
Left hand: Release “Fn” key
Left hand: Press and release “r” key. (Screenshot dialogs may start popping up. Ignore them)
Left hand: Press and release “e” key. (Your GUI should collapse to a tty, most processes terminated)
Left hand: Press and release “i” key. (Progress of key shown in the tty, most proceses killed)
Left hand: Press and release “s” key. (Progress of key shown in the tty, syncs filesystems)
Left hand: Press and release “u” key. (Progress of key shown in the tty, unmounts filesystems)
Left hand: Press and release “b” key. (Progress of key shown in the tty, starts reboot)
Right hand: Release all keys

Fix hangs at 4 second intervals in Mozilla Firefox 3.5

This note relates to Mozilla Firefox 3.5.7 running on Ubuntu Karmic (9.10).

The problem is that Firefox appears to be freezing for a quick moment, every 4 to 5 seconds. This is annoying when editing text and watching a video on YouTube.

I came across this helpful post:

My approach to the fix is to give up on session restore, altogether. I do not like it, anyway. The post above might help you with tweaking better values if you wish to retain this feature.

1. Open firefox to this page: about:config
2. In the filter box, type: browser.sessionstore
3. Double click on “browser.sessionstore.interval” and enter a larger value of your choice (I used 100000, but the next step might make this irrelevant)
4. Double click on “browser.sessionstore.resume_from_crash”, resetting the value (i.e. make it “false”)

This fixed the annoying behaviour. I hope it works for you.

How to change the state of a gadget using a Google Wave Robot

If you have built a Google Wave Robot that interacts with a gadget, you have probably come to a number of frustrating dead ends. As of this writing, the ability for a robot to observe changes in the state of a gadget is easily determined using the Wave Robot API. However, the difficulty comes in attempting to have the robot change the state of the gadget.


Reading the library code for the Java Wave-Robot-API (, it becomes apparent that facilities available to a robot to perform changes on gadget states have a very coarse resolution. In that, I mean that there appears to be only the ability of changing a whole gadget state, not a single field.

When a robot receives a set of events from the Wave server, it has an opportunity to return a number of operations to be executed. This is the opportunity to modify content of the Wave. Techniques to observe the discussion between a Wave server and a robot are explained in another post.

When it comes to changing the content of the text, a robot can perform operation with fine resolution. This means that the operations deal with small changes. These operations are not likely to collide with operations of other users concurrently editing the same content, and if they do, the collision does not yield a large error. To understand better this phenomena, look at discussions on Operational Transforms, which are used internally by Wave to keep track of changes.

However, when it comes to managing elements (gadget are elements), there appears to be capabilities designed in the protocol to transform properties/fields of the element, however the library code is not making use of them. Therefore, at this time, it is unclear if these functions are available.

The problem is compounded by the fact that “whole-element” operations do not always work as expected. One such operation is “DOCUMENT_REPLACE_ELEMENT” which, according to the library code, should enable a robot to replace a gadget (or any element) with another copy. Using the facilities to replace an element fails and the Wave server returns an error.

This is an interesting side observation. Since the operations performed by a robot are returned as a reply to the incoming events, the Wave server contacts the robot again with incoming events containing the error. Currently, the Java Wave-Robot-API is not able to decode these events, so they show up in the logs as a critical error, where the following is observed:

If you see the above, it means that the Wave server was not able act upon a returned operation.

To come back to the whole replacement of an element, a robot must first perform a DOCUMENT_ELEMENT_DELETE operation, followed by a DOCUMENT_ELEMENT_INSERT operation. In Java, using the current Wave-Robot-API (published 2009-09-16), the following code would be needed:

What does this mean? Basically, if a robot and a user are attempting to use a gadget simultaneously, the changes that a robot makes will wipe out the changes from the user. Also, as the gadget is removed and added, there is a visual cue that this happened if the user is looking at the wave. This is far from an acceptable work-around.

Even when the bug above is fixed, the resolution of the changes will still be too coarse. The only long-term acceptable solution will be based on the DOCUMENT_ELEMENT_MODIFY_ATTRS operation, but it is not clear when this will happen.

Therefore, the really exciting Wave applications, where robots and gadgets interact to provide a truly immersed environment, will have to wait or suffer the visual glitches.