0

I am having troubles with apt: whenever I try to upgrade, install or --fix-broken, I get an error and nothings get upgraded, installed nor fixed.

Below is an example of the error I get.

root@server:~$ apt upgrade
Reading package lists... Done
Building dependency tree... Done
Reading state information... Done
Calculating upgrade... Done
The following packages were automatically installed and are no longer required:
  libicu63 libperl5.28 libreadline7
Use 'apt autoremove' to remove them.
0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.
1 not fully installed or removed.
After this operation, 0 B of additional disk space will be used.
Do you want to continue? [Y/n] 
apt-listchanges: Can't set locale; make sure $LC_* and $LANG are correct!
perl: warning: Setting locale failed.
perl: warning: Please check that your locale settings:
    LANGUAGE = (unset),
    LC_ALL = (unset),
    LC_TIME = "it_IT.UTF-8",
    LC_MONETARY = "it_IT.UTF-8",
    LC_ADDRESS = "it_IT.UTF-8",
    LC_TELEPHONE = "it_IT.UTF-8",
    LC_NAME = "it_IT.UTF-8",
    LC_MEASUREMENT = "it_IT.UTF-8",
    LC_IDENTIFICATION = "it_IT.UTF-8",
    LC_NUMERIC = "it_IT.UTF-8",
    LC_PAPER = "it_IT.UTF-8",
    LANG = "C"
    are supported and installed on your system.
perl: warning: Falling back to the standard locale ("C").
Can't exec "locale": No such file or directory at /usr/share/perl5/Debconf/Encoding.pm line 16.
Use of uninitialized value $Debconf::Encoding::charmap in scalar chomp at /usr/share/perl5/Debconf/Encoding.pm line 17.
Setting up initramfs-tools (0.140) ...
update-initramfs: deferring update (trigger activated)
Processing triggers for initramfs-tools (0.140) ...
update-initramfs: Generating /boot/initrd.img-5.10.0-21-amd64
E: no ldd around - install libc-bin
update-initramfs: failed for /boot/initrd.img-5.10.0-21-amd64 with 1.
dpkg: error processing package initramfs-tools (--configure):
 installed initramfs-tools package post-installation script subprocess returned 
error exit status 1
Errors were encountered while processing:
 initramfs-tools
E: Sub-process /usr/bin/dpkg returned an error code (1)

Additional information:

root@server:~$ echo $PATH
/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/local/go/bin:/root/work/bin

Additional information 2:

root@server:~$ apt install libc-bin
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: libc-bin : Depends: libc6 (< 2.32) but 2.36-8 is to be installed E: Unable to correct problems, you have held broken packages.

I have also run: dpkg --install libc-bin_2.36-8_amd64.deb

Additional information 3:

root@server:~$ apt install locales
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:
 locales : Depends: libc-bin (> 2.31) but it is not going to be installed
           Depends: debconf (>= 0.5) but it is not going to be installed or
                    debconf-2.0
E: Unable to correct problems, you have held broken packages.
root@server:~$ apt install libc-bin
Reading package lists... Done
Building dependency tree... Done
Reading state information... Done
libc-bin is already the newest version (2.36-8).
The following packages were automatically installed and are no longer required:
  libicu63 libperl5.28 libreadline7
Use 'apt autoremove' to remove them.
0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.
root@server:~$ ldd --version ldd
ldd (Debian GLIBC 2.36-8) 2.36
Copyright (C) 2022 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.  There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
Written by Roland McGrath and Ulrich Drepper.

Additional information 4:

root@server:~$ apt policy
Package files:
 100 /var/lib/dpkg/status
     release a=now
 100 http://ftp.debian.org/debian bullseye-backports/non-free amd64 Packages
     release o=Debian Backports,a=bullseye-backports,n=bullseye-backports,l=Debian Backports,c=non-free,b=amd64
     origin ftp.debian.org
 100 http://ftp.debian.org/debian bullseye-backports/contrib amd64 Packages
     release o=Debian Backports,a=bullseye-backports,n=bullseye-backports,l=Debian Backports,c=contrib,b=amd64
     origin ftp.debian.org
 100 http://ftp.debian.org/debian bullseye-backports/main amd64 Packages
     release o=Debian Backports,a=bullseye-backports,n=bullseye-backports,l=Debian Backports,c=main,b=amd64
     origin ftp.debian.org
 500 http://security.debian.org/debian-security bullseye-security/main amd64 Packages
     release v=11,o=Debian,a=stable-security,n=bullseye-security,l=Debian-Security,c=main,b=amd64
     origin security.debian.org
 500 http://deb.debian.org/debian bullseye-updates/main amd64 Packages
     release v=11-updates,o=Debian,a=stable-updates,n=bullseye-updates,l=Debian,c=main,b=amd64
     origin deb.debian.org
 500 http://deb.debian.org/debian bullseye/non-free amd64 Packages
     release v=11.6,o=Debian,a=stable,n=bullseye,l=Debian,c=non-free,b=amd64
     origin deb.debian.org
 500 http://deb.debian.org/debian bullseye/contrib amd64 Packages
     release v=11.6,o=Debian,a=stable,n=bullseye,l=Debian,c=contrib,b=amd64
     origin deb.debian.org
 500 http://deb.debian.org/debian bullseye/main amd64 Packages
     release v=11.6,o=Debian,a=stable,n=bullseye,l=Debian,c=main,b=amd64
     origin deb.debian.org
Pinned packages:
Jeff Schaller
  • 67,283
  • 35
  • 116
  • 255
giovi321
  • 847

1 Answers1

1

The main error to consider here is

E: no ldd around - install libc-bin

Installing libc-bin should fix your ldd and locale errors:

sudo apt install libc-bin

Failing that, you can download the necessary packages and install them manually, as you did for libc-bin; you need to ensure the same version is used for all related packages, so for Debian 11:

wget http://deb.debian.org/debian/pool/main/g/glibc/locales_2.31-13+deb11u5_all.deb http://deb.debian.org/debian/pool/main/g/glibc/libc6_2.31-13+deb11u5_amd64.deb http://deb.debian.org/debian/pool/main/g/glibc/libc-bin_2.31-13+deb11u5_amd64.deb
sudo dpkg -i *_2.31-13+deb11u5*.deb
Stephen Kitt
  • 434,908