0

Background

I was attempting to upgrade my libc6 version in a "not" nice way. It all started with me trying to update my MariaDB from 10.1 to 10.2. I somehow then managed to find out that libc6=1.24 that was installed, was not good enough, and that it required libc6=1.27. I managed to break my installation, when I used dpkg -i on a downloaded package here: http://archive.ubuntu.com/ubuntu/pool/main/g/glibc/ (specifically libc6_2.27-3ubuntu1_amd64.deb). I allowed it to automatically deconfigure my other packages, and this is when I know I ruined it.

My system is running

root@redfox:~# lsb_release -a
No LSB modules are available.
Distributor ID: Debian
Description:    Debian GNU/Linux 9.13 (stretch)
Release:    9.13
Codename:   stretch

Current issue

Now, whenever i try to use dpkg, or try to run apt-get upgrade I run in to missing programs and also having missing / broken dependencies. Here is output:

root@redfox:~# sudo apt-get install -f
Reading package lists... Done
Building dependency tree       
Reading state information... Done
Correcting dependencies... Done
The following packages were automatically installed and are no longer required:
  cups-core-drivers hplip-data libart-2.0-2 libcupscgi1 libgutenprint2 libsane-hpaio python3-pexpect python3-pil python3-ptyprocess
  python3-renderpm python3-reportlab python3-reportlab-accel
Use 'sudo apt autoremove' to remove them.
The following packages will be REMOVED:
  hplip libgcc1:i386 printer-driver-gutenprint printer-driver-hpcups printer-driver-postscript-hp
0 upgraded, 0 newly installed, 5 to remove and 0 not upgraded.
1 not fully installed or removed.
After this operation, 4370 kB disk space will be freed.
Do you want to continue? [Y/n] n
Abort.
root@redfox:~# dpkg --configure -a
dpkg: warning: 'ldconfig' not found in PATH or not executable
dpkg: error: 1 expected program not found in PATH or not executable
Note: root's PATH should usually contain /usr/local/sbin, /usr/sbin and /sbin

What have I done to try to fix it?

I have attempted to downgrade to libc6 version 1.24 again, but I am not sure if that worked out too well. I have also tried to clear package cache, autoclean etc, but I am unfortunately quite stuck on where to go next. I have tried to research what I can do, but it is hard to understand as I feel this is a very specific problem to my state, unfortunately.

Edit #1

I have tried to cp /bin/true /sbin/ldconfig, as I found that /sbin/ldconfig was missing. However, it seems like the system is even more damaged than first assumed. Here is output when i try to install packages suggested in the answer of Stephen Kitt below:

sudo dpkg -i libc-bin_2.24-11+deb9u4_amd64.deb locales_2.24-11+deb9u4_all.deb
Selecting previously unselected package libc-bin.
(Reading database ... 202484 files and directories currently installed.)
Preparing to unpack libc-bin_2.24-11+deb9u4_amd64.deb ...
Unpacking libc-bin (2.24-11+deb9u4) ...
Selecting previously unselected package locales.
Preparing to unpack locales_2.24-11+deb9u4_all.deb ...
Unpacking locales (2.24-11+deb9u4) ...
dpkg: dependency problems prevent configuration of libc-bin:
 libc-bin depends on libc6 (>> 2.24); however:
  Package libc6:amd64 is not configured yet.
 libc-bin depends on libc6 (<< 2.25); however:
  Version of libc6:amd64 on system is 2.27-3ubuntu1.

dpkg: error processing package libc-bin (--install):
 dependency problems - leaving unconfigured
dpkg: dependency problems prevent configuration of locales:
 locales depends on libc-bin (>> 2.24); however:
  Package libc-bin is not configured yet.
 libc6:amd64 (2.27-3ubuntu1) breaks locales (<< 2.27) and is unpacked but not configured.
  Version of locales to be configured is 2.24-11+deb9u4.

dpkg: error processing package locales (--install):
 dependency problems - leaving unconfigured
Errors were encountered while processing:
 libc-bin
 locales
3

You probably need to re-install all the libc-related packages, in particular libc6 itself, libc-bin, locales, and libc-l10n:

wget http://deb.debian.org/debian/pool/main/g/glibc/libc6_2.24-11+deb9u4_amd64.deb http://deb.debian.org/debian/pool/main/g/glibc/libc-bin_2.24-11+deb9u4_amd64.deb http://deb.debian.org/debian/pool/main/g/glibc/locales_2.24-11+deb9u4_all.deb http://deb.debian.org/debian/pool/main/g/glibc/libc-l10n_2.24-11+deb9u4_all.deb
dpkg -i libc6_2.24-11+deb9u4_amd64.deb libc-bin_2.24-11+deb9u4_amd64.deb locales_2.24-11+deb9u4_all.deb libc-l10n_2.24-11+deb9u4_all.deb

Check your PATH too (see the last error message shown in your question).

Since your /sbin/ldconfig is gone, you’ll need to fudge things a little to get dpkg to install the packages:

cp /bin/true /sbin/ldconfig

This will allow dpkg to proceed enough to get the real ldconfig installed.

  • Thank you Stephen. I am however sure that my path is correct (I tried to set the path env as I run the command as well to make sure) and as well as checking .bashrc. I am afraid that the bin is actually missing, as in the program it uses, does not exist. Echoing $PATH returns the following: /usr/local/bin:/usr/bin:/bin:/usr/local/games:/usr/games. That again means that I am unable to use dpkg to install the packages you suggested. EDIT: I realise that /sbin is not present. Will try that now. – denNorske Nov 2 '20 at 16:24
  • 1
    Your PATH is incorrect if you checked it as root (as indicated by the prompts in your question): it must include /sbin and /usr/sbin for root (ldconfig is in /sbin). – Stephen Kitt Nov 2 '20 at 16:27
  • Thank you again. I sourced an updated file in /root/.bashrc, now including: /usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games. I do apologise if this is a very trivial problem, but I don't understand why it doesn't catch. I have also tried to run echo $PATH as root and my change is present. Do I need to do anything extra to let dpkg aware of this $PATH? EDIT: I just checked manually in /sbin and the program is not present. – denNorske Nov 2 '20 at 16:39
  • See the update, you can cheat a bit for ldconfig. Your changes are good enough for PATH. – Stephen Kitt Nov 2 '20 at 16:52
  • Awesome, seems like more is broken. I added my output to the question under "Edit #1". – denNorske Nov 2 '20 at 16:59
0

Try running apt-get upgrade -f -f tries to fix missing or broken packages. If this does not succed, please post full output.

futher options when automatic fix fails:

  • Locate broken packge and try to remove it and then reinstall it by sources.
  • Check echo $PATH to make sure it contains the correct locations.

Tip: If you need new packages for debian do not use ubuntu packages. these may work, but have a high chance breaking the system. A better source for a debian system are the packages from the unstable / testing branch of debian. An other Option is to use the "backports". These packages require as few new libs as possible for much newer Version of the target software.

  • The question shows that -f has already been tried. – Stephen Kitt Nov 2 '20 at 6:55
  • But the output is incomplete. Process was aborted, before a meaningfull error was given. – DasKeks Nov 3 '20 at 8:21

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.