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: dpkg-reconfigure asks a package's apt install questions again

Apt
~/tips/tip-apt-dpkg-reconfigure

sudo dpkg-reconfigure tzdata

Reruns the setup questions of an installed package, like time zone or locale.

Some packages ask questions when apt installs them: the time zone, the locales, the mail server type. If you picked wrong or skipped them, dpkg-reconfigure brings the questions back.

Name the package that asked:

sudo dpkg-reconfigure tzdata
sudo dpkg-reconfigure locales
sudo dpkg-reconfigure -plow unattended-upgrades

The first sets the time zone through a menu, the second picks which locales to generate and the default. The third uses -plow to show every question, including the low priority ones that a normal install skips.

I find it more reliable than editing the config files by hand, because the package’s own script writes all the related files in the right format.

For scripts there is a non-interactive mode. You set the answers in the debconf database first, then reconfigure without a menu:

echo 'tzdata tzdata/Areas select Europe' | sudo debconf-set-selections
echo 'tzdata tzdata/Zones/Europe select Amsterdam' | sudo debconf-set-selections
sudo dpkg-reconfigure -f noninteractive tzdata

It only works for packages that use debconf, so for many packages nothing happens. And it can overwrite changes you made by hand in that package’s config files, since the script writes them again from the answers. Keep a copy of those files first if you’ve customised them.

Further reading: dpkg-reconfigure(8) manual page

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