Illogical dependency resolution: nodejs=12.22.9~dfsg-1ubuntu3.4 attempts to install libnode72 12.22.12~dfsg-1~deb11u4 instead of 12.22.9~dfsg-1ubuntu3.4

Bug #2056653 reported by Arpad Kovacs
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
nodejs (Ubuntu)
New
Undecided
Unassigned

Bug Description

Hi,

First of all, thank you for running and maintaining Ubuntu, its a very valuable system and community and probably tons of work.

I ran into a strange issue when attempting to install nodejs and npm on Ubuntu 22.04.1 LTS (amd64), the dependency resolution appears to be illogical. In particular, the output of command #5 below doesn´t appear to make any sense: why would `sudo apt install nodejs=12.22.9~dfsg-1ubuntu3.4` attempt to install libnode72 `12.22.12~dfsg-1~deb11u4` which is incompatible instead of `12.22.9~dfsg-1ubuntu3.4` which is in the dependency chain?

Manually installing `sudo apt install libnode72=12.22.9~dfsg-1ubuntu3.4`
followed by `sudo apt install nodejs=12.22.9~dfsg-1ubuntu3.4`
does appear to complete without errors, therefore the metadata encoded in the packages is correct.

When I then try to install
`sudo apt install npm`
I run into the same issue:

nodejs : Depends: libnode72 (= 12.22.9~dfsg-1ubuntu3.4) but 12.22.12~dfsg-1~deb11u4 is to be installed

It appears like the dependency resolver is not behaving correctly.

I am not sure how actionable this is, perhaps there is something wrong with my computer. But it does not behave in the way that a normal user would expect, so just posting this in case others might have run into something similar.

Some additional links and commandline output which might assist in troubleshooting and for future reference:

Package: nodejs (12.22.9~dfsg-1ubuntu3.4 and others)
https://packages.ubuntu.com/jammy/nodejs

depends on
Package: libnode72 (12.22.9~dfsg-1ubuntu3.4 and others)
https://packages.ubuntu.com/jammy/libnode72

and suggests
Package: npm (8.5.1~ds-1)
https://packages.ubuntu.com/jammy/npm

I apparently have both Ubuntu and Debian repos configured in `/etc/apt/sources.list`:

```
# Ubuntu 22.04.1 LTS
deb http://us.archive.ubuntu.com/ubuntu/ jammy universe
deb http://us.archive.ubuntu.com/ubuntu/ jammy-updates universe

# Debian Bullseye
deb http://deb.debian.org/debian bullseye main contrib universe multiverse non-free
deb http://deb.debian.org/debian bullseye-updates main contrib universe multiverse non-free
```

However,
`sudo apt -o Debug::pkgProblemResolver=yes upgrade`
does not show any conflicts:

Reading package lists... Done
Building dependency tree... Done
Reading state information... Done
Entering ResolveByKeep 10%
  Dependencies are not satisfied for grub-efi-amd64-signed:amd64 < 1.187.6+2.06-2ubuntu14.4 @ii mK Ib >
Keeping package grub-efi-amd64-signed:amd64
  Dependencies are not satisfied for grub-efi-amd64-signed:amd64 < 1.187.6+2.06-2ubuntu14.4 @ii mK Ib >
Package grub-efi-amd64-signed:amd64 grub-efi-amd64-signed:amd64 Depends on grub-efi-amd64-bin:amd64 < 2.06-2ubuntu14.4 -> 2.06-3~deb11u6 @ii umU > (= 2.06-2ubuntu14.4)
  Keeping Package grub-efi-amd64-bin:amd64 due to Depends
Calculating upgrade... Done

For reference, I attempted to run the following commands:

# 1.
$ sudo apt install npm
```
Reading package lists... Done
Building dependency tree... Done
Reading state information... Done
Some packages could not be installed. This may mean that you have
requested an impossible situation or if you are using the unstable
distribution that some required packages have not yet been created
or been moved out of Incoming.
The following information may help to resolve the situation:

The following packages have unmet dependencies:
 npm : Depends: node-cacache but it is not going to be installed
       Depends: node-gyp but it is not going to be installed
       Depends: node-mkdirp but it is not going to be installed
       Depends: node-nopt but it is not going to be installed
       Depends: node-tar but it is not going to be installed
       Depends: node-which but it is not going to be installed
       Depends: nodejs:any (>= 10)
       Recommends: node-tap but it is not going to be installed
E: Unable to correct problems, you have held broken packages.
```

