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.

  • 2
    Does this answer your question? To remove repository in Debian 8.1? – muru May 21 '20 at 03:17
  • (1) => nope. It just removes the source. (2) => You need ppa-purge – muru May 21 '20 at 03: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... – Zip May 21 '20 at 03: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? – strypey May 22 '20 at 08: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. – strypey May 22 '20 at 08:38
  • @Zip although given what Stephen explained in the comments on his answer, perhaps that's because I already removed the packages I installed from that repo, and then forgot I'd done that ;) – strypey May 22 '20 at 11:56

1 Answers1

3

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.

Stephen Kitt
  • 434,908
  • 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 https://deb.nodesource.com/node_8.x xenial/main i386 Packages"

    ... as well as some other packages from Trisquel repos.

    – strypey May 22 '20 at 08:56
  • The “Origins” tab shows where packages are available from now, it doesn’t show where packages were installed from. – Stephen Kitt May 22 '20 at 08:58
  • If the first aptitude command produced nothing, that means that you have removed all packages which were installed from the Node repositories. – Stephen Kitt May 22 '20 at 08:59
  • But doesn't that contradict the output of the second command? – strypey May 22 '20 at 09: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). – Stephen Kitt May 22 '20 at 09:12
  • Ah, OK. Apologies for the noob questions :) – strypey May 22 '20 at 11:54
  • No need to apologise, we were all noobs at one time or another (and I’m a noob in many areas still). – Stephen Kitt May 22 '20 at 11:56