Applies to: Debian 13 and 12, Ubuntu 26.04 and 24.04; tested with apt 3.0.3 on Debian 13.7, software-properties-common 0.120.1 on Ubuntu 26.04.1 and 0.99.49.4 on Ubuntu 24.04.5
deb: command not found means a repository line was typed into the shell. A line such as deb https://nginx.org/packages/debian trixie nginx is not a command: it belongs in a file in /etc/apt/sources.list.d/. The similar error add-apt-repository: command not found means the helper tool isn’t installed, and on Debian 13 it doesn’t exist at all.
What the errors look like:
bash: deb: command not found sudo: deb: command not found bash: add-apt-repository: command not found
Add the repository by hand (works everywhere)
This works on every current Debian and Ubuntu release and needs no extra tools. The example adds the official nginx.org repository on Debian 13; take the address, suite, component and key from the instructions of the software you are installing.
- Download the repository’s signing key into
/etc/apt/keyrings, the folder the apt manual recommends for keys you manage yourself:sudo install -d -m 0755 /etc/apt/keyrings sudo curl -fsSL https://nginx.org/keys/nginx_signing.key -o /etc/apt/keyrings/nginx.asc
Ifcurlis missing, install it first withsudo apt install curl. apt reads the text key (-----BEGIN PGP PUBLIC KEY BLOCK-----) directly, so you don’t needgpg --dearmor. - Create
/etc/apt/sources.list.d/nginx.sourceswith this content:Types: deb URIs: https://nginx.org/packages/debian/ Suites: trixie Components: nginx Signed-By: /etc/apt/keyrings/nginx.asc
- Update the package lists and check that the new repository is used:
$ sudo apt update $ apt-cache policy nginx nginx: Installed: (none) Candidate: 1.30.5-1~trixie
If the instructions give you a one-line deb ... entry, you can also save it as a .list file, with the key in square brackets:
echo "deb [signed-by=/etc/apt/keyrings/nginx.asc] https://nginx.org/packages/debian trixie nginx" | sudo tee /etc/apt/sources.list.d/nginx.list
The apt manual calls the one-line format deprecated, but it still works. The file name must end in .list for one-line entries and .sources for the block format. On Debian 13, sudo apt modernize-sources converts old .list files and keeps a .list.bak copy.
Install add-apt-repository on Ubuntu
On Ubuntu, the tool is in the software-properties-common package:
sudo apt update sudo apt install software-properties-common sudo add-apt-repository ppa:git-core/ppa
On Ubuntu 26.04 and 24.04 it writes a .sources file (for example git-core-ubuntu-ppa-resolute.sources) with the signing key built in, and refreshes the package lists. To take a repository away again: sudo add-apt-repository --remove ppa:git-core/ppa.
add-apt-repository on Debian
- Debian 13:
software-properties-commonisn’t in the archive (packages.debian.org lists it for Debian 11, 12 and unstable only), soapt installcan’t find it. Add repositories by hand as shown above, or use Debian’sextrepotool for well-known third-party repositories:sudo apt install extrepo, thensudo extrepo enable nginx. In our test it created/etc/apt/sources.list.d/extrepo_nginx.sourceswith the key already in place. - Debian 12: the package can still be installed (version 0.99.30), but the manual method is simpler.
- Don’t add Ubuntu PPAs to Debian. PPAs are built for Ubuntu releases, and mixing them into Debian can break updates.
Errors after adding a repository
Missing key 8540A6F1..., which is needed to verify signaturefollowed byThe repository ... is not signed: the key file is missing or theSigned-Bypath is wrong. Debian 13 checks signatures withsqv, which is why the message names/usr/bin/sqv.The repository '... trixi Release' does not have a Release file: the suite name is wrong (here a typo fortrixie), or the repository doesn’t support your release. Check your codename withcat /etc/os-release.
If you have a .deb file instead
A downloaded package file is not a program either. Running ./hello_2.10-5_arm64.deb gave syntax error near unexpected token `newline'. Install it with apt, which also pulls in its dependencies:
sudo apt install ./hello_2.10-5_arm64.deb
And if the error is apt: command not found, the server isn’t Debian or Ubuntu: see apt-get: command not found.
Related: add, enable and remove repositories on Ubuntu and convert between RPM and DEB packages.
Official documentation: sources.list(5) on Debian 13 and Debian wiki: using third-party repositories.