15

If I try something like:

sudo add-apt-repository ppa:graphics-drivers/ppa

it raises an error: Command not found.

So I installed the repository with:

apt-get install software-properties-common

and it installed, however it still gives me

 apt-add-repository: Command not found

also it does not help to install python, tried that as well.

muru
  • 207,970
Vu3L5TmD
  • 161
  • What does echo $PATH show? apt-add-repository should be in the /usr/bin folder. – Terrance Jun 07 '18 at 20:12
  • /usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/snap/bin Do not know what to make of this through. – Vu3L5TmD Jun 07 '18 at 20:17
  • OK, so the path has it there. Make sure the file is in that folder then. ls -al /usr/bin/apt-add-repository And that one should be a link that points to add-apt-repository that should be in the same folder. – Terrance Jun 07 '18 at 20:21
  • It does point to add-apt-repository – Vu3L5TmD Jun 07 '18 at 20:25
  • Does ls -al /usr/bin/add-apt-repository then show an existing file? – Terrance Jun 07 '18 at 20:27
  • I think so it says 'irwxrwxrwx 1 root root 18 May 8 16:58 /usr/bin/apt-add-repository --> add-apt-repository' – Vu3L5TmD Jun 07 '18 at 20:30
  • Try the second command I sent. I am looking to see if add-apt-repository is there. – Terrance Jun 07 '18 at 20:35
  • The last command you sent did not point to anything output is: /usr/bin/add-apt-repository – Vu3L5TmD Jun 07 '18 at 20:38
  • That's the problem. Try sudo apt install --reinstall software-properties-common – Terrance Jun 07 '18 at 20:38
  • You. Are a god. Thank you so much. So if I understand it right, the add-apt-repository was installed in a wrong folder? – Vu3L5TmD Jun 07 '18 at 20:44
  • Not 100% sure, but it wasn't where it was supposed to be. Glad you got it fixed. I will write up that last command as an answer for you. =) – Terrance Jun 07 '18 at 20:48

1 Answers1

22

The application add-apt-repository is not in the /usr/bin folder where it needs to be thus causing apt-add-repository to fail since it is a link file.

ls -al /usr/bin/apt-add-repository 
lrwxrwxrwx 1 root root 18 May  8  2017 /usr/bin/apt-add-repository -> add-apt-repository

Run the following command to reinstall the software properties to reinstall the add-apt-repository application:

sudo apt install --reinstall software-properties-common

Now the file /usr/bin/add-apt-repository should exist and the commands should work now.

Terrance
  • 43,852
  • I think the real reason for OP's problem was a simple typo: apt-add-repository: Command not found. add-apt-.... or apt-add-.... – mook765 Jun 07 '18 at 22:24
  • @mook765 Both exist on my system. apt-add-repository is linked to add-apt-repository and they do this for mistyping or backwards compatibility like egrep is aliased to grep -E. There are no needs for them, but they sure help people. – Terrance Jun 07 '18 at 22:26
  • Wow, they both exist in my system too, didn't know that, one point for you... – mook765 Jun 07 '18 at 22:33