4

I know (thanks Jim Paris) that I can use add-apt-repository on Debian by first:

sudo apt-get install software-properties-common

However, I still can't simply run (for example):

sudo add-apt-repository ppa:nextcloud-devs/client
sudo apt-get update

...because the distro folder for that PPA only lists Ubuntu releases (artful, bionic...) not Debian releases (jessie, stretch...). So apt fails to find packages for my release.

I can solve this manually (decide the most appropriate Ubuntu rleease, download the repo keys, modify /etc/apt-get/sources.list), but I'd prefer to do it from the command line.

Can I pass a command-line parameter, or otherwise convince add-apt-repository to pick an Ubuntu release? Something like:

sudo add-apt-repository --force-distro=artful ppa:nextcloud-devs/client
lofidevops
  • 3,159

2 Answers2

3

Specifying the Ubuntu codename to be used when adding a repository is easy:

Figure out your specific address:

  1. Go to the Launchpad website of your desired repository. You can assemble the address from the first element of your PPA address.

  2. Over there pick a desired package from the list Personal package archives.

  3. Click the green text Technical details about this PPA.

  4. Specify the Ubuntu codename you want from Choose your Ubuntu version.

    • Artful (17.10)
  5. Copy (only??) the first line of the code block.

    • deb https://ppa.launchpadcontent.net/nextcloud-devs/client/ubuntu artful main

Add the repo:

  1. Execute with the -S parameter and your address.
    • sudo add-apt-repository -S "deb https://ppa.launchpadcontent.net/nextcloud-devs/client/ubuntu artful main"
Carolus
  • 212
  • 1
  • 10
1

It is highly recommended that you do not add third party repos

However, if you understand the risks and are familiar with apt-pinning, you can add and manage 3rd party repositories. I do not recommend you do this to your Debian install, and instead install the package from the official stable or back-ports repository. If not there installing the package from source is another viable method.

Again, if you require this package, and it is not found in the repos and you want to maintain it using apt, as long as you understand the risks you can follow these steps.

Issue at hand

You are attempting to add the ppa:nextcloud-devs/client repository using the add-apt-repository command. You are unable to get apt-get update to work with the new repo as it uses Ubuntu version names and your sources.list being Debian uses Debian version names.

Solution

I am referencing this guide on how to add an Ubuntu PPA to your Debian system.

You will run the following command as sudo (or root):

add-apt-repository ppa:nextcloud-devs/client

Now you want to check your /sources.list.d/. For example, if you are adding Launchpad to your wheezy /sources.list.d/, it should look like this:

deb http://ppa.launchpad.net/webupd8team/java/ubuntu wheezy main 
deb-src http://ppa.launchpad.net/webupd8team/java/ubuntu wheezy main

Now change wheezy to the Ubuntu version you want to use. For example, Xenial or 16.04.

deb http://ppa.launchpad.net/webupd8team/java/ubuntu xenial main 
deb-src http://ppa.launchpad.net/webupd8team/java/ubuntu xenial main

Now you should use apt-pinning to make sure that your system maintains some sanity. I highly recommend that you make your stable repos have a higher priority than your ppa. Your /etc/apt/preferences.d/ should have a reponame.preferences for each repo and the contents of each should be like this:

#/etc/apt/preferences.d/stable.preferences
Package: *
Pin: release a=stable
Pin-Priority: 1000

#/etc/apt/preferences.d/your-ppa-name.preferences Package: * Pin: release a=your-ppa-name Pin-Priority: 750

Now you can run apt update and the PPA should be successfully installed.

Conclusion

I recommend against doing this and would suggest that you use a distro that supports the package you wish to install and avoid using third party repos. However, if you know what you are doing this should work.

If you have any questions or concerns about this post, do not hesitate to ask me. If there are any corrections or misconceptions in this answer please inform me. I can update the post as necessary.

Best of Luck!

Pablo A
  • 2,712
kemotep
  • 5,280
  • 7
  • 21
  • 36