Debian

How To Install and Use add-apt-repository on Ubuntu and Debian

add-apt-repository: command not found is usually the first thing you see when you try to add a PPA on a container or a minimal install. The command ships in the software-properties-common package, which stripped-down images leave out, and whether that package even exists depends on which distribution and release you are running.

Original content from computingforgeeks.com - post 4962

This guide installs add-apt-repository, then uses it for the jobs it is actually good at: adding and removing PPA repositories, enabling source packages, and listing what is configured. It also covers the part most older guides skip. On Debian 12 the tool needs an extra package and silently fails on deb822 systems, and on Debian 13 the package is gone from the archive entirely, so the last section shows what to use instead. Everything here was run in August 2026 on Ubuntu 26.04 and 24.04, with Debian 13 and Debian 12 verified in containers.

Install add-apt-repository on Ubuntu

Ubuntu server and cloud images ship the package preinstalled. Minimal images, Docker and LXC containers, and stripped-down builds do not, and any PPA instruction fails immediately:

bash: add-apt-repository: command not found

The fix is one package:

sudo apt update
sudo apt install software-properties-common

That pulls in the Python bits the command is built on. Confirm it landed:

dpkg -l software-properties-common | tail -1

On Ubuntu 26.04 you get the 0.119 build, on 24.04 the 0.99.49 line:

ii  software-properties-common 0.119        all          manage the repositories that you install software from (common)

Both releases behave the same way in the sections below. This also holds on systems upgraded from an older LTS, since the upgrade keeps the package.

Add a PPA Repository

A PPA is a personal repository hosted on Launchpad, and this is the command’s main job. The deadsnakes PPA is a good live example because it publishes Python builds Ubuntu does not carry. Add it with -y to skip the confirmation prompt:

sudo add-apt-repository -y ppa:deadsnakes/ppa

The tool prints the PPA description, imports the signing key, writes the repository definition, and refreshes the package cache on its own. There is no separate apt update step anymore, and no apt-key involvement. If you want to add the entry without the automatic cache refresh, append -n.

Adding deadsnakes PPA with add-apt-repository on Ubuntu 26.04 showing the deb822 .sources file with inline signing key

What gets written has changed since the older guides were current. Instead of a one-line .list file plus a key in /etc/apt/trusted.gpg.d/, current Ubuntu writes a deb822 .sources file with the PGP key embedded in the Signed-By field:

cat /etc/apt/sources.list.d/deadsnakes-ubuntu-ppa-resolute.sources

The stanza carries the repository and its trust anchor in one file, scoped to that repository alone:

Types: deb
URIs: https://ppa.launchpadcontent.net/deadsnakes/ppa/ubuntu/
Suites: resolute
Components: main
Signed-By:
 -----BEGIN PGP PUBLIC KEY BLOCK-----
 ...
 -----END PGP PUBLIC KEY BLOCK-----

From here the PPA behaves like any other source. Check what it offers for a package you care about:

apt-cache policy python3.13

The PPA candidate outranks the archive build that is installed:

python3.13:
  Installed: 3.13.12-1ubuntu1
  Candidate: 3.13.15-1+resolute1
  Version table:
     3.13.15-1+resolute1 500
        500 https://ppa.launchpadcontent.net/deadsnakes/ppa/ubuntu resolute/main amd64 Packages
 *** 3.13.12-1ubuntu1 100
        100 /var/lib/dpkg/status

Installing works the same as from the main archive. A Python 3.9 build straight from the PPA on a release that never shipped it:

sudo apt install python3.9
python3.9 --version

The interpreter reports the PPA build:

Python 3.9.25

If Python itself is what you are after, the Python install guide covers deadsnakes and the alternatives in more depth, and the same PPA workflow drives things like the PHP versions repository. To move a single package onto the new candidate without a full upgrade, see upgrading one package with apt.

List, Disable and Remove Repositories

Listing every configured repository is a capital -L. This catches people out because lowercase -l is not a shorthand for list; it means “log in to Launchpad” and will sit waiting for OAuth credentials:

sudo add-apt-repository -L

The output prints each source stanza, including the Ubuntu archive definition and any PPAs you added. To also fetch source packages for a PPA, add it with -s, which sets Types: deb deb-src in the written file:

sudo add-apt-repository -y -s ppa:deadsnakes/ppa

Removal takes the same PPA argument with -r:

sudo add-apt-repository -r -y ppa:deadsnakes/ppa

On current releases this deletes the .sources file outright and refreshes the cache, so the PPA’s candidates disappear immediately:

Removing repository.
Removing entry from /etc/apt/sources.list.d/deadsnakes-ubuntu-ppa-resolute.sources

One thing removal does not do is downgrade packages you already installed from that PPA. They stay at the PPA version until you replace them. If you want the packages walked back to archive versions as well, install ppa-purge and run sudo ppa-purge ppa:deadsnakes/ppa instead. Note that ppa-purge disables the entry by setting Enabled: no in the .sources file rather than deleting it.

apt-cache policy showing a deadsnakes PPA package candidate and add-apt-repository remove on Ubuntu 26.04

The command also toggles archive components. Enabling universe on a system where it is disabled is a single call, and the tool patches the component list of the existing Ubuntu sources rather than adding a new entry:

sudo add-apt-repository -y universe

The confirmation is short:

Adding component(s) 'universe' to all repositories.

Install add-apt-repository on Debian 12

Debian 12 still packages the tool, but two things bite that never come up on Ubuntu. Install it together with python3-launchpadlib:

sudo apt update
sudo apt install software-properties-common python3-launchpadlib

AttributeError: ‘NoneType’ object has no attribute ‘people’

