Resolving ‘sudo add-apt-repository command not found’ Error in Linux

sudo-add-apt-repository-command-not-found-in-ubuntu

Are you facing the problem at the time of adding a new PPA repository? I have seen the error “sudo add-apt-repository command not found” in Ubuntu or other Debian based operating system? This article has a solution of fixing error “sudo add-apt-repository command not found”.

Solution “sudo add-apt-repository command not found” Error Message

Quick introduction sudo add-apt-repository command is used to add a new PPA repository. But sometime when you use this command you will face the problem it may be “command not found” or you are not able to add a new PPA repository.

Why did you get “sudo add-apt-repository command not found” Error Message?

When you get the message command not found it means a particular package is missing in your ubuntu-based distribution.

According to the add-apt-repository command not found an error, the add-apt-repository package has been not installed in your system. It is a missing package.

Generally, we use the following command for adding new PPA repository

sudo add-apt-repository ppa:nameofppa

If you don’t have installed this package on your system. you will get the following result.

vijay@Ubuntu19:~$sudo add-apt-repository ppa:ondrej/php
sudo add-apt-repository: command not found
vijay@Ubuntu19:~$

Solution sudo add-apt-repository: command not found an error in Two Steps

Step 1: Update source list or repository: Open the terminal and run the following command to update source list in Ubuntu

$sudo apt-get update
vijay@Ubuntu19:~$sudo apt-get update 
[sudo] password for vijay: 
Hit:1 http://in.archive.ubuntu.com/ubuntu disco InRelease
Hit:2 http://in.archive.ubuntu.com/ubuntu disco-updates InRelease
Hit:3 http://in.archive.ubuntu.com/ubuntu disco-backports InRelease
Get:4 http://security.ubuntu.com/ubuntu disco-security InRelease [97.5 kB]
Fetched 97.5 kB in 2s (39.2 kB/s)   
Reading package lists... Done
vijay@Ubuntu19:~$

Step 2: Install the software-properties-common Package: add-apt-repository is not a stand-alone package it is the component of software-properties-common Package. So install the complete package and get component working.

Use the following command to install the pakage

$sudo apt-get install software-properties-common
or
$sudo apt install software-properties-common 
vijay@Ubuntu19:~$sudo apt-get install software-properties-common
Reading package lists... Done
Building dependency tree       
Reading state information... Done
The following NEW packages will be installed:
  software-properties-common
0 upgraded, 1 newly installed, 0 to remove and 0 not upgraded.
Need to get 9,912 B of archives.
After this operation, 197 kB of additional disk space will be used.
Get:1 http://us.archive.ubuntu.com/ubuntu bionic-updates/main amd64 software-properties-common all 0.96.24.32.5 [9,912 B]
Fetched 9,912 B in 2s (5,685 B/s)                      
Selecting previously unselected package software-properties-common.
(Reading database ... 265950 files and directories currently installed.)
Preparing to unpack .../software-properties-common_0.96.24.32.5_all.deb ...
Unpacking software-properties-common (0.96.24.32.5) ...
Processing triggers for man-db (2.8.3-2) ...
Processing triggers for dbus (1.12.2-1ubuntu1) ...
Setting up software-properties-common (0.96.24.32.5) ...
vijay@Ubuntu19:~$

Once you have installed the package software-properties-common, then update again the repository list by using the following command

$sudo apt-get update

Now enjoy the adding new PPA repository how many you like without any problem.

Thanks for Reading

Cheers!

If you like our content, please consider buying us a coffee.
Thank you for your support!