Don Marti

Fri 16 Jan 2009 01:13:23 PM PST

Debian package cheat sheet

Which package provides a certain file?

$ dlocate -S /usr/bin/xeyes
x11-apps: /usr/bin/xeyes
$ dpkg -S /usr/bin/xeyes
x11-apps: /usr/bin/xeyes

Which files does a given package provide?

$ dpkg -L x11-apps

Which repository provided a package?

$ apt-cache policy x11-apps

Which version of a package is installed?

This also lists a bunch of other info:

$ dpkg -s x11-apps

Even more info on a package?

$ apt-cache show x11-apps

How do I catch up on new packages without installing?

$ sudo apt-get update && \
sudo apt-get autoclean && \
sudo apt-get -dy --force-yes dist-upgrade

How do I update the GPG keys that apt knows about?

If you get this error:

"The following signatures couldn’t be verified
because the public key is not available"

First get the relevant public key:

gpg --recv-keys 9AA38DCD55BE302B

At this point you have a new key that you don't know whether to trust or not. Check it with the GPG --check-sigs option.

Then add it with the apt-key command:

gpg --armor --export 9AA38DCD55BE302B | apt-key add -

(thanks to Nasser Heidari)

More info: All about secure apt

How do I make a custom kernel package?

Keep kernel source in your home directory, not /usr/src. Do everything as non-root. The final "sudo" will install the finished package as root.

$ cd linux-*
$ ketchup -r
$ make oldconfig  # always do this even it it doesn't seem
                  # to do anything on a stable release.
$ make menuconfig # optional
$ make-kpkg --rootcmd fakeroot clean && \
    make-kpkg --rootcmd fakeroot kernel_image 
$ cd ..
$ sudo dpkg -i kernel-image*.deb

More Debian package management commands?

APT and Dpkg Quick Reference Sheet by Matthew Danish