Fix dpkg available file in Ubuntu

This note relates to Ubuntu Maverick Meerkat (10.10) but it might apply to other versions, as well.

I wrote this note after my system became unstable following a number of configuration shenanigans. What did not help is that I had just upgraded from 10.04 to 10.10. Therefore, I am not sure that I can explain how to get to the state my platform was in.

Symptom: Every time an apt-get command is run, some sort of error or warning is reported stating that an available package has a corrupt version number.

Cause: The ‘available’ file used by dpkg contains erroneous information or is corrupted.

Solution: Rebuild the ‘available’ file.

Recipe:

1. Back up current file

2. Delete current ‘available’ file

3. Rebuild ‘available’ file

After these steps, commands to ‘apt-get’ should no longer complain about available versions.

Re-install GNOME-Session in Ubuntu

This note was written while using Ubuntu 10.10. However, it might apply to other versions as well.

Symptoms: After a number of shenanigans involving configuration, I found myself unable to login to the desktop, in Ubuntu. The login screen (GDM) offered my user name. However, once my user name was selected, no session were offered. Entering my password and pressing the login button would show a brief blank screen and then return me to the login screen.

Cause: Somehow, the gnome-session was removed from installation.

Solution: Re-install gnome-session

Here is the recipe:

  1. At the login screen (GDM), press the key combination CTL-ALT-F1. This should drop you out of GDM and into a terminal screen
  2. Login to the terminal using your username and password
  3. At the prompt, enter the command “sudo apt-get install gnome-session”
  4. Then, “sudo reboot”

If the gnome-session was already installed and you get an error attempting to install it again (or the answer “gnome-session is already installed”), then reconfiguring it might suffice: “sudo dpkg-reconfigure gnome-session”

Quickly install most CODECs in Ubuntu 10.04

Installing restricted CODECs is easier in Ubuntu 10.04 than in previous versions.

References:

Installing CouchApp on Ubuntu 10.04

CouchApp is a python tool to help develop, upload and clone applications meant for couchDb. Those applications are also known as “couchApps”.

The following recipe is used to install couchapp on Ubuntu 10.04. To use couchapp, you probably first need to install “couchdb”, but this is readily available from the usual repositories.

The issue in installing couchapp on Ubuntu 10.04 is that one needs to rely on some personal packages made available via launchpad.net.

Warning: This recipe installs keys from developers on your platform. From this point on, your platform will trust packages made available from those individuals.

From a high level view, two packages are required:

  1. add-apt-repository: utility tool to easily add a new repository
  2. couchapp : the python tool itself
  3. python-restkit: a python library that couchapp is dependent on

Installing add-apt-repository

Installing python-restkit

Installing couchapp

Use a 24-hour clock in Ubuntu

This note applies to:

  • Ubuntu Lucid 10.04
  • Mozilla Thunderbird 3.0.8
  • Mozilla Lightning 1.0b1

References:

I am a fervent user of the 24-hour clock. However, when I install a new platform, I often accept the default locale of en_US.UTF8. In general, I do not mind this locale. However, applications such as Thunderbird use the locale to adjust the display of various elements, including time. It affects also plug-ins such as Lightning.

This note is a receipt that changes the default time display from 12-hour clock to 24-hour clock.

  1. Edit the default locale file
  2. Add the following line at the end of the default local file:
  3. Reboot the computer… (yeah, it is lame)

That’s it! From then on, applications that follow the locale will display the time in 24-hour clock format.

To verify that you successfully changed the locale, use the locale command:

The entry LC_TIME=en_DK.UTF-8 should be displayed.

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.

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: http://www.ubuntu.com/desktop/get-ubuntu/windows-installer

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.

Reference: http://ubuntuforums.org/showthread.php?t=261366

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?

Reference: http://ubuntuforums.org/showthread.php?t=1304772

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