[Solved] “add-apt-repository” Command Not Found Error in Ubuntu

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.

Process Flow Chart to Fix “add-apt-repository” Command Not Found Error

Process flowchart to fix the add-apt-repository command not found error[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.the add-apt-repository command not found when run in terminal In the above snapshot, you notice when I run the command for listing the available system repositories, I am thrown the error messageCommand ‘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”add-apt-repository” 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.

You can read our Comparative Analysis of Methods to distinguish between these two methods and best pick one for your need.

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 like below:

  1. Open your Ubuntu Terminal by pressing CTRL+ALT+T.
  2. Now, type the below command and hit ENTER for package index updation:
    sudo apt update
    EXPLANATION
    • sudo: Grants root privileges.
    • apt: The package management tool.
    • update: Action updating the system repository index.

    apt package cache is updated before solving add-apt-repository command not foundHere, 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.

  3. After that, type the following command and press the ENTER button:
    sudo apt-get install software-properties-common
    EXPLANATION
    • 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.

    the software package is installed in this command to fix add-apt-repository command not found Here, the image displays that I am installing the software-properties-common package.

    Note: The command sudo apt install software-properties-common serves the same purpose.
  4. 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.

  5. At this point, Type this command and press ENTER:
    add-apt-repository --list
    EXPLANATION
    • add-apt-repository: the command for repository adding/removing.
    • –list: Returns the repository log.
    the command not found error is fixed and runs with success here with list optionIn 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 issue quickly and simply like the following:

  1. Go to Software & Updates from the applications menu.typing and selecting software and updates from GUI
  2. Now, navigate to the Other Software tab and click on Add.other software is selected and add button is pressed to solve add-apt-repository command not found error
  3. After that, supply a repository URL in the APT line section and click Add Source.

    the apt source is given here to add repoFor 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.

  4.   At this point, provide the user password for authentication and click on Authenticate.

    user password for system authentication to add the add-apt-repository commandWell, 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

    the error is solved by adding repo via gui and repo list is returned 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.

Comparison of 2 Methods to Solve “add-apt-repository” Command Not Found

As of now, I have introduced you to 2 effective methods for getting access to 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
  • Single command line method.
  • Faster providing fine-grained control.
  • Can be discomfiting to novice users.
  • Simple typing mistake leads to unwanted consequences.
Method 2
  • Super simple method.
  • Less prone to error due to visual feedback.
  • Slow with less automation capability.

Last but not least, whether you 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 have 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

How do I manually add an APT repository?

You can manually add a new apt repository by providing the repo url in the main file sources.list located in the directory /etc/apt/sources.list.d/. You can also create a new file with .list extension in that same folder and avail repository handling.

What is apt add repository?

 The apt-add-repository is a command line utility script that is responsible for the addition and uninstallation of repositories in Debian-based Linux distros such as Ubuntu.

How to install a program with apt-get?

By running the simple command sudo apt-get install <package_name>, you can install your desired software program. Remember <package_name> is the exact name of the package you want to install and multiple packages can be configured at once by separating their names with space.

Is APT recommended for beginner users?

For most users, especially newbies, the apt package management tool is highly recommended as it is very user-friendly and has an updated command structure than the apt-get. However, you have to have the sudo/root privilege for the successful use of apt.


Related Articles


<< Go Back to Repository Configuration in Linux | Package Management in Linux | Learn Linux Basics

Rate this post
LINUX
FUNDAMENTALS
A Complete Guide for Beginners Enroll Course Now
Md Masrur Ul Alam

Assalamu Alaikum, I’m Md Masrur Ul Alam, currently working as a Linux OS Content Developer Executive at SOFTEKO. I completed my Bachelor's degree in Electronics and Communication Engineering (ECE)from Khulna University of Engineering & Technology (KUET). With an inquisitive mind, I have always had a keen eye for Science and Technolgy based research and education. I strongly hope this entity leverages the success of my effort in developing engaging yet seasoned content on Linux and contributing to the wealth of technical knowledge. Read Full Bio

Leave a Comment