From Knoppix Documentation Wiki
Jump to: navigation, search

This is the "canonical" or "official" utility/command for managing Deb files or Debian Packages. It is one of several package management utilities available in Knoppix. Dpkg can be used to install, uninstall or view information about .deb or Debian packages.

Instructions for using dpkg may be found by typing "man dpkg" at a console. The manual can also be found online at various places such as: man dpkg (dead link). Like any versatile Linux utility, the manual is very, very long, and dpkg has many, many options. The examples below show typical uses of dpkg within Knoppix.

To install a .deb package

  • To install a .deb package, superuser or root privileges are needed. Open a Knoppix console and type either of the commands below:
sudo dpkg -i packagename
sudo dpkg --install packagename
  • This next example shows a command to force an install, ignoring dependencies and other problems:
sudo dpkg --install --force-all packagename 

In this case, dpkg will install the package while printing a lot of error messages. In general, forcing an install is not a wise thing to do. A package which has been force-installed without its dependencies is said to be "broken". Broken packages may lead to instability. Package management tools such as synaptic will refuse to work further until they are allow to fix the broken package. So why would you resort to a force-install?

If you have Gebi in your system, you can install a package opening your file manage (i.e. Nautilus) and clicking in the *.deb file icon.

To unistall a .deb package

  • To uninstall a .deb package, also needs superuser or root privileges. Open a console and type either of these commands:
su dpkg -r packagename
su dpkg --remove packagename
  • The above leaves behind configuration files. To totally purge everything from your system including configuration files, use either of these commands:
su dpkg -P packagename
su dpkg --purge packagename

Other uses of dpkg

  • To list all the files in a package
dpkg -L packagename
  • To install a package of a particular release ( assuming it's in your sources.list ).
apt-get install -t unstable packagename
  • Tells the status (hold, purge etc..) of the package.
dpkg --get-selections <package name>
  • To show anything in database with the package name.
dpkg -l ¦ grep <package name>
  • To deinstall the package with all configuration files.
dpkg --purge <package name>
  • To save or edit your packages status use
dpkg --get-selections > currentselections.txt 

re-directs your packages to the file, to restore list

dpkg --set-selections < currentselections.txt 


apt-get update 

to refresh then

apt-get upgrade 

to make the changes , also can be used to keep your current settings on any install just restore the list to the new install and

apt-get update 

and upgrade or dist-upgrade and you will have the same software packages on the new install.

  • To put a package on hold
echo packagename hold | dpkg --set-selections
  • To take a package off hold
echo packagename install | dpkg --set-selections
  • To list the version of an installed package
apt-cache policy packagename | grep Installed
  • To list packages containing a certain string in its package name, version or description
COLUMNS=120 dpkg -l | grep string