0

I'm upgrading NodeJS and NPM to the latest LTS on my aging Debian 11 (bullseye) server. I purged the distro's stock nodejs and npm packages and dependencies, and successfully installed NodeJS v22.15.0 and NPM v10.9.2 using nodesource.

I'm now attempting to remove the nodejs-legacy package which — I'm assuming — is likely not needed anymore, but both apt and apt-get (they behave exactly the same in this regard) complain that:

$ sudo apt remove nodejs-legacy Reading package lists... Done Building dependency tree... Done Reading state information... Done Virtual packages like 'nodejs-legacy' can't be removed 0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded. 

As far as I understand, virtual packages only define dependencies and/or install configuration files. How come a package, even "virtual" — or whatever they want to call it ­— cannot be uninstalled? Can't apt (or apt-get) simply update the package database and/or remove said files?

This particular package is not even part in any dependency:

$ sudo apt depends nodejs-legacy <nodejs-legacy> $ sudo apt rdepends nodejs-legacy <nodejs-legacy> 

I guess I could just leave it there since it doesn't seem to conflict with anything else (so far, that is). But I'd rather keep my servers free of old garbage lying around.

What is the recommended way of ridding a Debian system of old virtual packages that are not needed anymore?

1 Answer 1

1

Virtual packages are exactly that, virtual — they don’t exist as such. They are provided by real packages, and they exist so that packages can depend on them without enforcing a specific variant; for example, packages can depend on a web browser without having to list all possible web browsers.

This means virtual packages don’t ship configuration files, or have dependencies, and they don’t “cost” anything on the system.

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.