# 2.
$ apt-cache madison nodejs
    nodejs | 12.22.12~dfsg-1~deb11u4 | http://deb.debian.org/debian bullseye/main amd64 Packages
    nodejs | 12.22.9~dfsg-1ubuntu3.4 | http://us.archive.ubuntu.com/ubuntu jammy-updates/universe amd64 Packages
    nodejs | 12.22.9~dfsg-1ubuntu3.4 | http://security.ubuntu.com/ubuntu jammy-security/universe amd64 Packages
    nodejs | 12.22.9~dfsg-1ubuntu3 | http://us.archive.ubuntu.com/ubuntu jammy/universe amd64 Packages

# 3.
$ sudo apt install nodejs=12.22.9~dfsg-1ubuntu3.4
Reading package lists... Done
Building dependency tree... Done
Reading state information... Done
Some packages could not be installed. This may mean that you have
requested an impossible situation or if you are using the unstable
distribution that some required packages have not yet been created
or been moved out of Incoming.
The following information may help to resolve the situation:

The following packages have unmet dependencies:
 nodejs : Depends: libnode72 (= 12.22.9~dfsg-1ubuntu3.4) but 12.22.12~dfsg-1~deb11u4 is to be installed
E: Unable to correct problems, you have held broken packages.

# 4.
$ sudo apt remove libnode72
Reading package lists... Done
Building dependency tree... Done
Reading state information... Done
The following packages will be REMOVED:
  libnode72
0 upgraded, 0 newly installed, 1 to remove and 342 not upgraded.
After this operation, 36.6 MB disk space will be freed.
Do you want to continue? [Y/n] y
(Reading database ... 408682 files and directories currently installed.)
Removing libnode72:amd64 (12.22.12~dfsg-1~deb11u4) ...
Processing triggers for libc-bin (2.35-0ubuntu3.6) ...

# 5.
$ sudo apt install nodejs=12.22.9~dfsg-1ubuntu3.4
Reading package lists... Done
Building dependency tree... Done
Reading state information... Done
Some packages could not be installed. This may mean that you have
requested an impossible situation or if you are using the unstable
distribution that some required packages have not yet been created
or been moved out of Incoming.
The following information may help to resolve the situation:

The following packages have unmet dependencies:
 nodejs : Depends: libnode72 (= 12.22.9~dfsg-1ubuntu3.4) but 12.22.12~dfsg-1~deb11u4 is to be installed
E: Unable to correct problems, you have held broken packages.

# 6.
$ sudo apt install libnode72=12.22.9~dfsg-1ubuntu3.4
Reading package lists... Done
Building dependency tree... Done
Reading state information... Done
The following NEW packages will be installed:
  libnode72
0 upgraded, 1 newly installed, 0 to remove and 342 not upgraded.
Need to get 10.8 MB of archives.
After this operation, 41.2 MB of additional disk space will be used.
Get:1 http://us.archive.ubuntu.com/ubuntu jammy-updates/universe amd64 libnode72 amd64 12.22.9~dfsg-1ubuntu3.4 [10.8 MB]
Fetched 10.8 MB in 1s (9,062 kB/s)
Selecting previously unselected package libnode72:amd64.
(Reading database ... 408676 files and directories currently installed.)
Preparing to unpack .../libnode72_12.22.9~dfsg-1ubuntu3.4_amd64.deb ...
Unpacking libnode72:amd64 (12.22.9~dfsg-1ubuntu3.4) ...
Setting up libnode72:amd64 (12.22.9~dfsg-1ubuntu3.4) ...
Processing triggers for libc-bin (2.35-0ubuntu3.6) ...

# 7.
$ sudo apt install nodejs=12.22.9~dfsg-1ubuntu3.4
Reading package lists... Done
Building dependency tree... Done
Reading state information... Done
Suggested packages:
  npm
The following NEW packages will be installed:
  nodejs
0 upgraded, 1 newly installed, 0 to remove and 343 not upgraded.
Need to get 122 kB of archives.
After this operation, 929 kB of additional disk space will be used.
Get:1 http://us.archive.ubuntu.com/ubuntu jammy-updates/universe amd64 nodejs amd64 12.22.9~dfsg-1ubuntu3.4 [122 kB]
Fetched 122 kB in 0s (265 kB/s)
Selecting previously unselected package nodejs.
(Reading database ... 408681 files and directories currently installed.)
Preparing to unpack .../nodejs_12.22.9~dfsg-1ubuntu3.4_amd64.deb ...
Unpacking nodejs (12.22.9~dfsg-1ubuntu3.4) ...
Setting up nodejs (12.22.9~dfsg-1ubuntu3.4) ...
update-alternatives: using /usr/bin/nodejs to provide /usr/bin/js (js) in auto mode
Processing triggers for man-db (2.10.2-1) ...