This traceback is what you get when you skip python3-launchpadlib and point the tool at a ppa: address. Debian does not pull the Launchpad client library in as a dependency, so the PPA code path dies partway through:

  File "/usr/lib/python3/dist-packages/softwareproperties/ppa.py", line 113, in lpteam
    self._lpteam = self.lp.people(self.teamname)
                   ^^^^^^^^^^^^^^
AttributeError: 'NoneType' object has no attribute 'people'

Installing the library clears the error. The larger problem does not clear.

The repository does not have a Release file

Launchpad builds PPAs for Ubuntu series only. Add a PPA on Debian and the tool writes an entry pointing the Ubuntu URL at your Debian codename, which Launchpad has never heard of. The next cache refresh fails:

Err:4 https://ppa.launchpadcontent.net/deadsnakes/ppa/ubuntu bookworm Release
E: The repository 'https://ppa.launchpadcontent.net/deadsnakes/ppa/ubuntu bookworm Release' does not have a Release file.

There is no flag that fixes this. PPAs are an Ubuntu mechanism, and pinning an Ubuntu suite name onto a Debian system to force one through is a reliable way to break upgrades. On Debian, use the tool for plain repository lines and component changes, and get third-party software from repos that publish Debian suites.

The second Debian 12 catch is quieter. The tool in this release predates deb822 support, and on a system whose sources live in /etc/apt/sources.list.d/debian.sources (the layout cloud and container images ship) it claims success and then writes a zero-byte file:

Adding deb entry to /etc/apt/sources.list.d/deadsnakes-ubuntu-ppa-bookworm.list
Adding key to /etc/apt/trusted.gpg.d/deadsnakes-ubuntu-ppa.gpg with fingerprint F23C...

Check the file it names and it is empty, so nothing was actually added. On a Debian 12 machine installed from the standard installer, which uses a classic one-line /etc/apt/sources.list, the same command writes the entry correctly. If your Debian 12 host uses the deb822 layout, skip add-apt-repository and write sources files by hand as shown in the next section, the same way you would when adding Kali repositories to sources.list on a hybrid box.

Use deb822 Sources or extrepo on Debian 13

On Debian 13 the install step itself fails, and no amount of cache refreshing helps:

E: Unable to locate package software-properties-common

The software-properties package was removed from Debian testing before the trixie freeze, so it never shipped in Debian 13 and add-apt-repository does not exist there. The replacement is the format apt itself standardized on. A repository definition is a small deb822 sources file you create directly:

sudo vim /etc/apt/sources.list.d/backports.sources

Add the stanza for the repository. This one enables trixie-backports:

Types: deb
URIs: http://deb.debian.org/debian
Suites: trixie-backports
Components: main
Signed-By: /usr/share/keyrings/debian-archive-keyring.gpg

Refresh and the new suite is live:

sudo apt update

The backports index downloads alongside the main archive:

Get:1 http://deb.debian.org/debian trixie-backports InRelease [54.0 kB]
Get:5 http://deb.debian.org/debian trixie-backports/main amd64 Packages [310 kB]

For third-party repositories, Debian’s curated answer is extrepo. It ships repository definitions and signing keys for a long list of external vendors, verified by Debian, so you never paste a key from a random blog:

sudo apt install extrepo
sudo extrepo search vscodium
sudo extrepo enable vscodium

Enabling writes a ready-made deb822 file with the key path filled in:

Architectures: amd64 arm64
Components: main
Suites: vscodium
Uris: https://paulcarroty.gitlab.io/vscodium-deb-rpm-repo/debs/
Types: deb
Signed-By: /var/lib/extrepo/keys/vscodium.asc

Between hand-written deb822 stanzas and extrepo, Debian 13 covers everything add-apt-repository used to do there, with tighter key scoping than the old trusted.gpg.d approach ever had.

Which Method on Which Release

The same command name behaves differently enough across current releases that it is worth pinning down what you get on each:

Releasesoftware-properties-commonPPA supportWhat gets written
Ubuntu 26.040.119, preinstalled on server imagesYesdeb822 .sources, key inline in Signed-By
Ubuntu 24.040.99.49, install on minimal imagesYesdeb822 .sources, key inline in Signed-By
Debian 120.99.30, needs python3-launchpadlibNo usable PPAs, no Release fileclassic .list plus trusted.gpg.d key; empty file on deb822 systems
Debian 13Not in trixieNoWrite deb822 .sources by hand, or use extrepo

On Ubuntu, install software-properties-common and use the tool freely; it manages keys and deb822 files better than most manual instructions floating around. On Debian, treat it as legacy: fine for component toggles on Debian 12 with a classic sources.list, wrong for PPAs everywhere, and absent from Debian 13, where a five-line .sources file or extrepo does the job cleanly.

Keep reading

Upgrade Ubuntu 24.04 to Ubuntu 26.04 LTS (Step by Step) Ubuntu Upgrade Ubuntu 24.04 to Ubuntu 26.04 LTS (Step by Step) UFW Firewall Commands with Examples on Ubuntu 24.04 / 22.04 Security UFW Firewall Commands with Examples on Ubuntu 24.04 / 22.04 Backup and Restore Linux Systems with Timeshift Debian Backup and Restore Linux Systems with Timeshift Install Arcane on Ubuntu 26.04 / 24.04: Complete Docker UI Guide Containers Install Arcane on Ubuntu 26.04 / 24.04: Complete Docker UI Guide Install NVIDIA Drivers and CUDA Toolkit on Ubuntu 26.04 / 24.04 Ubuntu Install NVIDIA Drivers and CUDA Toolkit on Ubuntu 26.04 / 24.04 Linux IPSec VPN Setup (L2TP + Cisco IPsec) Security Linux IPSec VPN Setup (L2TP + Cisco IPsec)

Leave a Comment

Press ESC to close