The add-apt-repository, a command-line script, is probably the most essential entity coming with the APT (Advanced Package Tool) package manager for repository configuration in Debian-based Linux distros such as Ubuntu. However, users often encounter an issue of not finding it at the right time in the terminal. So, in this article, I will shed light on the gist of this problem and provide tactics for a successful resolution to fix the add-apt-repository command not found error in Ubuntu.
Key Takeaways
- Encountering the add-apt-repository command not found error in Ubuntu.
- Troubleshooting the error using Terminal.
- Fixing the error utilizing GUI.
Requirements
- Root privileges or need to be the root user.
- System running on Ubuntu.
Process Flow Chart
[Distro Used Throughout the Tutorial: Ubuntu 22.04]
Understanding the add-apt-repository Command Not Found Error
As mentioned earlier, The add-apt-repsository command leverages the APT package management tool for ensuring the users a smooth software experience irrespective of being official or third-party. Nevertheless, in utilizing the command for package configuration, one may come across the complexity as follows. In the above snapshot, you notice when I run the command for listing the available system repositories, I am thrown the error message “Command ‘add-apt-repository’ not found”.
Don’t let yourself get worried. In the next few sections, I will discuss the possible causes along with mentioning a few effective ways for the solution.
2 Methods to Fix the Command not found error
The solutions to the aforestated issue are pretty straightforward demanding just a few steps. In this feature, I will dive into 2 methods for resolving the error intricacies (using CLI and GUI). So, without further ado, let’s jump right in.
Method 01: Using CLI to Fix the add-apt-repository Command Not Found Error
One possible cause of the error is the absence of the add-apt-repository command in the system. On top of that, the command is included in the Software Properties Common package enabling users to add/remove repositories. Hence, installing the software properties common package to the system automatically lets you use the command for further goal attainment. And the process is also effortless.
Steps to Follow >
➊ Open your Ubuntu Terminal by pressing CTRL+ALT+T.
➋ Now, type the below command and hit ENTER for package index updation.
sudo apt update
- sudo: Grants root privileges.
- apt: The package management tool.
- update: Action updating the system repository index.
Here, my system repository cache is going through an updation. Updating is recommended before making any changes in the system. It allows for the containing of all the updated information about packages and their versions.
➌ After that, type the following command and press the ENTER button.
sudo apt-get install software-properties-common
- sudo: Grants root privileges.
- apt-get: The package management tool.
- install: Argument specifying apt to install a package.
- software-properties-common: Name of the package to be installed.
Here, the image displays that I am installing the software-properties-common package.
➍ Again, Run the below-mentioned command to update the system.
sudo apt update
After the updation, as shown above, I will now get the advantage of using the add-apt-repository command.
➎ At this point, Type this command.
add-apt-repository --list
- add-apt-repository: the command for repository adding/removing.
- –list: Returns the repository log.
➏ Finally, Press ENTER.
In the snapshot, you can see that the terminal throws no error. Thus, I installed the package and got access to the command with success.
Method 02: Using GUI to Fix the add-apt-repository Command Not Found Error
The Graphical User Interface (GUI) provides you with the opportunity to solve the arisen issue quickly and simply.
Steps to Follow >
➊ Go to Software & Updates from the applications menu.
➋ Now, navigate to the Other Software tab and click on Add.
➌ After that, supply a repository URL in the APT line section and click Add Source.
For instance, In the above snap, you spot that I have added a repository URL named deb http://archive.getdeb.net/ubuntu wiley-getdeb games to the source APT line.
➍ At this point, provide the user password for authentication and click on Authenticate.
Well, this creates a new repository for the system via GUI. Furthermore, the addition also automatically resolves the problem by adding the apt-add-repository command. Finally, utilize the below-mentioned command for verification in the terminal.
apt-add-repository --list
Thus, you see that my system did not have the command earlier and threw an error at the time of use. However, after adding a new repository to the system through GUI, I can seamlessly use the command.
Comparative Analysis of Methods
As of now, I have introduced you to 2 effective methods for getting access to use the apt-add-repository command for repository management. In this scope, I will feature some advantages and disadvantages of both methods.
Methods | Pros | Cons |
---|---|---|
Method 1 |
|
|
Method 2 |
|
|
Last but not least, whether you really adopt a particular approach is left to your personal preference. For example, if you are comfortable using the command line, then the first method is for you. However, you can exercise the use of the latter method to easily fix the error if you are a Linux newbie or has a predilection for visual representation.
Conclusion
In this article, I have contributed to the in-depth analysis of the complexity that may arise when the add-apt-repository command is not found. Additionally, I explained illustrations for a comprehensive view of the issue and its resolution. Henceforth, from now on, you are capable of tackling any overwhelming situation regarding this, continuing your learning of Linux repository management, and establishing yourself as an advanced Linux practitioner without any hindrance.
People Also Ask
Related Articles
- How to Remove APT Repositories in Linux[2 Easy Methods]
- The Universe Repository in Ubuntu [Enable, Install, Disable]
- The Repository Mirror in Ubuntu [An Extensive Overview]
- How to Add Repository in Ubuntu? [2 Simple Methods]
- How to Update Repository List in Ubuntu[3 Cases]
- How to add an APT Repository Proxy in Ubuntu [Easiest Guide]
<< Go Back to Repository Configuration in Linux | Package Management in Linux | Learn Linux Basics