# 8.
$ sudo apt install npm
Reading package lists... Done
Building dependency tree... Done
Reading state information... Done
Some packages could not be installed. This may mean that you have
requested an impossible situation or if you are using the unstable
distribution that some required packages have not yet been created
or been moved out of Incoming.
The following information may help to resolve the situation:

The following packages have unmet dependencies:
 nodejs : Depends: libnode72 (= 12.22.9~dfsg-1ubuntu3.4) but 12.22.12~dfsg-1~deb11u4 is to be installed
E: Unable to correct problems, you have held broken packages.

# 9.
$ sudo apt show nodejs
Package: nodejs
Version: 12.22.12~dfsg-1~deb11u4
Priority: optional
Section: web
Maintainer: Debian Javascript Maintainers <email address hidden>
Installed-Size: 939 kB
Provides: node-types-node (= 12.20.55~12.22.12~dfsg-1~deb11u4)
Depends: libc6 (>= 2.2.5), libnode72 (= 12.22.12~dfsg-1~deb11u4)
Recommends: ca-certificates, nodejs-doc
Suggests: npm
Conflicts: nodejs-legacy
Breaks: node-babel-runtime (<< 7), node-typescript-types (<< 20210110~)
Replaces: nodejs-legacy
Homepage: https://nodejs.org/
Tag: devel::interpreter, devel::lang:ecmascript, devel::runtime, devel::web,
 implemented-in::c++, implemented-in::ecmascript,
 interface::commandline, interface::shell, protocol::dns,
 protocol::http, protocol::tcp, role::program, scope::application,
 works-with-format::json
Download-Size: 148 kB
APT-Sources: http://deb.debian.org/debian bullseye/main amd64 Packages
Description: evented I/O for V8 javascript - runtime executable
 Node.js is a platform built on Chrome's JavaScript runtime for easily
 building fast, scalable network applications. Node.js uses an
 event-driven, non-blocking I/O model that makes it lightweight and
 efficient, perfect for data-intensive real-time applications that run
 across distributed devices.
 .
 Node.js is bundled with several useful libraries to handle server
 tasks:
 .
 System, Events, Standard I/O, Modules, Timers, Child Processes, POSIX,
 HTTP, Multipart Parsing, TCP, DNS, Assert, Path, URL, Query Strings.

N: There are 2 additional records. Please use the '-a' switch to see them.

# 10.
$ sudo apt install npm=8.5.1~ds-1
Reading package lists... Done
Building dependency tree... Done
Reading state information... Done
Some packages could not be installed. This may mean that you have
requested an impossible situation or if you are using the unstable
distribution that some required packages have not yet been created
or been moved out of Incoming.
The following information may help to resolve the situation:

The following packages have unmet dependencies:
 nodejs : Depends: libnode72 (= 12.22.9~dfsg-1ubuntu3.4) but 12.22.12~dfsg-1~deb11u4 is to be installed
E: Unable to correct problems, you have held broken packages.

# 11.
$ apt-cache madison libnode72
 libnode72 | 12.22.12~dfsg-1~deb11u4 | http://deb.debian.org/debian bullseye/main amd64 Packages
 libnode72 | 12.22.9~dfsg-1ubuntu3.4 | http://us.archive.ubuntu.com/ubuntu jammy-updates/universe amd64 Packages
 libnode72 | 12.22.9~dfsg-1ubuntu3.4 | http://security.ubuntu.com/ubuntu jammy-security/universe amd64 Packages
 libnode72 | 12.22.9~dfsg-1ubuntu3 | http://us.archive.ubuntu.com/ubuntu jammy/universe amd64 Packages

$ apt-cache madison nodejs
    nodejs | 12.22.12~dfsg-1~deb11u4 | http://deb.debian.org/debian bullseye/main amd64 Packages
    nodejs | 12.22.9~dfsg-1ubuntu3.4 | http://us.archive.ubuntu.com/ubuntu jammy-updates/universe amd64 Packages
    nodejs | 12.22.9~dfsg-1ubuntu3.4 | http://security.ubuntu.com/ubuntu jammy-security/universe amd64 Packages
    nodejs | 12.22.9~dfsg-1ubuntu3 | http://us.archive.ubuntu.com/ubuntu jammy/universe amd64 Packages

$ apt-cache madison npm
       npm | 8.5.1~ds-1 | http://us.archive.ubuntu.com/ubuntu jammy/universe amd64 Packages
       npm | 8.5.1~ds-1 | http://us.archive.ubuntu.com/ubuntu jammy/universe i386 Packages
       npm | 7.5.2+ds-2 | http://deb.debian.org/debian bullseye/main amd64 Packages
       npm | 7.5.2+ds-2 | http://deb.debian.org/debian bullseye/main i386 Packages

To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.