Main Page‎ > ‎

Apt dpkg

The most useful dpkg commands I use:

dpkb-buildpackage -b COLUMNS=200 dpkg -l package\* COLUMNS=200 dpkg -l package\* | grep ^ii dpkg-reconfigure -plow package

The most useful apt commands I use:

apt-get update; apt-get dist-upgrade -u apt-get --purge remove package apt-cache search key1\* key2\* apt-get showpkg php4-imap apt-get update; apt-get dist-upgrade -u

Other tricks I learned

  • get rid of orphans packages
deborphan | sed 's/$/ purge/' | dpkg --set-selections deborphan | sed 's/$/ remove/' | dpkg --set-selections apt-get dselect-upgrade
  • how to prevent update:
echo package hold | dpkg --set-selections
  • how to revert the hold:
echo package install | dpkg --set-selections
  • in order to load all the dependances of a specific package apt-get build-dep package
  • if postinstall or postrm fails these scripts can be modified by editing the /var/lib/dpkg/info/ files
  • search for a specific file
apt-file update apt-file search file
  • force reinstallation
apt-get install --reinstall package
  • remove config files after a remove:
apt-get remove --purge package apt-get remove package dpkg -l | grep ^rc dpkg --purge package si apt-get remove seulement
  • install a package elsewhere: a deb archive is a simple ar archive!
package=mplayer mkdir /opt/$package cd /opt/$package ar x ${package}*.deb tar zxpvf data.tar.gz rm data.tar.gz control.tar.gz debian-binary

check in control.tar.gz that there is no pre/postinstall script

mkdir -p /opt/var/lib/dpkg touch /opt/var/lib/dpkg/status mkdir /opt/var/lib/dpkg/updates touch /opt/var/lib/dpkg/available mkdir /opt/$package dpkg --root=/opt/$package --admindir=/opt/var/lib/dpkg --instdir=/opt/$package -i ${package}.deb dpkg --root=/opt/$package ${package}*.deb -i ${package}.deb
  • interesting packages if you want to be aware of known bugs or changes when you are updating

apt-listchanges |

  list important changes when performing an apt-get upgrade

apt-listbugs |

  critical/severe bugs are displayed whend apt-get install/upgrade/dist-upgrade

deborphan |

  list libraries not utilized by any packages
  • using a proxy with atp (i.e. not related to apt-proxy, e.g. behind a firewall): 2 solutions
  1. either use http_proxy and ftp_proxy variables
  2. or in /etc/apt/apt.conf hardcode these values
find to which package this file belong
dpkg -S /bin/ls
  • to solve a recent issue when using wwwoffle and an apt-get update to avoid a "Error reading from server Remote end closed connection", add in /etc/wwwoffle/wwwoffle.conf:
reply-chunked-data = no
  • retreive packages required to recompile a package following the dependencies:
 apt-get build-dep <package>
Comments