APT – Advanced Package Tool

Updated 09-Oct-2024

APT -- Advanced Package Tool -- is all that is needed for most application installations when there are repositories which are regularly updated for packages of interest.

Note that apt essentially makes irrelevant apt-get so there is no reason for that redundancy any longer.

Note: Use aptitude when dealing with packages that have upgrade/downgrade issues, as aptitude provides better options for resolving issues. Use the -f flag with aptitude if the downgrading is out of hand.

If packages are kept back, simply install them directly with the install command. Use -f to force dependency upgrade.

Additional Note: Use apt or aptitude to install .deb packages including the ./ before packagename, as in:

sudo apt install ./packagename

stable, backports, testing, unstable repos

For a stable system, using stable (or oldstable) and backports ensures stability. However, it doesn't deal with new hardware issues, or any kind of additional functionality, such as adding updated applications. For this, it is a matter of tracking down external packages, or using the testing or unstable repositories.

Note that mixing repos is discouraged by debian and may result in breakage. See also choosing a distribution.

Currently, my main desktop is tied to an oldstable release to keep an older printer working properly.

I do expect to be running Debian 10, and Debian 11 (aka stable and test)more or less parallel (backup desktop, server, primary desktop).

Apt pinning

Upgrading the linux kernel using apt

Update Repositories

sudo apt update -y 
sudo apt update -y -t stretch-backports

Upgrade Applications

sudo apt upgrade -y --fix-missing
sudo apt upgrade -y -t stretch-backports --fix-missing

Broken Dependencies

sudo apt install -f

also

sudo apt --fix-broken install

Upgrade Distributon (e.g, Debian Stable)

sudo apt dist-upgrade -y --fix-missing

Clean, Autoclean, Check, Autoremove

All these commands can be run from apt. In particular, autoremove is a good option to keep things tidy.

sudo apt autoremove -y

Purge and Remove

To seriously remove things, do:

sudo apt --purge remove package-name

Sources

Sources are found in a few places:

sudo nano /etc/apt/sources.list

Current stable/backports sources:

deb http://deb.debian.org/debian/ bookworm main contrib non-free non-free-firmware
deb http://security.debian.org/debian-security bookworm-security main contrib non-free non-free-firmware
deb http://deb.debian.org/debian/ bookworm-updates main contrib non-free non-free-firmware
deb http://ftp.debian.org/debian bookworm-backports main contrib non-free non-free-firmware
ls /etc/apt/sources.list.d

Current additional sources (note, see extrepo below for making these obsolete):

element-io.list
home:ungoogled_chromium.list
signal-xenial.list
syncthing.list
vscodium.list

Extrepo

Extrepo allows one to enable known external repositories, using a tool extrepo. Extrepo writes the necessary keys (to /usr/share/extrepo/offline-data/debian/...) and repositories (to /etc/apt/sources.list.d/...).

Install from apt, then enable and update various sources, for example:

sudo extrepo enable postgresql
sudo extrepo enable nginx
sudo extrepo enable signal
sudo extrepo enable vscodium
sudo extrepo enable openvpn
sudo extrepo enable syncthing
sudo extrepo enable steam
sudo extrepo enable sury

sudo extrepo update postgresql
sudo extrepo update nginx
sudo extrepo update signal
sudo extrepo update vscodium
sudo extrepo update openvpn
sudo extrepo update syncthing
sudo extrepo update steam
sudo extrepo update sury

Note: I seem to have to run these commands twice through, to get it to enable and update, at least the first time.

extrepo architecture error

Sometimes there is an architecture error, such as noted in this merge request: https://salsa.debian.org/extrepo-team/extrepo-data/-/merge_requests/313, if it isn't removed upstream, simply edit the repository file found in /etc/apt/sources.list.d/... and remove the offending architectures.

see also

extrepo man page

Resources

Note: mixing repositories is not needed and generally discouraged (called franken-distributions). Stable for servers, testing for desktop.