I began this page many years ago when I was switching from Redhat-based distros to Debian.
Last updated 2024-06-01.
grep " install " /var/log/dpkg.log{,.1} | less
aptitude query terms: https://www.debian.org/doc/manuals/aptitude/ch02s04s05.en.html
Reduce the wait for "a stop job is running": edit /etc/systemd/system.conf change DefaultTimeoutStopSec
dpkg --print-foreign-architectures:
print other architectures that have packages installesm like x85
for wine.
dpkg -l |grep 386
apt list '~i!(~i~ramd64)'
aptitude search '?narrow(~i, ?architecture(i386))'
apt-get purge ".*:i386"
(but that doesn't work because
libgcc-s1:i386, gcc-14-base:i386 and libc6:i386 are essential system packages)
apt-get purge ".*:i386" --allow-remove-essential -f
A useful place to check when a package is broken: the Debian Package Tracker which can tell you if there are known ongoing issues in a package.
When a specific package is preventing upgrades — perhaps it's
suggesting that you apt --fix-broken install but
you can't because a package that needs to be removed is broken
and won't let you remove it — try this:
dpkg --purge --force-all broken-package-name apt --fix-broken install
Go to packages.debian.org and click on changelog (in the right sidebar under Debian Resources) to see recent activity.
Or go to https://tracker.debian.org/pkg/packagename
More generally:
for installed packages, apt why packagename or
apt why-not packagename can be helpful (aptitude
also has these commands, and might show more detail). But when a
full-upgrade looks like it will cause problems, like a long
"The following packages will be REMOVED:" list,
aptitude full-upgrade will give a lot more detail than
apt, and give you possible resolutions.
But sometimes no resolution is possible besides removing a bunch of packages. When that happens, try looking at https://tracker.debian.org/pkg/packagename to see if there's anything under news or testing migrations. It can also be useful to look at release.debian.org/transitions/ and see whether any of the Ongoing transitions relate to the problem you're seeing.
When an upgrade breaks a package, if it's a simple standalone package, try searching for the package on snapshot.debian.org and then follow the steps in RollbackUpdate. For example:
After one sid upgrade,
emacs-common-1:28.1+1-1 didn't install because of a segfault in postinstall.
Searching for emacs-common on
snapshot.debian.org
gave me
emacs-common 1:27.1+1-3.1
with a time of 2021-03-28 03:00:02,
so I added the following line to /etc/apt/sources.list:
deb [trusted=yes] https://snapshot.debian.org/archive/debian/20210328T030002Z/ sid main(The [trusted=yes] may not be needed.)
You can't just apt update that: it will complain
Release file for https://snapshot.debian.org/archive/debian/20210328T030002Z/dists/sid/InRelease is expired (invalid since 503d 15h 39min 30s). Updates for this repository will not be applied.so instead, do:
sudo apt -o Acquire::Check-Valid-Until=false updateas suggested on the home page of snapshot.debian.org. Then you can try installing your package:
sudo apt install emacs-gtk=1:27.1+1-3.1If it complains that there are unmet dependencies, you may need to install the dependency as well. For emacs, I went through several iterations and ended up with:
sudo apt install emacs-gtk=1:27.1+1-3.1 emacs-common=1:27.1+1-3.1 emacs-bin-common=1:27.1+1-3.1
But you may find more dependencies later. I found that apt was still
unhappy, and by running various apt commands I eventually elicited
the error message from apt autoremove:
You might want to run 'apt --fix-broken install' to correct these. The following packages have unmet dependencies: emacs-bin-common : Depends: emacs-common (= 1:28.1+1-1) but 1:27.1+1-3.1 is installed emacs-gtk : Depends: emacs-bin-common (= 1:27.1+1-3.1) but 1:28.1+1-1 is installed E: Unmet dependencies. Try 'apt --fix-broken install' with no packages (or specify a solution).which I fixed with an
apt install emacs-bin-common=1:27.1+1-3.1after which apt seemed happy.
The APT HOWTO has instructions on "pinning" and other details of maintaining a mixed debian system (e.g. stable but using some packages from unstable). It also shows how to pin a package so it will not be upgraded (for instance, if you've made local changes).
deborphan and debfoster are great for finding orphaned and unneeded packages which can be removed.
You can pull from a different repository by editing /etc/apt/sources.list to replace "stable" with "unstable" (or whatever) then doing apt-get update. That gets old, though, so here's a better way: pinning. Here's a sample unstable preferences file.
apt install build-essential fakeroot devscripts apt build-dep packagename apt source packagename cd [dirname] debuild -b -uc -us
If you need to pull a source package manually rather than using
apt source,
find the package on
packages.debian.org,
note the dsc link, then fetch it with
dget -x url://to/foo.dsc
which will download two tarballs and extract one inside the other.
Several different ways to see your apt history:
awk '!/^Start|^Commandl|^End|^Upgrade:|^Error:/ { gsub( /\([^()]*\)/ ,"" );gsub(/ ,/," ");sub(/^Install:/,""); print}' /var/log/apt/history.log
grep " install " /var/log/dpkg.log
You can also sort /var/cache/apt/archives by create
date: ls -ltc /var/cache/apt/archives | less
you can get a list of packages in reverse order of when they were
downloaded. There's also /var/log/apt/term.log; I'm not sure
how it relates to dpkg.log.
To see packages removed recently, try
grep remove /var/log/dpkg.log
mandb -c does what makewhatis used to do in other distros and other Unices -- builds the whatis/apropos databases. It's part of the man-db package.
Printing changes all the time and varies among distros and versions. When I learn something new and relevant about printing, I usually blog about it, so see my blog articles tagged 'printing'.