Sunday, November 06, 2011

Upgrade Mandriva 2010 to 2011

Part of the fun of Linux, for me at least, is the ability to fix things when they go wrong. And things generally go wrong when you don't follow the advice of conventional wisdom. Plus, my personal mantra is "fix it until it breaks".

One of those great pieces of common wisdom when discussing Mandriva is that you only upgrade within major versions, like from Mandriva 2010.1 to 2010.2, but when moving between major versions, like from Mandriva 2010 to 2011, you do a clean install.

If you have followed other convention wisdom, you have a separate physical partition for /home. With that configuration in place, you can do a clean install of the root filesystem and keep all you personal files and settings. But that can also pose problems since there is not always a clean upgrade path for the personal configuration files that live in the dotfile and hidden directories of your home directory. More on that at another time.

I wanted to upgrade (not update) from Mandriva 2010.2 to 2011.0 just to see what would happen. A look at the Notes for 2011.0 would indicate that such an option is possible with relative ease. Well, not really. Here's what you need to do.

After you have made certain that all you data is backed up and secure, the first step of the update is to update all the packages on your system.

# urpmi --auto-update --auto -v

Next, all the references to the 2010.2 repositories must be deleted.

# urpmi.removemedia -av

Then, 2011.0 repositories must be added. I also use the PLF repositories, so those need to be added those as well. You can do this automatically with EasyURPMI at PLF.

For the full Mandriva repos (all on one line):

# urpmi.addmedia --distrib --mirrorlist 'http://api.mandriva.com/mirrors/basic.2011.0.$ARCH.list'

For the PLF repos (all on one line):
# urpmi.addmedia --distrib --mirrorlist 'http://plf.zarb.org/mirrors/2011.0.$ARCH.list'

Note that the commands contain the variable $ARCH. I did that so you could copy the command and it would automatically detect your i586 or x86_64 system as appropriate.

Even after this has been done, some of the individual repos (the non-free ones) that are deliberately not enabled. To enable these, in your menu go to Tools : System Tools : Configure Your Computer. This launches the Mandriva Control Center. Then select Software Management : Configure media sources. Tick the boxes next to the repos Main Backports, Contrib Backports, Non-free, Non-free Updates, Non-free Backports, PLF Non-free and PLF Non-free Backports. Click on OK when you are all done and exit the Control Center.

If you want to avoid the lengthy trip through the menu system, execute drakrpm-edit-media in a terminal window.

If anyone is aware of a script that can have the same result, I would like to hear of it.

I have always found it better to do this kind of upgrade without the GUI running. So far, if you've been following along on your own system preparing for the upgrade, you've been able to cut and paste commands between your browser and a terminal window, but once the GUI disappears, that becomes impossible. Since the command to perform the actual update is a long one, let's create a shell script to execute it.

Using whatever text editor you prefer, create a file named 2011_upgrade.sh, make it executable with chmod +x and have it contain the following (all on one line):

#!/bin/sh urpmi --auto --auto-update --replacefiles 2>&1 | tee 2011_upgrade.log # upgrade 2010.2 to 2011.0

Now, using Crtl-Alt-F2, open a virtual terminal and log in as root. Stop the dm service to shut down the window manager with:

# service dm stop

Now log back in as root, change to your home directory and run the 2011_upgrade.sh script.

The urpmi package manager now wants to install a lot of packages and urpmi is smart enough to know to install certain system-critical packages first. But urpmi cannot install python-numpy because if version conflicts. This causes the upgrade process to fail to install any python packages which will seriously munge your system and which prevents the installation of packages which depend n the newer version of python..

Don't panic and most importantly, don't reboot. Your system is running now and there is no guarantees that it will on a reboot.

The solution is simple. That is we should uninstall python-numpy manually and then re-install the most current version; this will allow urpmi to update python and unblock the installation of many more packages.

The problem we encounter is that the urpme command doesn't know how to uninstall python-numpy without also uninstalling every other package that depends on it. Normally that's a good behavior, but not for in this instance.

We'll need to use the rpm command to uninstall only the one package and then use it's smarter cousin urpmi to successfully update all of python.

# rpm -ev --nodeps python-numpy

and then,

# urpmi python-numpy

There may be similar notifications for other files. I was notified about libkexiv2 and x11-driver-input-evtouch. The same trick using rpm -ev --nodeps works with them as well.

With these problems fixed, run the 2011_update.sh script once more. Keep fixing and re-running until there are no more packages to update. Once that state is reached, it will be safe to reboot into Mandriva 2011.0. When 2011.1 is released, the same technique can be used, but there should be fewer problems.

One problem that did occur post-upgrade concerns networking. Mandriva 2011 implements a new network manager and your old network configuration files won't work with it. While you can use the network section of the Mandriva Control Center to fix this (I had to delete the connection and re-create it to make it work), it's easier to add NM_CONTROLLED=yes to the end of each ifcfg-* file in /etc/sysconfig/network-scripts. That's all that is necessary for the new Network Manager to control them.

Otherwise, everything works fine and I'm now running Mandriva 2011.0. That the upgrade worked as smoothly as it did is a testament to the work and expertise of the Mandriva team. If I come across other issues, I'll address them here.

UPDATE
Because I did not like many of the changes implemented in Mandriva 2011, I reverted all my desktops and servers to Mandriva 2010.2 and they will be upgraded to mageia2 when that is available.

No comments: