1

I was attempting to update my npm on a Raspbian Buster installation. The version provided by the package manager was not sufficient.

First I followed some of the suggestions in this thread and then tried upgrading to Bullseye using these instructions.

I'm not entirely sure if this started before or after attempting to upgrade to Bullseye, but now whenever I run sudo apt install <anything> it tells me that it cannot install any of the dependencies. When I try to reinstall an already installed package I get the error that it cannot download the package. Here are two examples:

% sudo apt install nodejs
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:
 nodejs : Depends: libnode72 (= 12.22.12~dfsg-1~deb11u4) but it is not going to be installed
E: Unable to correct problems, you have held broken packages.
% sudo apt reinstall vim
Reading package lists... Done
Building dependency tree
Reading state information... Done
Reinstallation of vim is not possible, it cannot be downloaded.
0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.

The system is fully updated and upgraded (as far as I can tell):

% sudo apt update && sudo apt full-upgrade && sudo apt dist-upgrade
Hit:1 http://raspbian.raspberrypi.org/raspbian bullseye InRelease
Reading package lists... Done
Building dependency tree
Reading state information... Done
All packages are up to date.
Reading package lists... Done
Building dependency tree
Reading state information... Done
Calculating upgrade... Done
0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.
Reading package lists... Done
Building dependency tree
Reading state information... Done
Calculating upgrade... Done
0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.

No packages appear to be on hold:

% sudo apt-mark showhold
%

I tried various fixes suggested on the internet:

% sudo apt --fix-broken install
%

and

% sudo dpkg --configure -a
%

No results. I also renamed some *.list files to *.list.bak in /etc/apt/sources.list.d, but I believe I did that only after the issue started in an attempt to resolve it.

How do I recover my package manager to make it useable again?

Edits:

Output of apt policy nodejs

% sudo apt policy nodejs
nodejs:
  Installed: (none)
  Candidate: 12.22.12~dfsg-1~deb11u4
  Version table:
     12.22.12~dfsg-1~deb11u4 50
         50 http://raspbian.raspberrypi.org/raspbian bullseye/main armhf Packages

Contents of /etc/apt/sources.list

% cat /etc/apt/sources.list
deb http://raspbian.raspberrypi.org/raspbian/ bullseye main contrib non-free rpi
# Uncomment line below then 'apt-get update' to enable 'apt-get source'
#deb-src http://raspbian.raspberrypi.org/raspbian/ buster main contrib non-free rpi

Output of uname -m

% uname -m                                                                                                                                                                                                              
armv7l

Output of lsb_release -a:

% lsb_release -a
No LSB modules are available.
Distributor ID: Raspbian
Description:    Raspbian GNU/Linux 10 (buster)
Release:        10
Codename:       buster

Noteworthy: it still lists as buster, not bullseye.

Progress Edit: So, I mentioned above that I followed these instructions to try to upgrade my npm. I believe this to have added an entry in sources.list.d, which I had disabled again. Enabling this entry again allowed me to run apt install nodejs. I tried installing some other packages, e.g. sudo apt install cowsay which succeeded. I then proceeded to try to run reinstall for those new packages sudo apt reinstall cowsay which also succeeded. Trying to reinstall packages that had been installed before continued to fail with a message that the package cannot be downloaded. When I manually uninstall and reinstall the package however, it succeeded: sudo apt remove nano && sudo apt install nano. Reinstalling after a manual uninstall and install succeeds now: sudo apt reinstall nano.

However, trying to install other packages continues to fail. E.g. installing npm fails with a long list of node-* dependencies (including nodejs which I just manually installed). Also, trying to install e.g. aptitude (which was recommended in some sources as being potentially able to recover a borked apt system) fails:

% sudo apt install aptitude
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:
 aptitude : Depends: libapt-pkg6.0 (>= 1.9.0) but it is not going to be installed
            Depends: libstdc++6 (>= 9) but 8.3.0-6+rpi1 is to be installed
            Depends: libxapian30 (>= 1.4.17~) but it is not going to be installed
E: Unable to correct problems, you have held broken packages.

So while there was some progress (being able to install nodejs) it seams I'm still not out of the woodwork.

4
  • please add the output of apt policy nodejs to your question. Jun 3, 2023 at 1:57
  • 1
    Hi Daniel, nice having you here, and welcome to the community. You said you modified /etc/apt/sources.list; my best bet is that there's a subtle typo in there or something. Please edit your question to contain the contents of that file :) Jun 3, 2023 at 10:21
  • Thank you! I provided the both in the edits above. Jun 3, 2023 at 14:53
  • Raspbian 32bit or 64bit ?
    – Z0OM
    Jun 3, 2023 at 15:29

1 Answer 1

0

What is up with the different repositories and URLs?

Presumably you have installed Raspberry Pi OS 64bit on the newer Pi. This uses the standard Debian ARM64 repository not the Raspbian. The firmware is still provided by Raspberry Pi Ltd. and the source is the same for 32/64 bit

Try this:

deb http://archive.raspberrypi.org/debian/ bullseye main

Check this to:

Upgrading your Raspberry Pi to Bullseye

Raspbian 32bit vs 64bit - very different apt sources.list

Raspberry PI OS/Debian 11 Bullseye APT Repos

Or try this:

/etc/apt/sources.list

deb http://mirrordirector.raspbian.org/raspbian/ bullseye main contrib non-free rpi

/etc/apt/sources.list.d/raspi.list

deb http://archive.raspberrypi.org/debian/ bullseye main

Update:

apt-get update

apt-get dist-upgrade

Clean & remove:

apt-get autoremove

apt-get autoclean

EDIT/UPDATE:

  1. Make a backup of /etc/apt/ and /var/lib/apt/lists/

  2. Delete or move your modifief list entries

mv /etc/apt/sources.list.d/MY_FILES.list /BACKUP/

  1. Remove the existing package lists and clean the package cache

rm -rf /var/lib/apt/lists/*

apt clean

  1. Restore your original sources.list from a backup or create one with the default sources.list

cp /usr/share/doc/apt/examples/sources.list /etc/apt/sources.list

  1. Update

apt update

  1. Reinstall base package

apt --reinstall install raspberrypi-sys-mods raspberrypi-kernel raspberrypi-bootloader

If you have made extensive changes to your system it might be necessary to reinstalling your operating system.

12
  • Check what and if that works for you and then edit the answer post pls^^
    – Z0OM
    Jun 3, 2023 at 16:00
  • I'm not sure I fully follow the first part of your post (up to "Or try this"). I followed the links but wasn't really sure what I am looking for. I did try the changes listed below, but to the same results as stated before. Jun 3, 2023 at 16:50
  • Ok so both deb sources don't work archive and mirrordirector ?
    – Z0OM
    Jun 3, 2023 at 16:53
  • Have you check the descriptions in the links?
    – Z0OM
    Jun 3, 2023 at 16:54
  • 1
    Let us continue this discussion in chat.
    – Z0OM
    Jun 3, 2023 at 17:13

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .