My Ubuntu 12 Upgrade

After 12.04 came out I watched the blogs and read a few in-depth reviews. All were positive, no big improvements that affected me, but it updates the repositories so you get newer versions of a few apps like LibreOffice 3.5.

Upgrade 1: Emma

I upgraded Emma's machine first. It's an old Dell D610, single core, 2 Ghz, 1.5 GB RAM with 60GB hard drive, no Grub or dual boot. It's a simple system so I like to use it first. The upgrade went smoothly and she likes the version 3.5 of Libre Office Writer. The upgrade preserved everything: her files, desktop, icons, custom settings, etc.

We have noticed some changes with Ubuntu 12:

  • Bluetooth: her BT dongle sometimes stops working after the machine comes up from sleep. I added RFKill commands to /etc/pm/sleep.d, but it didn't fix the problem. About half the time she has to unplug the dongle and plug it back in for her BT mouse to work.
  • Wireless: on Ubuntu 11, the built-in wireless would sometimes stop working. This has not happened with Ubuntu 12.
  • In short, wireless got better, BT got worse. But it all works fine.

    I figured it was worth upgrading my own machine, if only to get updated apps from the new repositories.

    Upgrade 2: Mike (aka Dad, that's me)

    I ran the upgrade from the Xubuntu desktop I always use. It ran smoothly, took an hour or two, no warnings or errors, then said it was done and ready to reboot. I clicked reboot. Little did I know what I was getting into...

    Upon boot, instead of the familiar Grub menu I had a black text screen saying:

    error: out of partition
    grub rescue>

    My second thought was, "This is not going to be fun." First thing I did was find something called boot repair. It is a very useful ISO you can burn to make a bootable CD that lets you do just about anything possible to rescue any linux system. It also has a simple GUI tool that fixes most systems. Unfortunately, it didn't fix mine. But it pushes your detailed system info to a public URL you can post at the Ubuntu Forums, which is visited by amazingly knowledgable and helpful people. I started this thread.

    False Fixes

    There is another bootable CD ISO image called GPartEd. It is also an essential tool for configuring linux systems, especially setting them up to boot multiple OSes. Henceforth I'll call boot repair "BR" and GPartEd "GP". I booted to BR, opened a cmd prompt and followed a manual procedure to remove Grub and install Grub 2 (1.99). I also booted to GP, fscked and mounted the partitions, saw all my data was still there. Then when I rebooted, Grub appeared and everything worked! I thought it was problem solved.

    At the time I had about 20 old kernels taking up a lot of space so from my Xubuntu desktop I used the Syaptic Package Manager to remove them. After doing that, my system wouldn't boot anymore. Same problem as before.

    I followed the manual Grub purge/reinstall process again: no fix.
    I moved the "sda6" partition boot flag to "sda1" where XP was installed: no fix.

    My ubuntu partition was "sda6", which was near the end of the 250GB disk. Maybe my old BIOS couldn't see that far into the disk. I tried the BR "out of disk / ATA disk" option, but it didn't fix the problem. It created a new error message on boot:

    error: no device connected
    error: no device connected
    error: no such device: 011cedd0-51f3-4460-b5ad-574e6583392d

    Lesson Learned: old computers like this one made in 2006 have old BIOS that can only address about 137GB of hard disc. My ubuntu 12 partition is near the end of the disk. Turns out it spans the 137GB boundary. That means some of the files are visible to the BIOS and some aren't. Which ones is virtually "random" depending on where the ext4 filesystem decided to write file blocks. Grub uses the BIOS to read/write disk, so it shares the BIOS limitations.

    Next I tried some Grub rescue prompt commands to test whether this was the problem. Since my linux partition was sda6, from the Grub rescue prompt I entered:
    ls (hd0,6)/
    ls (hd0,6)/boot
    ls (hd0,6)/boot/grub

    The latter 2 commands returned "error: out of partition". This told me this was indeed the problem: some of the critical boot files in my ubuntu partition were beyond the 137GB limit, making them invisible to the BIOS, and thus to Grub.

    Aha Experience: I now knew the root cause of this problem. My system had been working by accident for the past year. My ubuntu partition spanned the 137GB threshold of what the BIOS can see. When I set it up a year ago I got lucky and it just so happened that the critical boot files were put on the near side of the threshold. When I upgraded to Ubuntu 12, the filesystem reshuffled the internal file locations, and the new boot files ended up on the far side of the threshold. BIOS couldn't see them, so neither could Grub, thus it said "error: out of partition".

    Lesson Learned: a common kludge for this problem is to create a small "boot" partition that fits completely inside the first 137GB of the hard drive. Format this partition for ext4 and copy critical boot files to it. It turns out these files live in the "/boot" directory. Set up Grub to use these files. Set up the system to mount this partition into "/boot".

    I booted to GP and did the above steps. This involved:

  • Converting sda3, which was a 1GB swap partition already near the start of the disk, into an ext4 "boot" partition, and copying files from sda6/boot to it
  • Shrinking an existing NTFS partition by 1GB to make room for a new "swap" partition
  • Creating a new 1GB partition for "swap"
  • Updating /etc/fstab to mount the new "boot" and "swap" partitions
  • Re-running the manual process to remove Grub and re-install it with the new partition setup
  • After this, my system booted to the Grub menu, I picked Ubuntu 12, and it booted to the Ubuntu login screen!

    No Login for You!

    When I tried to log in, the screen flashed and it bounced me back to the login screen. This problem I figured out on my own.

    At first I figured the system didn't mount my drives, since my home directory is mounted on a separate partition. I booted to GP, mounted sda6, created a "/home" that was a real directory rather than a link, and copied a few key files from my home directory (on sda7), and set the user:group. I rebooted but this did not fix the problem. Still could not log in.

    Next, while at the ubuntu 12 login screen, I pressed "ctrl+alt+F1", which jumps to a text login screen. The key combos "ctrl+alt+Fn" jump to N different screens. The normal screen is "ctrl+alt+F7". From this text based login screen, the system let me log in. While logged in, I ensured all drives were mounted, "fstab" was set up right. Then I ran "update-grub". After that I rebooted.

    From that point forward, my system was fixed.

    Conclusions & Lessons Learned

  • Old computers have BIOS using the ATA spec, which supports at most 64k cylinders, 16 heads, 255 sectors per track. With 512 byte blocks that makes 137GB.
  • This was not a linux problem, it was caused by the partitioning exceeding the limits of BIOS.
  • When you set up partitions to run multiple OS on a single computer, put all boot partitions (anything you need the BIOS to see) up front.
  • Ubuntu has a truly amazing community. The help I received was priceless.