Date created: Tuesday, January 21, 2020 8:50:16 AM. Last modified: Sunday, February 19, 2023 2:20:12 PM
'apt' & 'dpkg' Notes
List installed packages:
apt list --installed
or
aptitude search '~i!~M'
or
dpkg --get-selections | grep -v deinstall
Disable auto-updates in Ubuntu:
# For Ubuntu 18 and 20:
$cat /etc/apt/apt.conf.d/20auto-upgrades APT::Periodic::Update-Package-Lists "0"; APT::Periodic::Download-Upgradeable-Packages "0"; APT::Periodic::AutocleanInterval "0"; APT::Periodic::Unattended-Upgrade "0";
# As of Ubuntu 22 this doesn't work anymore.
# One can remove the updata-manager programe which creates the constant anying prompts to update:
$ sudo apt remove update-manager
# Restore it with:
$ sudo apt install update-manager
Export and install a list of packages:
dpkg --get-selections | grep -v deinstall > ~/Desktop/packages
sudo dpkg --set-selections < ~/Desktop/packages && sudo apt-get -u dselect-upgrade
Force apt to use IPv4 or IPv6:
apt-get -o Acquire::ForceIPv4=true update
apt-get -o Acquire::ForceIPv6=true update
Run apt with debug logging enabled:
apt-get -oDebug::pkgAcquire::Worker=1 update
Previous page: Allow sudo command without password
Next page: Bash Profile