Urpmi

From Rosalab Wiki
Jump to: navigation, search
One of the most important ROSA specific tools is, without a doubt, urpmi, which allows for better and easier package management in your ROSA Linux 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 places to learn more about urpmi

Urpmi is an important tool for all ROSA Linux 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:

  • man pages: check the man pages for all the options. Those are the most uptodate sources of information (Remember: they can also be opened in many browsers, just enter: man:urpmi in the addressfield).
  • Upgrading ROSA Linux with urpmi discusses upgrading ROSA Linux from one major version to another using urpmi

Besides 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
urpmi --auto-update merge urpmi.update -a and urpmi --auto-select
urpmq -i xxx.rpm info on the package xxx.rpm in the current directory
urpmq -il xxx.rpm info on the package xxx.rpm in the current directory & list of files that it installs
urpmq --changelog xxx.rpm print changelog of the package in the current directory
urpmq --whatrequires xxx.rpm which package(s) require(s) the xxx.rpm in the current directory
urpmf /path/to/file which package has installed "file*" in /path/to
urpmi --fuzzy --test xxx shows all rpms that match string "xxx".
rpm -qf /path/to/file similar to urpmf, but searches on installed system
urpmi.update updates updates the local data about available packages in the medium "updates"
urpmc updates the local data about available packages in all media
   
Command What it does
urpmi.addmedia --distrib --mirrorlist add all the important packages repositories, selecting the mirror automatically
urpme xxx removes the package xxx (and those that depend on it)
urpmi --keep xxx.rpm installs package xxx.rpm from the current directory and it's dependencies, but if anything has to be removed it will not
urpmi --update --auto-select installs available updates from your enabled media
urpmi --keep --auto --auto-select update all packages from your enabled media, but don't remove anything: just tell if anything didn't work
urpmi --test --keep --auto --auto-select update all packages from your enabled media but don't install or remove anything, just tell if it will work
urpmi --auto-select automatically select upgradeable packages

urpmi.addmedia

This is where the whole thing starts. You add a software repository (a.k.a. medium, mirror) using the urpmi.addmedia command.

By default, every installation of ROSA Desktop Fresh has all necessary media included. If you need to add some additional medium (e.g., somebody at our forum suggested you to try some packages from hist personal repository in ABF), you can add necessary repository manually.

The format for adding a new repository in command line is as follows:

urpmi.addmedia nameofmedium ftp://ftp.site.com/path/to/RPMS

but effectively you are working behind the scenes juggling the same as if you are using edit-urpm-sources.pl which is the GUI in ROSA Linux Control Center under Software Management --> Select from where software packages are downloaded when updating the system

The ROSA Linux ftp mirrors for final release versions contain at least:

  • main which contains most important programs, supported by ROSA
  • contrib which contains some more optional programs added by contributors, but which do not necessarily get (security) updates
  • non-free which contains some programs which are not free

Each medium contains 3 sub-media:

  • release the packages as of the release day.
  • updates the packages updated since the release day for security or bug concerns. For ROSA Desktop Fresh, this repository also contains newer versions of different software. When adding an update medium, add the --update switch so urpmi can distinguish it from a regular medium.
  • testing which is used to temporary tests of new updates, to allow the bug reporters to validate the corrections.

To be able to install packages from a mirror, urpmi needs one of two files containing in compressed format either: the most essential or the most complete set of data.

Please see Policies/Mirror_Structure and Policies/SoftwareMedia for a complete overview of the mirror structure which can be found on most mirrors.

Recovering lost sources (cds)

If you find you do not have all your cdroms/dvds listed as media you can:

 urpmi.addmedia --distrib cdrom removable://media/cdrom

with cd1 in your drive.

Copying CDs to a home directory and using the copy in urpmi

If you don't like juggling CDs when updating your system and you have room to spare, make a directory (for example: /home/uid/CDS/), copy the base/ and ROSA/ directories recursively from the first install-CD there. Then copy the RPMS2 to RPMS8 directories from all the CDs/DVD into the ROSA/ directory. After removing or disabling the install CDs do as root:

urpmi.addmedia --distrib HD file://home/uid/CDS

Actual set of directories to be copied depends on version of ROSA Linux you are using.

When done:

      cd /home/uid/CDS
      genhdlist

