When attempting to add a new software repository, the Ubuntu error “add-apt-repository command not found” displays. This shows that your system lacks the add-apt-repository package.
This guide fixes the “add-apt-repository command not found” error for Linux distributions based on Ubuntu and Debian.
- an individual with sudo rights
- Ctrl+Alt+T or Ctrl+Alt+F2 will open a terminal window or command line.
How to fix the error “add-apt-repository command not found” on Ubuntu?
Here at Arzhost, we solve the error by discuss few steps to fix this “add-apt-repository command not found” error in Ubuntu.
Step 1: Update local Ubuntu repositories
To update repositories, launch a terminal window and type the following command:
- apt update with sudo
The system verifies that the list of local software repositories is updating.
Step 2: Install the software-properties-common Package
On Debian / Ubuntu LTS, the add-apt-repository command cannot be installed using apt because it is not a typical package. Instead, it is a part of the package known as software-properties-common.
Install the software-properties-common package to obtain the add-apt-repository command:
- install software-properties-common with sudo apt
An example output following a successful installation looks like this. Then, update the repository again with:
- sudo apt update
How to Add the Apt Repository in Debian and Ubuntu?
The default software repositories do not contain all available software packages. Developers made their own software repositories to make installing applications simpler. The add-apt-repository command is used in this situation.
One popular package for running non-Linux programmes on a Linux system is called Wine. However, the most recent version is not accessible via the normal repositories.
You must first authorize access to the Wine repository in order to install the most recent version of Wine on Ubuntu:
- Ubuntu Bionic Main: sudo apt-add-repository “deb https://dl.winehq.org/wine-builds/”
It’s possible that other software need additional licence. Restrictive licencing, like in the case of Debian, may prevent a package from being included to the default repository.
The add-apt-repository command is essential in these situations to allow access to the programme you want to install.
What is an Ubuntu Repository?
An application is a piece of software. When running, a package occasionally needs additional packages (referred to as dependencies).
The task of loading the desired software package is handled by a package manager. The package manager also instals any dependencies that may exist. A package manager also automatically maintains track of every piece of installed software and update.
A software repository and a package management collaborate. A repository is a collection of numerous software products. Each Linux distribution gives users access to a set of fundamental default repositories by default.
The standard repositories in Ubuntu are:
- Main: The Ubuntu developers’ free and open-source software
- Universe: Linux community’s free and open-source software
- Restricted: Device drivers and other software that manufacturers have licenced
- Multiverse: All additional software protected by a copyright or other legal restrictions
The default repositories in Debian are:
- Main: Free software with a licence
- Contrib: Free software that is dependent on commercially-licensed software
- Non-Free: Software that isn’t free to use or distribute is considered non-free.
You must add that repository if you want to install a software package that isn’t available in these default repositories.
Conclusion
In this tutorial, you learned how to fix “add-apt-repository command not found” error in Ubuntu or Debian by using the add-apt-repositories command.
Additionally, you now have a better understanding of package management and software repositories and the value they add to system upkeep.
Read our guides to fix “Could not get lock /var/lib/dpkg/lock Error on Ubuntu” or “Sub-process /usr/bin/dpkg gave an error code (1)”.
What is the “add-apt-repository” command and why is it causing an error?
The “add-apt-repository” command is a tool used to add new software repositories to your Ubuntu or Debian system. It is typically used to install software that is not available in the default repositories. The error “add-apt-repository command not found” occurs when the command is not installed on your system.
How can I fix the “add-apt-repository command not found” error?
There are two steps to fixing the “add-apt-repository command not found” error:
Update your local repositories: Before installing any new packages, it is important to update your system’s local package repositories. This ensures that you have the latest package information and that any new dependencies are installed. To update your repositories, open a terminal window and enter the following command:
sudo apt-get update
Install the software-properties-common package: The “add-apt-repository” command is part of the software-properties-common package. To install this package, enter the following command in a terminal window:
sudo apt-get install software-properties-common
Once the software-properties-common package is installed, you should be able to use the “add-apt-repository” command without any errors.
What are some other ways to fix the “add-apt-repository command not found” error?
In some cases, the error “add-apt-repository command not found” may persist even after installing the software-properties-common package. This can happen if the package is not installed properly or if there are other issues with your system’s package management.
Here are a few other things you can try:
Check the package manager log: The package manager log can sometimes provide clues about why the “add-apt-repository” command is not working. To view the package manager log, open a terminal window and enter the following command:
sudo apt-get install -f
Reinstall the software-properties-common package: If the software-properties-common package is not installed properly, you can try reinstalling it using the following command:
sudo apt-get install –reinstall software-properties-common
Purge the software-properties-common package and reinstall it: If the above methods do not work, you can try purging the software-properties-common package and reinstalling it. This will remove all files associated with the package and then reinstall it from scratch. To do this, enter the following commands in a terminal window:
sudo apt-get purge software-properties-common
sudo apt-get install software-properties-common
What are some common causes of the “add-apt-repository command not found” error?
The most common cause of the “add-apt-repository command not found” error is that the software-properties-common package is not installed on your system. This can happen if you have not installed any new packages recently or if you have manually removed the package.
Other causes of the error include:
Corrupted package files
Issues with your system’s package management
Conflicts with other software
How can I prevent the “add-apt-repository command not found” error from happening in the future?
The best way to prevent the “add-apt-repository command not found” error from happening in the future is to make sure that your system’s package repositories are always up to date. You can do this by regularly running the following command in a terminal window:
sudo apt-get update
You should also avoid manually removing any packages unless you are absolutely certain that you do not need them. If you do need to remove a package, make sure that you do not remove any dependencies that other packages rely on.
What resources are available for further assistance?
If you are still having trouble fixing the “add-apt-repository command not found” error, there are a number of resources available to help you. You can search for solutions online, ask for help on a forum, or contact your Linux distribution’s support team.