Disabling colour and “fancy” output in Debian's apt(8)


How to make apt(8) behave in dumb terminals.

The apt(8) utility was recently provided by Debian developers as an alternative tool to apt-* suite of utililties. The program is indeed an improvement to the older system, as its UI is fragmented across different executables. One trouble is though that apt(8) does not interact well with terminals with light backgrounds or with dumb terminals (for example in shell-mode in Emacs) by default, and the setting to disable the coloured fancy output is rather non-obvious. The effect is achieved using the following settings in /etc/apt/apt.conf:

Dpkg::Progress-Fancy "0" ;
Binary::apt::Dpkg::Progress-Fancy "0" ;
Apt::Color "0" ;

The trouble here is that the Dpkg::Progress-Fancy setting is not honoured by the apt(8) utility, and the need to use the Binary::apt::Dpkg::Progress-Fancy setting is not mentioned in the apt.conf(5) man page, where the “BINARY SPECIFIC CONFIGURATION” section read like the former setting should apply to all binaries, in which case the latter one would be superfluous. But in reality, even though the general setting works when set at the command line like apt -o Dpkg::Progress-Fancy=0 <command> the setting works, it does not when set from the configuration file. This is the situation both with apt(8) in stretch and current unstable (apt/1.6~alpha7) I believe this is a bug, thus I’ve reported it to the bug tracker.

Edit (28 Feb 2018): Changed apt(1) to apt(8).