Then use the media manager via ROSA Linux Control Center --> Software Management --> Select from where software packages are downloaded when updating the system to set up your new directory and disable all the cd entries.

Another method is copying the ISO images to different mount points, which will also work on earlier versions, see section Copy CDs to Hard Drive and mounting each in loopback

Copying rpms (including install CDs) to single directory and using the copy in urpmi

Make a directory, for example ~/RPMS , to hold all the rpms

To copy a bunch of rpms (from the install cds, for example) :

  find /INSTALL_CDS/ -name *.rpm -print -exec cp {} ~/RPMS \;

If you have copied the install CDs to the hard drive, or have their ISO images on the drive (see Copy CDs to Hard Drive on how to mount them), this can be done in one step.

In this example, the CDs were mounted as /INSTALL_CDS/CD1, /INSTALL_CDS/CD2, etc.

  cd ~/RPMS

  genhdlist

It will then create a hdlist.cz file and a sythesis.hdlist.cz file based on what it finds in the directory it is in.

Find the pubkeys for the rpms and copy them into ~/RPMS/pubkey. They should be in INSTALL_CDS/CD1/media/media_info :

  mkdir ~/RPMS/pubkey

  cp /INSTALL_CDS/CD1/media/media_info/pubkey* ~/RPMS/pubkey/

then as root add the medium:

  urpmi.addmedia local_rpms  file://home/uid/RPMS/

Please see note on discussion tab of this page

Adding media for a distribution

urpmi can add important media (e.g. main, updates, contrib ...) from a chosen mirror with a single command. As root type in a console:

urpmi.addmedia --distrib ftp://'MIRROR_SITE'/pub/ROSALinux/official/'VERSION'/'ARCH'

in which:

  • 'MIRROR_SITE' is the actual URL of the ftp server
  • 'VERSION' is the current or other version of your ROSA Linux for which you want to the add the media
  • 'ARCH' is one of: i586 or x86_64

Selecting mirror automatically using aria2

It is possible to automatically select mirrors using the --mirrorlist option. This command will add important medias selecting the mirrors automatically :

urpmi.addmedia --distrib --mirrorlist '$MIRRORLIST'

urpmi.update

The urpmi.update command updates the list of packages from a package 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 changeable repository, like Cooker (Be very careful with Cooker packages; they might work but installing them usually does cause problems further down the road on a stable version!). If you are using a repository for a final release, it normally does not change, so you do not need to update the list whenever you install. It works like this:

urpmi.update nameofmedia

or

urpmi --auto-update

This will update all.

urpmi.removemedia

If you want to get rid of a repository, this is the command to use:

urpmi.removemedia nameofmedia

urpmf

urpmf is 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 that you want to compile a C program on your box and the compiler complains about jpeglib.h missing. All that you have to do is:

urpmf jpeglib.h

That will output, for example:

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

This means that the jpeglib header file is part of the package libjpeg62-devel, and can now be installed with:

urpmi libjpeg62-devel

Another example: 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 management command, which you use to install the package you want as well as the packages that it depends on:

urpmi nameofpackage

For instance, if you think that Sylpheed is a good e-mail client because it describes itself as 'lightweight', you install it with: urpmi sylpheed.

Caveat: doing urpmi nameofpackage usually but not necessarily results in the latest version of that package being installed. Urpmi will compare the version number of the installed package with that in the enabled media. The exception is that when an upgrade of a package is made available under a slightly different name while both the old and the new version remain available in the enabled media. It is sometimes necessary to do so for reasons of backward compatibility.

Here is a notable example urpmi autoconf will not result in the latest version being installed, for the highest version of that package name is autoconf2.5-2.60.

You should use the command urpmi autoconf2.5 instead, which will give you the latest 2.5*. Note thate on your ROSA system, both versions should be installed: ROSA 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 several remarks about urpmq --fuzzy below to learn how to avoid such versioning problems.

Another 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 medium called 'updates' which was declared to be an 'update medium' when it was added. Because the contents of update media 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 command the --update switch means "only search in repositories declared as update media", and the --auto-select switch means "select available updates of packages already installed". Urpmi will list the upgradeable packages and ask if you wish to proceed.

If add also the --auto switch, all upgradeable packages will be upgraded including all required dependencies. If you prefer using a graphical userinterface ('GUI') use rpmdrake in the ROSA Linux Control Center: Software Management --> Look at available updates and apply any fixes or upgrades to installed packages

Installing a new kernel

Kernels are never upgraded, they are only ever installed. So you will never see your kernel upgraded when you run ROSA Update in older distributions. To install a new kernel from the command line :-

# urpmi.update updates     /get the list of available updates from your updates media/
# urpmq --fuzzy  kernel   /list the available packages containing the word "kernel", / or:
# urpmi -y kernel  /"-y" is short for "--fuzzy" /

The following packages contain kernel:
<snip>
....
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
<snip>
....
#urpmi kernel-2.4.22.26mdk  /pick the kernel you want to install/

The new files needed to boot will install in /boot alongside those of older kernel(s). The grub or lilo configuration will be automatically adjusted by adding a new stanza to allow you to boot the old and the kernels. The default 'linux' stanza will boot the new kernel. If you wish you can use the ROSA Software Install GUI rpmdrake to install a new kernel: ROSA Linux Control Center --> Software Management --> Look at installable software and install software packages,but you must run the ROSA Update GUI first to force an update of the available media: MLCC --> Select from where packages are downloaded when updating the system --> Update or from the previously mentioned window in rpmdrake: File --> Update media

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 (but it can also be handy to search the documentation included in the package). Be sure that you have installed the same version of kernel-source as the kernel you are running, or else the drivers you compile will not work.

urpmi --parallel pushes updates to machines in your network

Updates are downloaded to one of the machines and from there pushed to the others on your network.

urpmi --parallel will update all machines you specify. See man urpmi for more and man urpmi.files, as well as: http://www.happyassassin.net/2005/05/04/a-quick-guide-to-urpmi-parallel .

urpmi parallel mode does what it sounds like: you run an urpmi command and it happens on many machines in parallel. In more detail - the machine you run the command on tests its result on each machine in the group in turn, downloads all necessary packages for all machines in the group, distributes the appropriate packages to each machine, then calls urpmi on the machine to do the actual installation. It's brilliant for quickly installing software on all your machines, or even keeping them all up to date with a couple of commands, and it saves on bandwidth, as each necessary package is downloaded only once. The only drawback at the moment is that you cannot include the server machine in the group, which makes it a little less good for small home networks.

So how to use it? It's pretty simple, really. First, make sure you can ssh from the server to each client machine as root (you have to enter a passphrase or password, but can be you set up to use keys and make use of ssh-add to avoid that). Now install urpmi-parallel-ssh on the server machine. Edit /etc/urpmi/parallel.cfg to look like this:

local:ssh:toy:htpc

the first parameter is the name of the group, make this whatever you like. Leave the second as ssh. The remaining parameters are the hostnames of the machines in the group; as many as you like (but not the server machine: urpmi will just fall over its own lock files).

Next you can use it. On the server machine, run:

urpmi --parallel local somepackage

As long as urpmi on the server has access to all packages required by all client machines from its urpmi media, everything should now work smoothly. The easiest way to ensure this is to have all machines - server and client - use the same urpmi media.

Furthermore, you can keep a group of machines up-to-date. For example on a home network, which includes zen (the server), toy and htpc, run this series of commands on zen to keep all the machines up to date with Cooker:

fanout "localhost toy htpc" "urpmi.update -a"

fanout runs a single command on several machines at once; it it uses ssh.

urpmi -auto-select -keep -noclean -v

noclean keeps the packages on zen after they have been installed; this means when one does the parallel command at the next stage, it doesn't go out and download them all again.

urpmi --parallel local -auto-select -keep -v

References

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 rpm 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 media you have, like this:

[root@isis root]# urpmq --list-media 
contrib
MandrivaClub
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 ROSA 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               
No package named vegastrik
The following packages contain vegastrik: vegastrike, vegastrike-data
You should use "-a" to use all of them
          // This time the query result is very different:
          // We see not one but two packages.

         // Compare the following query to the previous two.
[root@localhost augustin]# urpmq --fuzzy vegastrike  
vegastrike
vegastrike-data
          // 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!!

Using Graphical interfaces

gurpmi

