Open source software security

Rebuilding My URPMI Database

30 November -0001
by: Justin
May 19, 2005
urpmi is a powerful package management utility for Mandriva Linux (formerly Mandrake). The GUI front end is a wonderful tool, but isn't much use remotely. I tend to interact with the my Mandriva system via the command line and urpmi has a lot of power for package management at the console. Using urpmi you can install and update packages to keep up with security patches and user requests. It is important to keep your urpmi database of sources up to date so you can install the latest patches and versions.

Recently, in a half baked attempt to rebiuld my urpmi database using the instructions at I succeeded in destroying my urpmi database (mainly, I think because I updated the database to switch from Mandrake 10.0 media to Mandrake 10.1 media (10.0 has 4 CD's, the download version including CD1, CD2, and CD4 wheras in 10.1 there are three CD's numbered one to three for the download version)). So after hosing the install system I had to start from scratch. To wipe out my urpmi database I used:
urpmi --clean
urpmi.removemedia -a

which will clear out all the crap. Next I wanted to use local copies of the three CDs for version 10.1 since I do a lot of my updates remotely via SSH. So the first thing to do was copy all the .iso images to the machine. I created a directory called 'cds' in my home directory first:
mkidr /home/jkeane/cds/

next I copied the three .iso images into that directory, renaming them as cd1.iso, cd2.iso and cd3.iso respectively. The next step was to create mount directories for each of the three CD's, to do this I used:
mkdir /mnt/cd1
mkdir /mnt/cd2
mkdir /mnt/cd3

Then I mounted each of the iso's using:
mount -t iso9660 -o loop /home/jkeane/cds/cd1.iso /mnt/cd1
mount -t iso9660 -o loop /home/jkeane/cds/cd2.iso /mnt/cd2
mount -t iso9660 -o loop /home/jkeane/cds/cd3.iso /mnt/cd3

Now I could reference the local copies. First I checked to make sure my urpmi database was in fact clean using:
urpmq --list-media

Nothing showed up, so it seemed everything was gone. The next step was to add the new sources. The directory structure of 10.1 made this a bit interesting. I used:
urpmi.addmedia cd1 file://mnt/cd1/media/main with ../media_info/

This added cd1 just fine, the next two were a bit trickier, I had to use:
urpmi.addmedia cd2 file://mnt/cd2/media/main2 with ../../../cd1/media/media_info/
urpmi.addmedia cd3 file://mnt/cd3/media/main3 with ../../../cd1/media/media_info/

respectively (note that the hdlist is stored on cd1 rather than on the respective cd's). Finally I added an update source using:
urpmi.addmedia updates with ../base/

so that now when I list my media I get:
# urpmq --list-media

And I'm all set.