brewedbits.dev

Personal blog with guides and news on selfhosting, Linux and AI, from the Netherlands

nextDash nextdash --aboutYour bookmarks. Your terminal. checks your links knows your Docker host one container, no cloudLive demo →nextdash.cc ↗

Tip: /var/log/apt/term.log keeps the full apt output, error messages included

Apt
~/tips/tip-apt-term-log

sudo less /var/log/apt/term.log

Shows the full terminal output of past apt runs, including install script errors.

history.log tells you which packages apt changed. When an install script failed or printed a warning you didn’t read, you need the other log in the same folder.

term.log records everything apt and dpkg printed to the terminal, run by run:

sudo less /var/log/apt/term.log
sudo grep -n -i -E 'error|warning' /var/log/apt/term.log | tail
sudo zgrep -h 'Log started' /var/log/apt/term.log*

Each run starts with a Log started: line and a date, and ends with Log ended:. In between you’ll find the output of the maintainer scripts: services being restarted, config files kept or replaced, and the exact error when a post-install script fails.

This is where I’d go when an unattended upgrade left something odd behind. Nobody was watching that run, so this file is the only place its output exists. The second command is a quick scan for trouble, and the third lists when every run happened, including the rotated logs.

The file contains raw terminal output, so progress bars appear as long lines with lots of repeated text, and less may show control characters. Use less -R if colours garble the view. Old logs are rotated and compressed, which is why zgrep searches across all of them here. And depending on the system, you may need sudo to read it.

Further reading: apt.conf(5) manual (Dir::Log)

More Apt tips sudo apt-mark minimize-manual apt list '~c' grep -E ' (install|upgrade|remove) ' /var/log/dpkg.log | tail -o Dpkg::Options::="–force-confold" upgrade sudo apt-get -d -y full-upgrade All Apt tips (42) All topics

Link