gurpmi is the graphical front-end for urpmi and can be used on the commandline to install/search a package from a medium or at the prompt. It is also used by rpmdrake to display messages that need user interaction.

rpmdrake

ROSA offers a set of nice graphical tools to perform the same tasks. See Rpmdrake.

smart

Originally from Conectiva, packages smart, smart-update and smart-gui are python based tools still available from contrib. They are very fast, quite reliable and have some different nice aspects than the original ROSA tools, but are not officially supported by ROSA. Home is here: Smart Home . Now it is made available for many distributions offering "better package management".

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 user 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: GnuPG for more details.

Besides 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 and the included gpg package key. See relevant section below for details.

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 file has become corrupted during an upgrade or when an urpmi process was killed by an impatient user.

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

MD5 Hash

The MD5 hash is a code within the rpm package that lets rpm checks whether the package hash is okay or not. If for any reason the file is corrupted, rpm (and urpmi) will refuse to install it; rpmdrake will prompt the user whether or not it may proceed.

Here is a recent example:

[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 will not 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 or rpm --import <filename>

If it still does not 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 server. If you've tried several servers and you always run into the same problem, check in a ROSA 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

If you get "urpmi database is locked" while trying to install a package, it usually means that another process is using the database. This could be for example:

  • One of the ROSA software management applications:
    • rpmdrake aka "Install & remove software"
    • drakrpm-edit-media aka "Configure media sources for install & update"
  • mdkapplet, the update applet, updating the urpmi database in the background (this is the applet responsible for the icon in the system tray notifying the users of the availability of updates)
  • A urpmi/rpm process installing or uninstalling a package

Urpmi will display the whole command line of the process using the urpmi database, that makes it easier to identify it.

If you are sure you have not started any other urpmi commands or software management windows then it's probably mdkapplet updating the urpmi database and checking for updates in the background. Simply wait a while, and try again.

If the problem persists, then check what's using it, this command should do the job (as said above urpmi will display the command line of the process locking the urpmi database):

ps aux | grep rpm

you can kill the process but you must be cautious so as not to harm the urpmi/rpm database. e.g. if it's urpmi.update, you can kill it, as this command only updates the urpmi database, and if it quits without finishing it'll update the db the next time it's run.

Deleting the urpmi LOCK files manually is not recommended nor needed

urpmi uses f-lock to lock the urpmi database when a urpmi process is running, this means that urpmi can detect if the LOCK files (/var/lib/urpmi/.LOCK and /var/lib/rpm/RPMLOCK) are "stale" (i.e. a process was running before and created the LOCK files but didn't exit cleanly and so didn't delete the LOCK files); when urpmi detects "stale" lock files it simply deletes them and creates new ones. So you should never need to delete those LOCK files manually, instead you should follow the above steps to investigate/fix the "urpmi database is locked" message, if you ever see it.

Rebuild your database

If the database becomes inconsistent (an inconsistency can lead rpm to tell you that a "package is already installed" when it is actually not, and vice-versa) then you can rebuild the rpm database using this command: rpm --rebuilddb

* It is a good idea to regularly back up your /var/lib/rpm directory. Then you can always revert to a previously good database and reinstall the packages that came later with:

rpm -ivh --justdb --noscripts --notriggers

Idea.png
Note
In modern rpm5, rebuilddb is obsolete. You should use appropriate db_recover tool from berkleydb inside /var/lib/rpm directory. E.g., if libdb-5.1 is used, then the command will look like cd /var/lib/rpm && db51_recover -ev

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.

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 reinstall a package, use the command:

urpmi --replacepkgs packagename

You can also use the command urpmi --no-install packagename to download the rpm file(s) without installation and then use:

rpm -i --replacepkgs /var/cache/urpmi/rpms/packagename.rpm

to install the package (assuming that packagename.rpm is the name of the rpm file).

To verify one or more package's proper md5sum, hash and gpg signature:

rpm -K foo.123.rpm, or rpm -K foo*

RPM sources

In order to work on sources files of a package, you can use urpmi to download the SRPMS rpm file:

[root@mycomputer ~]# urpmi.addmedia 2010_main_src ftp://ftp.free.fr/mirrors/ftp.mandriva.com/MandrivaLinux/official/2010.0/SRPMS/main/release with media_info/hdlist.cz

and then you can install it:

[root@mycomputer ~]# urpmi --install-src packagename

If you add --noclean, you will keep it on the rpm build top directory. Please notice that you don't need to be root to download the src.rpm, just type:

[user@mycomputer ~]$ /usr/sbin/urpmi --install-src packagename

and you will get the file packagename.src.rpm, probably under /tmp/.urpmi-xxx/rpms/ .

If you have installed the standard directory tree for building an rpm, you can rebuild your binary from the downloaded src rpm file (refer to Development/Howto/RPM).

Early bird slow

If msec is verifying your system it uses the rpm database, 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.

Upgrade to the latest ROSA version using urpmi

Urpmi can also be used to upgrade your box to a newer version of ROSA Linux: add the mirror's URL with the directory of the new versions packages to your urpmi configuration: ROSA Linux Control Center --> Software Management --> Select from where software packages are downloaded when updating the system

(More) cool tricks using urpmi

Install from url or localfile

urpmi can be used to install local rpm's , and then resolve dependencies. For example, you just recompiled or created foo-1.0-1bar.rpm . You can easily use urpmi foo-1.0-1bar.rpm . It even works with http or ftp url (and even with ssh, provided that rsync is installed on both sides). If enabled bash_completion will work very well on such commands.

Getting a list of dependencies before installing

By using urpmq you can find out a lot of information about an rpm.

  • urpmq -d gets a list of all rpm's that are needed to install one piece of software.
  • urpmq -d bash see which rpm's are required.
  • add the -m switch to see the ones not installed on the system at the moment.
  • --sources will get the sources.

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

Getting information about an rpm

urpmq -i can give you information about the rpm's you can install. Try urpmq -i bash

Installing non-rpm-packaged software

Where possible, you should use urpmi to install software, using packages from the correct urpmi media for your current version of ROSA Linux. Nearly everything you could want is available, if you have media 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 ROSA media.

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. If the tarball already includes a good spec file, it is even easier:

rpmbuild -tb ballname.tar.gz

Installing binaries such as acrobat reader

These programs should end up in the /usr/local/ directory. This directory is intended for non-official packages.

The proprietary drivers

NOTE : In ROSA Linux, proprietary drivers are shipped in the non-free media. So you don't need to use the horrid Nvidia 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.

Please refer to the Cooker Howto on rpm packaging for much more detailled information.

Copy CDs to Hard Drive and mounting each in loopback

If you don't like switching CDs when updating your system and you've got some room to spare, you can save the ISO images of the CDs to your hard drive and then tell urpmi to use those instead of the real CDs.

To start, make a directory for the ISO images of the CDs:

mkdir ~/iso

Then copy each of the CDs in:

dd if=/dev/cdrom of=~/iso/cd1
dd if=/dev/cdrom of=~/iso/cd2
dd if=/dev/cdrom of=~/iso/cd3
...

Now as root make mount points for each of them:

mkdir /mnt/cd1
mkdir /mnt/cd2
mkdir /mnt/cd3
...

and mount them in loopback:

mount -t iso9660 -o loop /home/uid/iso/cd1 /mnt/cd1
mount -t iso9660 -o loop /home/uid/iso/cd2 /mnt/cd2
mount -t iso9660 -o loop /home/uid/iso/cd3 /mnt/cd3
...

Now edit the /etc/urpmi/urpmi.cfg file changing each entry as follows:

From (for example):

    Installation\ CD\ 1\ (cdrom1) removable://mnt/cdrom/media/main {
      hdlist: hdlist.Installation CD 1 (cdrom1).cz
      key-ids: 70771ff3
      removable: /dev/hdc
      with_hdlist: ../../media/media_info/hdlist1.cz
    }

to this:

    Installation\ CD\ 1\ (cdrom1) file://mnt/cd1/media/main {
      hdlist: hdlist.Installation CD 1 (cdrom1).cz
      key-ids: 70771ff3
      with_hdlist: ../../media/media_info/hdlist1.cz
    }

In other words, change the 'removable://mnt/cdrom' to 'file://mnt/cd1' for each of cd1, cd2, cd3, etc. Also, remove the line that reads:

    removable: /dev/hdc

Note:
This page is based on the Mandriva Urpmi page.