I have a small Node.js app of my own running on a Raspberry Pi 3 B. A
apt full-upgrade bumped the nodejs packet from version 4.8.2 to
version 8.11.1, and in the process it removed the package
node-body-parser which I need. Trying to
apt install it again fails
with a message telling me that either I have requested an impossible
situation or I am using an unstable distribution, and that I have held
broken packages. Here is a transcript with the full message:
pi@sionludino:~ $ sudo apt update [...] All packages are up to date. pi@sionludino:~ $ sudo apt install node-body-parser Reading package lists... Done Building dependency tree 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: node-body-parser : Depends: node-raw-body (>= 1.2.0) but it is not going to be installed Depends: node-iconv (>= 2.1.4) but it is not going to be installed E: Unable to correct problems, you have held broken packages.
I can't make sense of this error message, which I find quite unhelpful. Am I requesting “an impossible situation”? Why is it impossible? Is the distribution I am using (an up to date Raspbian Stretch Lite) considered “the unstable distribution”? And what does “you have held broken packages” mean? I have not held anything that I am aware of.
For now, I have worked around this issue by using npm instead apt. However, since apt is my tool of choice for keeping my computers up to date, it's quite unsettling for me to see it fail in a way I cannot understand. Am I doing something wrong? Is this a bug in the Raspbian (or Debian) packages? If so, should I report it as such? Could I expect it to be fixed?
Edit 1: Following OyaMist Aeroponics’ comment, I googled “apt broken packages” and followed the advice from the first answer:
- The commands
sudo apt-get update --fix-missing,
sudo dpkg --configure -aand
sudo apt-get install -fran with no errors, but they did not help (
sudo apt install node-body-parserstill outputs the same error).
- There is no mention of in node-body-parser in /var/lib/dpkg/status
Edit 2: As suggested
dpkg -l | grep -v '^ii' does not show any package (only the list
dpkg --audit does not dot have any effect.
Edits 3 & 4: I don't think I have enabled the backports repository. Here is my /etc/apt/sources.list:
deb http://raspbian.raspberrypi.org/raspbian/ stretch main contrib non-free rpi # Uncomment line below then 'apt-get update' to enable 'apt-get source' #deb-src http://raspbian.raspberrypi.org/raspbian/ stretch main contrib non-free rpi
The directory /etc/apt/sources.list.d contains a single file named “raspi.list” with the following content:
deb http://archive.raspberrypi.org/debian/ stretch main ui # Uncomment line below then 'apt-get update' to enable 'apt-get source' #deb-src http://archive.raspberrypi.org/debian/ stretch main ui
I tried removing
sudo apt purge nodejs; sudo apt autoremove --purge; sudo apt clean)
and re-installing nodejs. I again got version 8.11.1:
pi@raspberrypi:~ $ sudo apt install nodejs [...] Get:4 http://archive.raspberrypi.org/debian stretch/main armhf nodejs armhf 8.11.1~dfsg-2~bpo9+1 [4 126 kB] [...] Selecting previously unselected package nodejs. Preparing to unpack .../nodejs_8.11.1~dfsg-2~bpo9+1_armhf.deb ... [...]
If I was really installing from backports, shouldn't the string "backports" appear on the "Get" line over there?