Wednesday, August 1, 2007

Upgrading Ubuntu

Upgrading Ubuntu between major versions is a game. Your machine was running smoothly before you ran update-manager and plunged into a massive set of repository changes and software upgrades, so clearly, your machine is also capable of running the next major version of Ubuntu. The game is when something breaks during the transition. It's randomized to make it more of a challenge, so you can't just look up a walkthrough on the Ubuntu forums or Gamefaqs. Somewhere, a config file was mangled, or the flags on a low-level program changed and a caller failed to compensate for the new configuration. Now, Edgy is counting on you to use your command-line skills to track down the culprit and make him pay.

New installations from a CD are a breeze these days (as of Breezy...), assuming you've already tried the live CD on your system and it seemed to work. Before Dapper Drake, nobody (meaning, not myself) expected dist-upgrade to work without a hitch. Ubuntu was a fresh new operating system, cranking out new major versions every 6 months or so, and if you're into trying out new OSes, you've probably quickly learned, the hard way or the easy way, to use a fresh CD if you need your computer up and running again today. If the game of fixing a broken system is too frustrating, your live CD will save you: Death from above to the existing installation, and reinstall from scratch. If you have a separate /home partition, you're in good shape. If you need to rescue some files before the great annhilation, the live CD helps you there, too.

But as of Dapper Drake, the game is winnable for most users. Since Dapper is designed for long-term support, update-manager normally doesn't offer the option to do a dist-upgrade through the GUI. As I recall, dist-upgrade didn't really work either in October 2006 when Edgy was released, either. Dapper took 7 1/2 months to finish instead of the usual 6, and Canonical compensated by pulling together Edgy in 4 1/2 months. So, there was some revolting hack posted on the Ubuntu wiki for getting 'er done. Perform the listed incantations, and you end up with a system that should be pure Edgy, but in practice dies horribly. For me and others, X died, and the command-line interface mostly died, too. There was a prompt with strange terminal font rendering, and the shift key had inscrutable behavior, so if your password involved that advanced functionality... well, shoot. I think I used the recovery mode and ran variations on apt-get to finish the upgrade and get Ubuntu back on its feet again.

I've been involved in two Dapper-to-Feisty upgrades this week, and the game is prettier to look at now. Better graphics, flashier bad guys, improved gaming experience overall. On my veteran P3 desktop, a handcrafted relic from the 20th century, I rediscovered the power cord and brought it back into service. Yep, still a computer. Standard Ubuntu Dapper. Before getting my current Toshiba POS vintage 2001 laptop, I used this box for trying out exciting new Linux distros, and had kind of a stormy relationship with Synaptic. Some things are installed that shouldn't be, in strange ways, with hand-mangled config files. Sounds like a good candidate for the newly streamlined Dapper-to-Edgy upgrade process:

sudo gdsu "update-manager -c"

This launches update-manager with a graphical prompt for superuser privileges, and tells it to check for distro upgrades. Type a password, click the shiny buttons, let chill for 2 hours before rebooting.

On ye olde Pentium the Third, it worked pretty well. Some packages were broken, but X launched and Gnome loaded -- with a couple of angry message boxes letting me know that gnome-panel was disgruntled. Helpfully, Bug Buddy popped right up to tell me that it couldn't do anything useful for me or the developers, and allowed me to close it. The Gnome panel then restarted and crashed again, launching another tragic Bug Buddy, ad infinitum. At first I was fooled into thinking Bug Buddy was a modal dialog on top of all of Gnome, locking me out from doing anything else, but in fact it was just the panel that was broken, and Bug Buddy could safely be ignored. The desktop and other applications still worked.

Having failed to set a memorable key binding for xterm, and lacking the initiative to look up the built-in way to do it (didn't know about Ctrl-Alt-F2 and virtual terminals yet), I cobbled together a desktop icon to launch xterm, and used that to run update-manager:

sudo update-manager

This works in Edgy because here, update-manager checks for distro upgrades be default. If I understand correctly. Anyway, it worked, I followed the graphical upgrade sequence again to end up with a fully functioning Feisty Fawn, and I didn't even have to get Edgy working properly. Most of the relevant configuration files get updated in the upgrade process, so whatever had previously been mangled was corrected in the wonderfully silky-smooth Feisty upgrade process.

Back in 10/2006, I recounted my upgrade woes to my sister, probably finishing the story with "it wasn't really that bad," and she opted to stick with Dapper until a better upgrade path came along. Well, that path came along. She was dismayed to find that you can't go straight from Dapper to Feisty, but decided that Feisty was worth it. The specific motivation: Her laptop (newer than either of my machines) uses certain lame components that don't have particularly good driver support in Dapper, and she believes her wireless and ethernet connections will behave better in Feisty.

I wasn't there for the prologue, but we teamed up for the big game this morning. This time, it really wasn't that bad at all. Gnome came up correctly, and since the only program we need access to in Edgy is update-manager, that was the immediate next step.

The GUI option to upgrade to Feisty didn't come up. Strange. Something's wrong. On updating the archive list, we saw a stream of errors connecting to the repositories -- OK, now we know what the game is. The Internet died. More specifically, since this is a wired connection and she doesn't use NetworkManager, the mangled config file is /etc/network/interfaces.

For newer Ubuntu users, this is how you find out what happened to your internet access:
1. If you're using wireless, type iwconfig to see what wireless devices are active. Or, type ifconfig to see what all your networking devices are doing.
2. If you see warning messages, pay attention. If you see just a list of devices and no sign of activity, and you're not using NetworkManager, the file, your network interfaces config file is wrong.
3. sudo gedit /etc/network/interfaces (replacing gedit with your text editor of choice if you care)
4. Fix the config file. Use the Ubuntu wiki or an online search if necessary. (Obviously, from another computer.) If you're lost, you can erase whatever you don't understand and go through the Networking GUI to rebuild it.

As usual, the next upgrade from Edgy to Feisty was clean and uneventful. The only complaint I heard later was that the wireless situation was about the same level of fussiness as before (I still don't know the details). However, Network Manager seems to be alive by default in Feisty -- or else I didn't notice when it was installed -- so there are more options for fussing with the wireless connection right off the bat. Fuss, fuss, dhclient, fuss, restart, gold. So, I think we're in a good place now.

No comments: