Kopia strony z dnia 23.01.2005 http://mandrake.vmlinuz.ca/bin/view/Main/UsingUrpmi
TWiki . Main . UsingUrpmi

All You Ever Wanted to Know About Urpmi But Never Dared Asking Before

One of the most important Mandrake-specific tools is, without a doubt, urpmi, which allows for better and easier package management in your Mandrake box. If you master the use of urpmi, you will never again suffer the dependancy hell that many inexperienced users complain about. For instance, urpmi sylpheed will install the Sylpheed mail client, and all the required libraries.

Other resources to learn about urpmi

Urpmi is an important tool for all Mandrake users. It pays to take the time to learn to use it. This page gives you an overview of the most often used options. Below are other resources with more detailed information about urpmi:

Beside a very basic introduction, this page tries to cover what is not already covered in the two above sources of information. We assume that you know how to use a man page and that you have read the above page. Once you have done so, come back to this page: there is more information about not so obvious problems you may run into.

Using urpmi

Quicklist of common tasks

Command What it tells you
urpmq -i xxx.rpm info on the program
urpmq -il xxx.rpm info and the files it installs
urpmq --changelog xxx.rpm changelog
urpmq -R xxx.rpm what requires this rpm
urpmf path/to/file which rpm provided this file
rpm -q --whatprovides path/to/file similar to urpmf, but works with both hdlist.cz & synthesis.hdlist.cz
urpmi.update updates available updates from your updates source
urpmc available updates from all your urpmi sources (you might need to urpmi urpmc 1st)
   
Command What it does
urpme xxxx removes the rpm (and dependencies)
urpmi -y xxx shows all rpms that match this string. (careful: if there is only one match it tries to install it)
urpmi --keep xxx.rpm installs rpm and it's dependencies, but if anything has to be removed it will stop that thread
urpmi --update --auto-select installs available updates from your update source
urpmi --keep --auto --auto-select update all packages but don't remove anything, just tell what didn't work
urpmi --auto-select figure out what needs to be updated and prompt for yes or no

urpmi.addmedia

This is where the whole thing starts. You add an urpmi repository using the urpmi.addmedia command. You can get a list of urpmi sources from the Easy Urpmi page . The format for adding a new repository is something like this:

urpmi.addmedia nameofmedia ftp://ftp.site.com/path/to/Mandrake/RPMS with ../base/hdlist.cz

The Mandrake-Linux ftp mirrors should contain:

You can use synthesis.hdlist.cz instead of hdlist.cz if your bandwith is small, but you'll lose a lot of functionality... For instance, urpmf can't find files in non-installed packages if you are using synthesis.hdlist.cz.

Recovering lost sources (cds)

If you find you do not have all your cds listed as sources, try urpmi.addmedia --distrib cdrom removable://mnt/cdrom with cd1 in your drive.

Copying CD's to hard-disk and using those as source.

If you don't like juggling CD's during urpmi sessions and you've got some room to spare, make a directory (let's say: /home/CDS/), copy the base/ and Mandrake/ directories (recursively) from the first install-CD there. Then copy the RPMS2 to RPMS8 directories into the previously created Mandrake/ directory. After removing or disabling the install CD's as sources do: =urpmi.addmedia --distrib HD file://home/CDS=

urpmi.update

The urpmi.update command updates the list of packages from an urpmi repository. This list changes whenever the packages in the server change, so you need to update it whenever you want to install a new package from a changable repository, like MandrakeCooker??. If you are using a repository for a release, those don't normally change, so you don't need to update the list whenever you install. It works like this:

urpmi.update nameofmedia

or

urpmi.update -a

The -a argument means "all media".

urpmi.removemedia

If you want to get rid of a repository, this is the command you use. It's used like:

urpmi.removemedia nameofmedia

urpmf

urpmf is, in my experience, the best of the unknown parts of the urpmi package management system. With it you can find any file that you may want, know what package it belongs to, see a description of the package and a bunch of other things.

Suppose, you want to compile an image viewer on your box. You decompress the tarball, and then run the ./configure. Now, the configure script complains about jpeglib.h missing. (*NOTE: IMHO the configure script usully say "jpeg library missing", so this exemple is not so relevant) All what you have to do is urpmf jpeglib.h.

That'd answer with:

libjpeg62-devel:/usr/include/jpeglib.h
mozilla-devel:/usr/include/mozilla-1.4a/jpeg/jpeglib.h

So you know that the jpeglib header file is part of libjpeg62-devel, and can now install it using urpmi libjpeg62-devel. That saves you a lot of time :-)

Also, you might want to install a mail client, but you don't know any mail client for linux. So you want to perform a search on the summary of the packages, for terms 'mail' and 'client'. The command urpmf --summary 'mail' -a client returns

evolution:Integrated GNOME mail client, calendar and address book.
squirrelmail:Squirrelmail is a webmail client for PHP4.
sylpheed-claws:Enhanced version of the Sylpheed e-mail client
comsat:A mail checker client and comsat mail checking server.
cscmail:CSCMail is a GTK email client written in Perl
sylpheed:A GTK+ based, lightweight, and fast e-mail client
tradeclient:Email Client with PIM features for X

The --summary option is used to perform a search on the summary, and the -a switch translates 'and'.

urpmi

This is the main package managment command, which you use to install the package you want and all the stuff that it depends on, so you won't have to go hunting all over the place. It's used like:

urpmi nameofpackage

For instance, you think that Sylpheed is a good e-mail clinet because it describes itself as 'lightweight'. Thus you install it thanks to urpmi sylpheed.

Caveat: doing urpmi nameofpackage usually but not necessarily result in the latest version of that package being installed. Urpmi will check the version number of the package installed to that of the same package in the urpmi source. The exeptions are when a major upgrade of some packages are made available under a slightly different name so that both the old and the new version remain available. It is sometimes necessary to do so for backward compatibility purposes.

Here is a notable example urpmi autoconf will not result in the latest version being installed, for the highest version under that package name is 2.13. You should do urpmi autoconf2.5 instead, which will give you the latest 2.5*. Note thate on your Mandrake system, both versions should be installed: Mandrake will automatically choose the one that is most appropriate. See /usr/share/doc/autoconf-2.13/IMPORTANT.README.MDK for more information on this particular example.

See urpmq --fuzzy below to learn how to avoid such versioning problems.

A typical example of using urpmi is to update your system with the latest security updates/bugfixes.

urpmi.update updates && urpmi --update --auto-select

This example assumes you have an urpmi source called 'updates' which was declared to be an 'update source' when it was added. Because the contents of update sources change frequently it is necessary to perform urpmi.update to check for new packages. The '&&' characters mean if the first command succeeds, then perform the second command. In the second part of the command the '--update' switch means 'only search in repositories declared as update sources', and the '--auto-select' switch means 'find the latest versions of packages already installed'. Urpmi will list the upgradable packages and ask if you wish to proceed.

If you were to add the '--auto' switch then the entire process will be automated and all upgradable packages will be upgraded without asking for confirmation. If you prefer using a GUI try the Mandrake Update GUI in Mandrake Control Centre.

urpme

This is the command that uninstalls software from your box. As with urpmi, it works out the dependancies and tells you if any software that's still installed depends on what you want to uninstall, giving you the chance to abort the procedure or to uninstall the package and those that depend on it. Usage is:

urpme nameofpackage

For instance, Sylpheed is so good that you want to get rid of Evolution, your former e-mail client. You can make some place on your hard drive with urpme evolution.

urpmq

urpmq allows you to query the urpmi database, so you can find out information about the packages that you have installed or that you can install as well as other things in the database, like what media sources you have configured, like this:

[root@isis root]# urpmq --list-media 
contrib
MandrakeClub
club.comm_i586_9.0
cooker
plf

Caveat: when using urpmq to look for packages, make sure you understand the difference between using it with or without the option --fuzzy. You might miss some packages you were looking for if you are not careful. If urpmq finds a package with the exact name than the one you queried, it will return this package only and by default, you will not see other packages which include the same name.

For example:

         // Imagine your best pal told you about vegastrike, a cool 3D game.
[root@localhost augustin]# urpmq vegastrike             
vegastrike                                                
         // Great! There is a Mandrake package with this exact name!
         // But you don't see other packages which include this name!

         // We query again: notice the missing 'e' at the end of the package name.
[root@localhost augustin]# urpmq vegastrik               
The following packages contain vegastrik:           
vegastrike                         
vegastrike-data
vegastrike-data-music
          // This time the query result is very different:
          // We see not one but three packages.

         // Compare the following query to the previous two.
[root@localhost augustin]# urpmq --fuzzy vegastrike  
The following packages contain vegastrike:      
vegastrike
vegastrike-data
vegastrike-data-music
          // See the difference that the --fuzzy option makes.

urpmq --fuzzy is also great to see what other available version there may be to a package: sometimes a new major version does not provide full backward compatibiliy. For this reason the newer version will be distributed under a slightly different package name. Now, you are sure not to miss anything.

For example:

[root@localhost augustin]# urpmi mplayer
      // This will NOT install the latest version of mplayer.
[root@localhost augustin]# urpmq --fuzzy mplayer
The following packages contain mplayer:
kmplayer
mplayer
mplayer-fonts
mplayer-gui
mplayer-skins
mplayer1.0
mplayer1.0-gui
mplayerplugin
transcode
xmms-mplayer
      // You see: the new 1.0 release is packaged separately. 
      // You have been warned!!

Installing a new kernel

Kernels are never upgraded, they are only ever installed. So you will never see your kernel upgraded when you run Mandrake Update. To install a new kernel from the command line :-
# urpmi.update updates     /get the list of available updates from your updates source/
# urpmq --fuzzy  kernel   /list the available kernels /
# urpmi -y kernel  /alternate method to list available kernels/

The following packages contain kernel:
kernel-2.4.22.10mdk
kernel-2.4.22.26mdk
kernel-2.6-source
kernel-2.6.0-0.test5.1mdk
kernel-BOOT-2.4.22.10mdk
kernel-enterprise-2.4.22.10mdk
kernel-enterprise-2.4.22.26mdk
kernel-i686-up-4GB-2.4.22.10mdk
kernel-i686-up-4GB-2.4.22.26mdk
kernel-multimedia-2.4.22.21mm.1mdk
kernel-multimedia-2.4.22.26mm.1mdk
kernel-multimedia-smp-2.4.22.21mm.1mdk
kernel-multimedia-smp-2.4.22.26mm.1mdk
kernel-multimedia-source
kernel-secure-2.4.22.10mdk
kernel-secure-2.4.22.26mdk
kernel-smp-2.4.22.10mdk
kernel-smp-2.4.22.26mdk
kernel-smp-2.6.0-0.test5.1mdk
kernel-source
#urpmi kernel-2.4.22.26mdk  /pick the kernel you want to install/

The new kernel will install in /boot alongside your old kernels. The Lilo configuration will be automatically adjusted to add a new stanza to allow you to boot the old kernel. The default 'linux' stanza will boot the new kernel. If you wish you can use the Mandrake Software Install GUI to install a new kernel, but you must run the Mandrake Update GUI first to force an update of the urpmi database.

You will notice that one of the packages available is 'kernel-source' This is the source code of the most recent kernel available in the update source (in this example 2.4.22.26mdk) You only need to install the kernel source package if you need to compile anything like a device driver. Be sure that you have installed the same version of kernel-source as the kernel you are running, or else the driver you compile will not work.

Using Graphical interfaces

The Drakes

Mandrake offers a number of nice graphical tools to perform the same tasks. See the Drakes tools.

urpmi.setup

urpmi.setup is a GUI for urpmi.addmedia and urpmi.remove, and it is based on the mirror list from the Penguin Liberation Front.

A question of security

What are the security issues

Urpmi must be run as root in order to install the packages. A clever but malicious person could possibly trick a not so clever Mandrake user (I know that all the Mandrake users are clever, but let's assume that there is one gullible Mandrake user somewhere, just for the sake of argument) to install a package that looks like a regular package used by many but that contains a Trojan Horse, some evil code. Once installed, the application may unleash some virus, worm or even some spyware... So far, there hasn't been any news of any such exploit having been attempted, but in a few years time, when GNU/Linux will be the most widely used OS, it is possible that some people would want to try to perform such a feat. Fortunately, they will fail, because a sane concern for security has always been part of the GNU/Linux community. Most packages are signed by the packagers to prove the authenticity. Please see: for more details.

Beside a malicious person trying to trick you into installing their malware, what is more likely to happen is that you try to install some package that got corrupted, either during ftp transfer, or because of a scratch on your installation cd... Before installing, urpmi will check the integrity of the package using the MD5 Hash code. See relevant section below for details.

rpmdb: /var/lib/rpm/Pubkeys: unexpected file type or format

Sometimes, when using urpmi, people end up having rows of:

rpmdb: /var/lib/rpm/Pubkeys: unexpected file type or format
rpmdb: /var/lib/rpm/Pubkeys: unexpected file type or format
rpmdb: /var/lib/rpm/Pubkeys: unexpected file type or format
rpmdb: /var/lib/rpm/Pubkeys: unexpected file type or format
rpmdb: /var/lib/rpm/Pubkeys: unexpected file type or format

rpmdb: /var/lib/rpm/Pubkeys: unexpected file type or format
rpmdb: /var/lib/rpm/Pubkeys: unexpected file type or format
rpmdb: /var/lib/rpm/Pubkeys: unexpected file type or format

It is unclear what the origin of the problem is: maybe the said file got corrupted during an upgrade or when a urpmi process was killed.

The solution is to remove the file rpmdb: /var/lib/rpm/Pubkeys and import the public keys again.

Q: I'd like to see more information here about importing public keys for urpmi and fixing problems with invalid signatures and stuff. I don't know enough to add this info myself... --SimonOosthoek

A: Please refer to http://mandrake.vmlinuz.ca/bin/view/Main/GnuPG, paragraph entitled "rpm package validation with GnuPG keys.

MD5 Hash

The MD5 hash is a code within the rpm that checks whether the rpm is corrupted or not. If for any reason the file is corrupted, rpm (and urpmi) will refuse to install it.

Here is an example that happend to me recently:

[root@localhost augustin]# urpmi kdesdk
rpmdb: /var/lib/rpm/Pubkeys: unexpected file type or format
error: cannot open Pubkeys index using db3 - Invalid 
argument (22)
The following packages have bad signatures:
/var/cache/urpmi/rpms/kdesdk-3.1.3-9mdk.i586.rpm: Invalid 
signature ((SHA1) DSA sha1 MD5 GPG GPG#70771ff3 NOT OK)
Do you want to continue installation ? (y/N) y
installing /var/cache/urpmi/rpms/kdesdk-3.1.3-9mdk.i586.rpm
error: /var/cache/urpmi/rpms/kdesdk-3.1.3-9mdk.i586.rpm: MD5 
digest: BAD Expected(97f2ba5a91888cd3af40f89be6b65868) != 
(393221db35071aa90eaa73816a9a5ba8)
unable to install package 
/var/cache/urpmi/rpms/kdesdk-3.1.3-9mdk.i586.rpm

Notice the two lines Invalid signature ((SHA1) DSA sha1 MD5 GPG GPG#70771ff3 NOT OK) and MD5 digest: BAD Expected(97f2ba5a91888cd3af40f89be6b65868) ! (393221db35071aa90eaa73816a9a5ba8)= . The file kdesdk-3.1.3-9mdk.i586.rpm is corrupted and won't be installed.

The solution is to remove the file from /var/cache/urpmi/rpms/ and download it again. Try again to install it with urpmi.

If it still doesn't work, it means that your mirror has a corrupted file. Try downloading it manually from two or three other mirrors and save it in the /var/cache/urpmi/rpms/ folder. Always manually remove the previously downloaded file before attempting to use another mirror. Then install it again with urpmi.

It happens that the same corrupted file is mirrored in every ftp servers. If you've tried several servers and you always run into the same problem, check in a mandrake user forum or mailing list whether other users have the same problem with the same file. If this is the case, probably a new file will be released soon.

Troubleshooting

RPM database locked

As superuser, enter:

killall urpmi urpmi.update urpme rpm urpmi.addmedia
rm -f /var/lib/urpmi/.LOCK /var/lib/rpm/RPMLOCK

If that doesn't unlock the database, rebooting is always the solution.

Rebuild your database

If the database becomes inconsistant (an inconsticancy can lead rpm to tell you that a "package is already installed" when it is actually not, and vice-versa).

rm -rf /var/lib/rpm/__db*
rpm --rebuilddb

The "medium contrib uses an invalid list" error

rm /var/lib/urpmi/list.contrib

This will stop the error from happening without interfering with package installation.

Upgrade to the latest Mandrake version using urpmi

Urpmi can also be used to upgrade your box to the a newer version of Mandrake Linux.

Cool tricks using urpmi

Install from url or localfile

urpmi can be used to install local rpm, and then resolve dependences. Example, you just recompiled or created foo-1.0-1bar.rpm. You can easyly use urpmi ./ foo-1.0-1bar.rpm. It even works with http or ftp url ( and even with ssh, given that rsync is installed on both side ).

Getting list of deps before installing

By using urpmq, you can find lots of information regarding the rpm. If you use urpmq -d, you get a list of all rpm that are needed to install one software. Try urpmq -d bash, to see what are the rpm required. By adding the -m switch, you will only see the one not installed on the system for the moment. ANd with --sources, you will get the sources.

So, with urpmq -d -m --sources, you can easyly get a list of url that correspond to the rpm you need to get, quite handy if you lack a good connection to the internet.

Getting infomation for rpm.

urpmq -i can give you information about the rpm you can install. Try urpmq -i bash. It only works with full hdlists, not with synthesis.

Installing other software

Where possible, you should use urpmi to install software, using packages from the correct urpmi source for your current version of Mandrake. Nearly everything you could want is available, if you have sources defined for contrib and plf: this is a way to avoid a great deal of pain! However, sometimes you may want to install a different package, or a more recent one than is available from the Mandrake sources.

The golden rule is, never bypass the rpm package database, if you can possibly help it, and never install a package forcibly. If you follow this rule, however annoying it may seem, you are guaranteed to never have a system in an inconsistent state. If rpm/urpmi won't let you install something, there's usually a good reason!

Compiling from source

Instead of the familiar trilogy of:

./configure
make
make install

use checkinstall instead:

./configure
make
checkinstall

You will then get an rpm that can be installed using urpmi, and can also be uninstalled when you want to.

Installing binaries such as acrobat reader, or sun's java.

These programs should end up in the /usr/local/ directory. This directory is intended for non-official packages. However, you may wish to add some symlinks if they are not in your $PATH. Eg /usr/bin/java -> /usr/java/j2re1.4.2_04/bin/java

Scripts

I suggest that you keep scripts you write yourself in $HOME/bin. (If this isn't in your $PATH, add it to your .bashrc).

The Nvidia driver

The nvidia binary driver, if you use it, has its own horrid installer, which breaks all the above rules. The result works fine, but the process is not pleasant!

Rebuilding RPMS

If you have an rpm built for a system other than your own, it is possible to rebuild it.

RPM package verification

A really useful tool for checking a broken system is to verify the packages against the rpm database.

rpm -Va

This will tell you which packages have changed since you installed them (i.e. it lists all the ways in which your system is inconsistent with the rpm database) For example, if you have a power failure during boot, some files may become corrupt. (Or just if you have done something daft). Knowing this, you can fix your system to be as good as new by re-installing the packages concerned. (This can even be done on an un-bootable system, if you use a rescue CD to boot and fix it.)

To check a single package use rpm -V packagename (name is enough, version numbers etc. can be left out).

To verify one or more package's proper md5sum, hash and gpg signature: rpm -K foo.123.rpm, or rpm -K foo*

Early bird slow

If msec is verifying your system it uses the rpm data base, but that is done at nice 19, and usually very early in the morning. On a slow box this can take a long time. If ps -e shows msec, rpmv, grep and sort, you can speed up rpmdrake / urpmi by renicing rpmw, grep and sort to 0. (If you'd want to have a little script to start rpmdrake with but first check if msec is doing this, e-mail DickGevers).

Note: The original author's name has been lost, and should be restored ASAP

-- AnneWilson - 18 Nov 2004

-- DickGevers - 26 Dec 2004

----- Revision r1.3 - 26 Dec 2004 - 22:41 GMT - DickGevers
Creative Commons License
Copyright © 2003-2005 by the contributing authors. All material on this collaboration platform is the property of the contributing authors and is licensed under a Creative Commons License unless otherwise noted.
Ideas, requests, problems regarding TWiki? Send feedback