When trying to add a PPA in Ubuntu/Debian/Mint, you may get the following error:
$ sudo apt-add-repository ppa:new/ppa-repository
bash: add-apt-repository: command not found
The add-apt-repository command allows you to add a repository to /etc/apt/sources.list or /etc/apt/sources.list.d or remove an existing PPA. This command is often missing from Linux containers built for Docker or LXD/LXC.
Let’s see how to fix the “add-apt-repository: command not found” error in Ubuntu.
Open a terminal and update the APT repository:
$ sudo apt update
$ sudo apt upgrade
Install the software-properties-common package:
$ sudo apt install software-properties-common
If a package is already installed but corrupted, it can be reinstalled:
$ sudo apt install --reinstall software-properties-common
Note. You can check the list of files in a package:
$ dpkg -LÂ software-properties-common
Verify that the apt-add-repository command is now available:
$ type apt-add-repository