Tuesday, December 09, 2008

Mandriva urpmi

Mageia linuxpackage management has added some enhancements to their urpmi tool. One of the newest is the ability to remove 'orphaned' packages from the system. Orphans are rpm packages that were installed as a dependency for some other package and said other package has been removed, but the orphan remains.

The canonical source of information about urpmi can be found at the Mageia Wiki.

The file /var/lib/rpm/installed-through-deps.list contains a list of packages installed indirectly and the package manager uses this list to determine 'orphans' when the follow command is run to remove orphans:

# urpme --auto-orphans

If you run that command and the list of orphans is incorrect (it wants to remove packages that you know should not be uninstalled), the fix is simple. Just edit the file /var/lib/rpm/installed-through-deps.list and remove the names of the packages you don't consider 'orphans'. Re-running the command to remove orphans should now show a list shorter by the packages you deleted in the file /var/lib/rpm/installed-through-deps.list.

Occasionally, you may delete an individual file or mess up a configuration file and need to restore it. To do so, first you need to identify the package the file belonged to:

#rpm -q --whatprovides full_path_to_name_of_file

Using the full path plus the file name allows rpm to select among similarly-named files. This command is also useful if you just need to know what package provides a particular file.

To replace the missing or corrupted file, refresh the package with:

#urpmi --replacepkgs name_of_package_without_version_number

Using the name of the package less the version number allows urpmi to install the most current version.

If you want to issue a urpmi command while another instance of urpmi is already running (and locking the rpm database), add the -wait argument and the new command will wait until the database is free before it runs.

Place the following in your .bashrc to create and alias:

alias whatprovides="rpm -q --whatprovides `whereis %0`"

This allows you to not have to remember the long command, and simply do this:

$whatprovides file_name

If you compile software and get messages that files are missing, you can find them with:

$urpmf missing_filename

No comments: