If I start using backports on xenial, which command will remove the old PPA from my system?

I have xenial, so before the end of the year I started using the LXD from backports. Now whenever I do apt update, I get an error about some files from the old LXD repo missing from the web. That’ understandable, because that repo has been retired.

But how do I remove that repo from my system? I found no such thing in the documentation anywhere.

I found the command apt-add-repository --remove, but I dont’ know what I should add after that, as a parameter. Please help.

Run sudo grep -r ppa /etc/apt* and find the ppa for LXD remove the entry, run sudo apt update then you should be good to go.

Are you sure about that answer? When you say I should remove the entry, do you mean remove the line or remove the entire file? And what’s the role of the command apt-add-repository --remove then?

Just try with apt-add-repository --remove ppa:ubuntu-lxc/lxd-stable then.
Whenever I need to remove a repository I just take the steps that I mentioned before, if the file only has one entry that I need to remove then I remove the file, if the file has more entries, I remove the entry in the file.

You can read more on managing repositories in Ubuntu via CLI here: https://help.ubuntu.com/community/Repositories/CommandLine

When you run apt-add-repository --remove, it just removes the repository entry from /etc/apt/sources.list.d/.
If you want to also remove the packages from that repository, you would need to use ppa-purge, as in

sudo ppa-purge ppa:ubuntu-lxc/lxd-stable

Normally, this should work and remove all packages that are referenced in that PPA.

If you were to perform the ppa-purge manually, you would simply run something like (replace with the :

awk '$1 == "Package:" { print $2 }' /var/lib/apt/lists/ppa.launchpad.net_ubuntu-lxc*

This will show a list of installed packages of that PPA, which you can remove manually with apt-get remove.

You definitely don’t want ppa-purge in this case as that’d remove and purge the LXD installation, including your database. What you want is to install the deb from backports and then remove the relevant entries from sources.list but in no case remove the deb itself.

1 Like