0

I am using Trisquel 7, a variant of Ubuntu 16.04, that uses a custom version of Mate as its desktop environment.

I added a https://deb.nodesource.com/node_8.x repository to install some npm stuff we were using at a hackathon. I no longer need any of that stuff, and I'd like to purge all packages installed from those repos and remove them. But I can't remember which packages I installed.

I tried using the "Origin" tab in Synaptic, which shows a list of packages installed from each repo on the system. But for some reason the deb.nodesource repo doesn't show up there (all my other default and added repos are there).

So my questions are: 1) If I just remove a repo, will that automatically remove all packages installed from that repo? 2) If not, how do I purge all packages installed from a repo and remove it?

I'd prefer command line answers, since the Mate GUI in Trisquel is quite different from the default desktop GUI in Ubuntu.

6
  • 2
    Does this answer your question? To remove repository in Debian 8.1? Commented May 21, 2020 at 3:17
  • (1) => nope. It just removes the source. (2) => You need ppa-purge Commented May 21, 2020 at 3:17
  • From what I can see here, the only 2 packages served (assuming you're using amd64 and node_8.x) are nodejsand nodejs-dbg. Isn't it easier to simply purge these 2 manually and remove the repo? I don't think that a reference is kept for each package on where it was "installed from". The solution I thought wouldn't be safe for any repository and system, so, in your case it seems better to me to just do it manually... Commented May 21, 2020 at 3:45
  • @muru I've edited the question to add the full URI of the repo in question. I'm not sure it's a PPA. If it's isn't, will ppa-purge still work? Commented May 22, 2020 at 8:35
  • @Zip I'm using 32-bit system. As mentioned in the question, Synaptic can provide a list of all packages installed from each source. But for some reason, the nodesource repo isn't there. Commented May 22, 2020 at 8:38

1 Answer 1

4

Removing a repository won’t remove the packages installed from it. If you want to remove packages from a given repository, you should do so before removing the repository itself.

The system doesn’t remember where packages were installed from, it only knows where packages are available from now. So one possible approach is as follows:

  • install aptitude if you haven’t already;
  • list all the installed packages which are available (in some version) from the repository you want to remove:

    aptitude search '~O"Node Source" ~i' 
  • for each of the packages returned, check which version is installed, and note those which are installed from the repository you wish to remove:

    apt policy nodejs 
  • remove the repository definition;

  • remove packages listed above.

Another approach would be to remove the repository, then list the packages which don’t have a match in repositories any more, using apt-show-versions: this will list such packages as “No available version in archive” (packages which aren’t available at all in the configured repositories) or “Newer than version in archive” (packages which are available in the configured repositories, but in older versions); you could then remove and/or downgrade the corresponding packages.

7
  • Trisquel 7 has aptitude installed by default, but the aptitude command you suggested gave no output. The second command produced: "nodejs: Installed: (none) Candidate: 8.17.0-1nodesource1 Version table: 8.17.0-1nodesource1 500 500 deb.nodesource.com/node_8.x xenial/main i386 Packages" ... as well as some other packages from Trisquel repos. Commented May 22, 2020 at 8:56
  • The “Origins” tab shows where packages are available from now, it doesn’t show where packages were installed from. Commented May 22, 2020 at 8:58
  • If the first aptitude command produced nothing, that means that you have removed all packages which were installed from the Node repositories. Commented May 22, 2020 at 8:59
  • But doesn't that contradict the output of the second command? Commented May 22, 2020 at 9:03
  • No, because the output of the second command says that the nodejs package isn’t installed (“Installed: (none)”). It’s available from the Node repository, but it’s not installed, so the first command doesn’t show it (it only shows installed packages available from the Node repository). Commented May 22, 2020 at 9:12

You must log in to answer this question.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.