Make your own free website on

My Debian Tips:

File Systems
Storage Devices

[Tips Home] [Home]

Valid HTML 4.01!

Tips on working with Packaging Commands on Debian Linux:

Search for a specific package installed on your system

You might probably be using, "dpkg -l | grep 'gnome'". But do you know that you can also use, dpkg -l "gnome*"

If the long package name is getting truncated, and you later need to use the -L option for the specific package, get the listing with this command, dpkg-awk "Status: .* installed$" -- Package | cut -d: -f2 You might use this to search by keyword for packages to install,apt-cache search

Long package names getting truncated in package listing?

export COLUMNS=200; dpkg -l

Build the kernel in debian way using 'make-kpkg'

You can do a make menuconfig; make dep; make clean; make bzImage, but to do all these in a debian way - Configure it the normal way and do make-kpkg --revision= kernel_image This will build a debian package. For example, if you ran this on a linux-2.4.16 kernel, the file of the package would be named kernel-image-2.4.16_rev1_i386.deb Once you have the .deb file, install it using 'dpkg -i'. After the package installation, cross-check /etc/lilo.conf and /sbin/lilo -v before rebooting.

Worried of handling the 7500+ packages in so many installation CDs?

The newer distributions come with a bunch of CDs (woody has 7 CDs !) which will become a pain once you start playing around the system. Use 'apt-cdrom add' on each CD one time and update the cache in 'dselect'. From then onwards, use only dselect and your life would become much much simpler. This may appear silly, but you will know of the difficulty only if you don't know this!

Want to rebuild the "dselect" database if something really goes wrong?

you either select to remove to lots of critical packages or select to install a boat load of stuff that you don't want?

perl -i.bak -pe 'if (/^Status: [^\s]+ ([^\s]+) ([^\s]+)/) { $_="Status: ".($2 eq "installed" ? "install" : "purge")." $1 $2\n"}' /var/lib/dpkg/status

Want to place a hold on a package during apt or dselect?

This is how you can have a package permanently ignored during updates:

echo "<package> hold" | dpkg --set-selections

What's the best way to install a non-debian package (tar source file downloaded from somewhere)?

The preferred directory to install is /usr/local. Give a try to use 'checkinstall' once, which creates a deb package, and installs in /usr/local/. You can then use the normal dpkg commands to view or delete the package on your system. You can even install the .deb package on other systems. To use this, compile your programs normally using .configure and make. After that, instead of running "make install", run checkinstall.

Checkinstall debs are available for download at: here or here (or ask me!)

How to remove any lingering packages in your list?

# dpkg --get-selections|sed -e 's/deinstall$/purge/'|dpkg --set-selections apt-get dselect-upgrade

Installing another system and want to have the same set of packages on your current system (or just want to take a backup of your packages)?

On the machine that you already installed woody with a bunch of packages do,

dpkg --get-selections | sed -e 's/hold$/install/' > yourpkgs.list

The sed ensures that the packages even on hold get installed properly (take it out if you don't want this). Take this file to the other system where you just installed with a fresh woody.

dpkg --set-selections < yourpkgs.list

Start inserting the woody cds (or the appropriate sources) and do apt-get dselect-upgrade

Did you lose a particular file from your debian package?

dpkg -S <file> to see which package installed the lost file. You can then try a dpkg-reconfigure $package to see if reconfiguring the package will reinstall the affected file. If reconfiguring does not work, try reinstalling the affected package again.

apt-get -d $package
cd /var/cache/apt/archives
dpkg -i $package

Want to extract the package files but don't want to install?

apt-get install --download-only your_pkg.deb
dpkg -x /var/cache/apt/archives/your_pkg.deb your_directory

How do I know what package contains the file I am looking for?

Easy way is to search at Debian or

apt-cache search your_file | less (and get your package_name)
apt-cache show your_package

How do I create artificial dependencies between packages?

You want the "equivs" packag. This helps you to create dummy Debian packages, which only contain dependency information. This way, you can make the Debian package management system believe that equivalents to packages on which other packages do depend on are actually installed. Say package X depends on Y, but you can't or don't like to install Y, use equiv - fake the system to believe that Y is actually installed. But use this at your risk.

How do I set up apt-get to use a proxy to connect?

Enter these lines in your .profile or .bash_profile,

export http_proxy=http://proxy_host:port/
export ftp_proxy=$http_proxy

(The trailing slash is very important!)

What are the typical entries in /etc/apt/sources.list ?

Below are the typical entries for the testing release (woody) which includes non-US stuff also.

deb testing main contrib non-free
deb testing/non-US main contrib non-free

Here are the typical entries for the stable release,

deb stable main contrib non-free
deb stable/non-US main contrib non-free
deb stable/updates main contrib non-free

Is there any GUI interface for dselect, apt, ... ?

'stormpkg' provides all the GUI functionality under Gnome. Try it out. It's cool!

[HOME] Last Updated: Apr' 2002
Any comments to the author?