(Add bottom chapter with link to Ways_to_install_programs) |
(→Installing binaries such as acrobat reader: moved to page Ways_to_install_programs) |
||
Line 666: | Line 666: | ||
The proprietary drivers are shipped in the non-free media. So always try the Mageia packages first. I.e for Nvidia enable the nonfree and nonfree_backport repos, and in MCC when you configure your Nvidia video card you will be asked if you wan to use nouveau or the Nvidia driver. | The proprietary drivers are shipped in the non-free media. So always try the Mageia packages first. I.e for Nvidia enable the nonfree and nonfree_backport repos, and in MCC when you configure your Nvidia video card you will be asked if you wan to use nouveau or the Nvidia driver. | ||
''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!'' | ''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!'' | ||
− | |||
− | |||
− | |||
− | |||
= Other places to learn more about {{prog|urpmi}} = | = Other places to learn more about {{prog|urpmi}} = |
Revision as of 23:47, 20 March 2018
Other languages Deutsch ; English ; Français ; |
Synopsis:urpmi is Mageia's command line tool for managing packages and repositories (media). For example you can install, update or remove software packages with it. urpmi handles dependencies automatically i. e. it checks and resolves dependencies if necessary. For beginners the graphical tool rpmdrake is recommended over urpmi as rpmdrake is more user-friendly for inexperienced users.
|
Contents
- 1 Overview
- 2 urpmi.addmedia
- 2.1 Copying CD or a DVD to a home directory and using the copy in urpmi
- 2.2 Copying RPM's (including install CD or DVD) to a single directory and using the copy in urpmi
- 2.3 Adding media for a distribution
- 2.4 Manually choosing a mirror
- 2.5 Selecting mirror automatically using aria2
- 2.6 Finding mirrors near you using rsync and urpmi to update
- 3 urpmi.update
- 4 urpmi.removemedia
- 5 urpmf
- 6 urpmi
- 7 urpme
- 8 urpmq
- 9 Using Graphical interfaces
- 10 A question of security
- 11 Troubleshooting
- 12 Upgrade to the latest Mageia version using urpmi
- 13 (More) cool tricks using urpmi
- 14 Installing non-rpm-packaged software
- 15 Other places to learn more about urpmi
- 16 Other ways to install programs in Mageia
Overview
In order to get a general idea of urpmi
have a look at it's command line interface and some basic use cases:
The command line interface
The command line interface of urpmi
is subdivided into the following basic commands:
Command | Description |
---|---|
urpmi | Install or update a package |
urpme | Remove a package |
urpmq | Search for packages or information about packages |
urpmf | Search for packages which contain a given file |
urpmi.update | Update a repository/medium i. e. update the list of available packages on the local system |
urpmi.addmedia | Add a new repository/medium to the local system |
urpmi.removemedia | Remove a repository/medium from the local system |
Common use cases
The following lists provide a brief overview of some common use cases of urpmi
:
Basic commands: Install, remove, update
Command | Description |
---|---|
urpmi PKG.. | Install or update the specified package(s). PKG can also point to a local RPM file which will be installed then. If no matching package is found then a search will be performed and suggestions will be displayed. |
urpme PKG.. | Remove the specified package(s) and all packages which depend on it. If there is no package named PKG, a search will be performed and suggestions will be displayed. |
urpmi --auto-update | Update all: Update all media first (like urpmi.update -a (see below)) and automatically select packages which can be updated and install them (like urpmi --auto-select). |
Media/Repository commands
Command | Description |
---|---|
urpmi.update -a | Update all media i. e. update the local list of available packages |
urpmi.update MED.. | Update the specified media i. e. update its local list of available packages. |
urpmq --list-url | Show all repositories and their URLs. |
urpmi.addmedia NAME URL | Add a new media with NAME and URL. |
urpmi.removemedia NAME | Remove media. |
Search commands
Command | Description |
---|---|
urpmq PKG | Search a package by its exact name (the search term PKG and the package name have to match exactly). |
urpmq --summary -Y PKG | Search a package by its name and display a summary of the package. The option -Y disables the case-sensivity and enables the fuzzy search mode (packages are found if the search phrase and the package name match partially). |
urpmq -i PKG | Display information about a package. PKG could also point to a local RPM file. |
urpmq --requires PKG | Display the dependencies of a package. |
urpmf FILE | Search for packages that contain a file named FILE |
urpmi.addmedia
This is where the whole thing starts. You add a software repository (a.k.a. medium, mirror) using the urpmi.addmedia
command. The format for adding a new repository is as follows:
urpmi.addmedia nameofmedia ftp://ftp.site.com/path/to/Mageia/RPMS
but effectively you are working behind the scenes juggling the same as if you are using drakrpm-edit-media
which is the GUI in Mageia Control Center under Software Management --> Select from where software packages are downloaded when updating the system
Mageia mirrors for final release versions contain at least the following repositories (media):
- core which contains free and open source software
- non-free which contains some proprietary software
- tainted which contains software which may be subject to patent claims in some countries
Here is some other explanations about these categories.
Each media has 4 sub-medias:
- release the packages as of the release day.
- updates the packages updated since the release day for security or bug concerns. Everyone should have this medium, even with a very slow internet connection. When adding an update medium, add the
--update
switch sourpmi
can distinguish it from a regular medium. - update_testing which is used to temporary tests of new updates, to allow the bug reporters to validate the corrections.
- backports some packages of new versions backported from Cauldron, or updates that may need manual assistance so they can not be in updates (i.e ownCloud on Mageia 5)
- backports_testing which is used to temporary tests of new backports, 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 Mirrors policy for a complete overview of the mirror structure which can be found on most mirrors.
Copying CD or a DVD to a home directory and using the copy in urpmi
If you don't like using the CD or a DVD when updating your system and you have room to spare in your harddrive, make a directory (for example: /home/uid/repo/
), copy the x86_64/media
or i586/media
directories recursively from the CD or DVD there. After removing the install CD or DVD open a terminal/console and type as root:
cd /home/uid/repo genhdlist2
Now you can add the media, either via urpmi.addmedia:
urpmi.addmedia --distrib HD file://home/uid/repo
Or use the media manager via Mageia 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 or DVD entries.
Copying RPM's (including install CD or DVD) to a single directory and using the copy in urpmi
Make a directory, for example ~/RPMS
, to hold all the RPM's. Then in order to copy a bunch of RPM's (from the install CD or DVD, for example) you type:
find /INSTALL_CD/ -name *.rpm -print -exec cp {} ~/RPMS \;
If you have copied the install CD or DVD to the hard drive, or have their ISO images on the drive (see Copy CD or DVD to Hard Drive on how to mount them), this can be done in one step.
In this example, the CD or DVD were mounted as /INSTALL_CD/
.
cd ~/RPMS genhdlist2
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 RPM's and copy them into ~/RPMS/pubkey
. They should be in INSTALL_CD/media/media_info
:
mkdir ~/RPMS/pubkey cp /INSTALL_CD/media/media_info/pubkey* ~/RPMS/pubkey/
then as root add the medium:
urpmi.addmedia local_rpms file://home/uid/RPMS/
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 terminal/console:
urpmi.addmedia --distrib ftp://'MIRROR_SITE'/mirror/mageia/distrib/'VERSION'/'ARCH'
in which:
- 'MIRROR_SITE' is the actual URL of the FTP-server
- 'VERSION' is the current or other version of your Mageia for which you want to the add the media
- 'ARCH' is one of: i586 or x86_64, or possibly others that do not exist for all Mageia versions (for example sparc, pcc, etc.)
Manually choosing a mirror
Mirrors are listed at http://mirrors.mageia.org/ -choose one close to you (in internet route measures)
The status page http://mirrors.mageia.org/status help in avoiding bad mirrors.
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'
Finding mirrors near you using rsync and urpmi to update
Please see: https://wiki.mageia.org/en/Finding_Mageia_rsync_servers
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 Mageia Cauldron (Be very careful with Cauldron 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.
You can use urpmi.update
like this:
urpmi.update nameofmedia
or
urpmi.update -a
The first example will update just the specified medium whereas the last command will update all media.
urpmi.removemedia
If you want to get rid of a repository, this is the command to use:
urpmi.removemedia nameofmedia
To remove all repositories:
urpmi.removemedia -a
urpmf
With urpmf
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 Template:Pkg, 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 that on your Mageia system, both versions should be installed: Mageia 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.
System update
Another example of using urpmi
is to update your system with the latest security updates/bugfixes:
urpmi --auto-update
The command above brings the system up-to-date do the same as the following command sequence:
urpmi.update -a && urpmi --auto-select
The &&
characters mean "IF the first command succeeds, then perform the second command". The first command (urpmi.update -a
) updates for all media the list of available software packages. The second command (urpmi --auto-select
) selects all available updates of already installed packages and initiates the update process. Urpmi
will list the upgradeable packages and ask if you wish to proceed. If you want to proceed, just type y for yes or n for no and then press Enter. When the update-process is finished installing you'll get a new prompt at the bottom.
If you prefer using a graphical userinterface ('GUI') use rpmdrake
in the Mageia Control Center: Software Management --> Look at available updates and apply any fixes or upgrades to installed packages
Installing a new / other kernel
If you have a separate /boot, make sure you have enough space:
$ df
Display running kernel:
$ uname -r
Display installed kernels (packages whose name begin with "kernel")
$ rpm -qa | grep ^kernel | sort
To list available kernels and versions: (and other packages that have "kernel" in them)
# urpmq -y kernel
"-y" is short for "--fuzzy"
Information on the different types: https://wiki.mageia.org/en/Kernel_flavours
Normally you should make sure you have corresponding "-devel-" package for your kernels. I.e if you have kernel-desktop-4.9.30-2.mga6, make sure you also have kernel-desktop-devel-4.9.30-2.mga6. It is needed for i.e linking the Nvidia driver.
Correspondingly there also exist "-source-" packages, but you normally do not need them: This is the source code of the most recent kernel available in the update source. 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 Template:Pkg as the kernel you are running, or else the drivers you compile will not work.
Other dependencies: If you have virtualbox installed, you should have "virtualbox-kernel-..." installed. And if you have "-latest" on your kernel you should also have the corresponding "virtualbox-kernel-...-latest package.
Automatic updates: If you have kernel packages that ends with "-latest", the latest kernel of that flavour will get automatically installed when you run normal uppdates. Make sure you have "latest" packages installed also for -devel- and -source- if you have it for your kernel, and vice versa. the "-latest" packages are installed by default - uninstall them if you do not want kernel be updated with normal updates.
To install a kernel:
Just urpmi that kernel - 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 new kernels. The default 'linux' stanza will boot the new kernel.
If you wish, you can instead use the rpmdrake GUI rpmdrake
to install a new kernel: Mageia Control Center --> Software Management --> Look at installable software and install software packages
.
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.
(An alternate and more flexible way may be to install urpmi-proxy http://wiki.mageia.org/en/Urpmi-proxy on one of your machines that is up most of the time. Then direct all Mageia systems (including the one that runs urpmi-proxy) to retrieve packages from that machine. That machine will then retrieve packages that any other machine asks for, and cache them, so when another machine asks for the same it is quickly retrieved from cache.)
So how to use urpmi --parallel? 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 Template:Pkg 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.
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@localhost root]# urpmq --list-media Core Release (distrib1) Core Release Debug (distrib2) Core Updates (distrib3) Core Updates Debug (distrib4) Nonfree Release (distrib11) Nonfree Release Debug (distrib12) Nonfree Updates (distrib13) Nonfree Updates Debug (distrib14) Tainted Release (distrib21) Tainted Release Debug (distrib22) Tainted Updates (distrib23) Tainted Updates Debug (distrib24) Core 32bit Release (distrib31) Core 32bit Release Debug (distrib32) Core 32bit Updates (distrib33) Core 32bit Updates Debug (distrib34)
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 yourusername]# urpmq vegastrike vegastrike // Great! There is a Mageia 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 yourusername]# 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 yourusername]# 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 yourusername]# 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
Mageia offers a set of nice graphical tools to perform the same tasks. Rpmdrake is the one called from Mageia Control Center to Add/Remove programs. There you also start update, and select repositories. See our official documentation.
manatools
A not yet complete rewrite of Mageia Control Center, added in Mageia 5 Try "mpan" or "mana" to launch.
dnfdragora
DNF is the rising star in package management. Dnfdragora is the graphical interface in progress in Mageia 6.
First you need to set up dnf as per https://wiki.mageia.org/en/Using_DNF Note that there are still a few quirks, see bugzilla, notably you need to update repos using command "dnf makecache" from command line Bug 20922
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 Mageia user (I know that all the Mageia users are clever, but let's assume that there is one gullible Mageia user somewhere, just for the sake of the 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: 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/DVD... 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.
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 yourusername]# 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 Mageia 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 Mageia software management applications:
- rpmdrake aka "Install & remove software"
- drakrpm-edit-media aka "Configure media sources for install & update"
- mgaapplet, 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
Starting from the Mageia 1 release 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 mgaapplet 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
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:
urpmi.addmedia core_src ftp://ftp.mirrror.com/mirror/mageia/distrib/6/SRPMS/core/release
and then you can install it:
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:
/usr/sbin/urpmi --install-src packagename
and you will get the unpackaged SRPM in ~/rpmbuild . Now you can rebuild your binary.
rpm-build -bb ~/rpmbuild/SPECS/packagename.spec
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 Mageia version using urpmi
Urpmi can also be used to upgrade your box to a newer version of Mageia: add the mirror's URL with the directory of the new versions packages to your urpmi configuration: Mageia 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 Mageia. Nearly everything you could want is available, if you have media enabled for nonfree and tainted: 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 Mageia 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! Preferably look for an rpmbuilt application and/or build an rpm yourself from a tarball that you find you should like to try on Mageia. There is help in this wiki for both (below !)
Compiling from source
Instead of the familiar trilogy of:
./configure make make install
you can use checkinstall
to generate an rpm:
./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
Rebuilding RPM'S
Built for another distro
An alien rpm can often be rebuilt for Mageia. Please refer to Packagers RPM tutorial.
From a newer Mageia release
In Mageia development release "Cauldron", there may exist a newer version you need of a program.
You can then often download that rpm and rebuild it to suit the Mageia release you run, see How_to_do_your_own_backports.
The proprietary drivers
The proprietary drivers are shipped in the non-free media. So always try the Mageia packages first. I.e for Nvidia enable the nonfree and nonfree_backport repos, and in MCC when you configure your Nvidia video card you will be asked if you wan to use nouveau or the Nvidia driver. 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!
Other places to learn more about urpmi
Below are other resources with more detailed information about urpmi:
man
pages: check the man pages for all the options. Those are the most up-to-date sources of information (Remember: they can also be opened in many browsers, just enter:man:urpmi
in the addressfield).- Upgrading with urpmi discusses upgrading Mageia from one major version to another using urpmi.