RPM FREQUENTLY ASKED QUESTIONS General Information about RPMs Q: What is rpm? A: RPM Package Manager is a convenient way to distribute software for Linux systems. Q: What is a package? A: A package is simply a collection of files bound together within an rpm file. "Source rpms" are used to distribute the original source code of an application and are identified by their suffix, ".src.rpm" "Binary rpms" are pre-compilied for a specific type of machine architecture with a suffix that depends on the architecture; usually, "i586.rpm" for Mandrake users. Q: Where do I find more detailed information about rpms? A: There are four very good sources, read them in this order: the man page, the HOWTO at http://linuxdoc.org/HOWTO/RPM-HOWTO/index.html, the Mandrake RPM HOWTO at http://www.mandrakelinux.com/howtos/mdk-rpm/, and the RPM book from O'Reilly. Q: What is the purpose of this document? A: Really short, quick answers for future Mandrake-Linux Guruz! Q: Should I get an i686 rpm because it is better then an i586 rpm? A: The origin Pentium processor is the "i586" architecture. The Pentium II/III/IV processors are all "i686" architectures. All of these are backwards compatible with previous architectures. You'll find lots of "i386" rpms around that will work with any processor. Q: Should I install an rpm that I found on some website? A: Generally speaking, stick to mandrake-provided rpms. And when possible, stick to rpms that within your version of mandrake (ie: installing random rpms from 8.2 might not work well with your 8.1 system) Q: What about rpmfind.net? A: I think rpmfind.net is useless with a mandrake installation. All it does is help you find the wrong version of the software you actually want. Look at the urpmi FAQ elsewhere on this site for a better way to find rpms. Q: All rpm commands hang, including urpmi, rpmdrake, and MandrakeUpdate, what's up with this crap? A: A previous rpm command was interrupted (see my page on kill -9) and left behind database lock files. 'rm -f /var/lib/rpm/__*; rpm --rebuilddb' should fix you up. Installing, Uninstalling, and Updating Packages Q: How do I install foo.rpm? A: rpm -Uvh foo.rpm Q: How do I uninstall package foo? A: rpm -e foo ('e' for erase) Q: Which files are installed with foo.rpm? A: rpm -qlp foo.rpm Q: I can't install foo.rpm because it requires bar.rpm, but bar.rpm requires foo.rpm. How do I install them if neither will install first? A: rpm -Uvh foo.rpm bar.rpm Q: Why does 'rpm -e foo-4.5-1.i386.rpm' fail? A: Don't confuse a *filename* with a *package name*. Try 'rpm -e foo'. Q: Where do I find randomfoo.rpm? I already know it's not on the CD. A: rpmfind.net Q: randomfoo.rpm requires randombar.rpm, which I don't have. Can I just use --force? A: No. Whoever made randomfoo.rpm is saying that you *require* randombar.rpm Q: I tried installing another src.rpm, i didnt see it in the list of rpms 'rpm -qa', should it have? A: Nope, source rpms installed with -i simply copy the source and spec file to /usr/src/RPMS. This is for developers wanting to play with the source code. Q: How do I install a source rpm named foo.src.rpm? A: Refer to the "Building Packages" section Q: What is this -Uvh stuff? A: "U" is "Upgrade" which is the same as install but will uninstall a previous version of the same package if needed. This is handy if you can't uninstall a package because of it's dependencies. "vh" prints a nice verbose progress bar. Q: I'm getting errors about missing GPG keys, what can I do? A: The real trick here is just finding the key. Official Mandrake keys are easy to find, others might be on a keyserver or a website. For Mandrake packages: rpm --import http://www.mandrakesoft.com/security/RPM-GPG-KEYS For PLF packages: rpm --import http://plf.zarb.org/plf.asc If that doesn't do it, then follow this procedure to try finding it on a popular keyserver. First look at the missing keyid, it's 8 letters and numbers. gpg --keyserver pgp.mit.edu --recv-key $keyid gpg --armor --export $keyid > $keyid.asc rpm --import $keyid.asc You might also look at the website where you downloaded this rpm for a matching key and import it with 'rpm --import'. Querying Packages Q: How do I list all installed packages? A: rpm -qa | less Q: Which files are installed from package foo? A: rpm -ql foo Q: Which package owns the file /foo/bar? A: rpm -qf /foo/bar Q: What is this package foo.pm? A: rpm -qip foo.rpm Q: When do I use the -p option? A: Use the -p option when you want to query directly against an rpm file. Without -p, rpm will query the rpm database (information about all of the rpms that are actually *installed* on your system) Q: How do I customize the query output? A: First, do 'rpm --querytags' to list all of the valid query tags. Second, 'rpm -q --queryformat %{TAGNAME} foo' For example, 'rpm -q --queryformat %{VENDOR} textutils' prints "MandrakeSoft". Q: What packages and files are needed before I can install foo.rpm? A: rpm -qp --requires foo.rpm Q: What packages are going to break if I uninstall package foo? A: rpm -q --whatrequires foo Q: I deleted /foo/bar/something and now I want it back, what rpm should I reinstall? A: (mandrake only) urpmf /foo/bar/something Q: How do I extract a single file out of an rpm file? A: For example, pull "Xvfb" out of "XFree86-Xvfb-4.3-1gs.i686.rpm": $ cp XFree86-Xvfb-4.3-1gs.i686.rpm /tmp/ $ cd /tmp $ rpm -qlp XFree86-Xvfb-4.3-1gs.i686.rpm /usr/X11R6/bin/Xvfb /usr/X11R6/man/man1/Xvfb.1x.bz2 $ rpm2cpio < XFree86-Xvfb-4.3-1gs.i686.rpm | cpio -id ./usr/X11R6/bin/Xvfb 8486 blocks $ ls -al /tmp/usr/X11R6/bin/Xvfb -rwxr-xr-x 1 garrick sysadmin 4341592 Aug 25 14:21 /tmp/usr/X11R6/bin/Xvfb Building Packages (all commands in this section are never run as root!) Q: How do I install a source rpm named foo.src.rpm? A: As a *non-root* user, 'rpm --rebuild foo.src.rpm' Near the end of the output, you'll see something like: Wrote: /home/luser/rpm/RPMS/i586/foo.i586.rpm That is a new binary rpm built specificially for your system, install it with 'rpm -Uvh /home/luser/rpm/RPMS/i586/foo.i586.rpm' Q: This isn't working! 'rpm --rebuild foo.src.rpm' just gave me "/usr/lib/rpm/rpmb: No such file or directory" A: 'su -c "/usr/sbin/urpmi rpm-build"' Q: The command above just errored with "cannot write to %sourcedir yadda yadda". What gives? A: You need to create the required build directories and two small config files in your home directory. Run these commands: wget http://speculation.org/garrick/setup_rpm_files.sh sh setup_rpm_files.sh Q: Is it safe to build packages as root? A: A huge resounding, "NO!!" As part of the build process, the software gets installed so that the rpm package can be created correctly. It's important that that process happens in a controlled, non-priviledged environment. Q: I'm getting "warning: user blahbla doesn't exit"? A: Ignore it. Files in the source rpm were owned by "blahbla" when it was created. Your machine doesn't have a user "blahbla" so a warning is printed. (Also, see the previous question) Q: I'm trying to compile some random program and it's complaining that some random lib isn't install, I've installed the lib but it's still complaining A: All libraries are split between two rpms, the "run-time" version and the "build-time" version. The run-time version only contains the few small files required to _run_ an application that needs the library. The build-time version is a lot larger, it has static libs and header files need to compile a program that needs the library. The build rpms have "-devel-" in the name. For example, your program is asking for libXpm or the "Xpm library". First thing I would do is check for a package with that name: $ urpmq libXpm The following packages contain libXpm: libxpm4 libxpm4-devel $ su -c "/usr/sbin/urpmi libxpm4-devel" Here's another example, say we want libXrender. $ urpmq libXrender no package named libXrender $ urpmf lib/libXrender XFree86-libs:/usr/X11R6/lib/libXrender.so.1 XFree86-libs:/usr/X11R6/lib/libXrender.so.1.1 XFree86-devel:/usr/X11R6/lib/libXrender.so XFree86-static-libs:/usr/X11R6/lib/libXrender.a $ su -c "/usr/sbin/urpmi XFree86-devel"