Stuck with apt --fix-broken install (libc6:amd64 package post-installation)
Asked Answered
L

7

29

My system runs inside WSL, I upgrade it at least every few days. I stuck with one package installation, and looking for a way to solve this:

$ sudo apt --fix-broken install
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:
  libbind9-161 libdns-export1107 libdns1107 libdns1109 libirs161 libisc-export1104 libisc1104 libisc1105 libisccc161
  libisccfg163 liblwres161 liboauth0
Use 'sudo apt autoremove' to remove them.
The following additional packages will be installed:
  libc-bin
The following packages will be upgraded:
  libc-bin
1 upgraded, 0 newly installed, 0 to remove and 882 not upgraded.
6 not fully installed or removed.
Need to get 0 B/633 kB of archives.
After this operation, 8,192 B of additional disk space will be used.
Do you want to continue? [Y/n]
Setting up libc6:amd64 (2.31-0ubuntu6) ...
Checking for services that may need to be restarted...
Checking init scripts...
Nothing to restart.
sleep: cannot read realtime clock: Invalid argument
dpkg: error processing package libc6:amd64 (--configure):
 installed libc6:amd64 package post-installation script subprocess returned error exit status 1
Errors were encountered while processing:
 libc6:amd64
E: Sub-process /usr/bin/dpkg returned an error code (1)

What can I try next?

Lordsandladies answered 31/3, 2020 at 6:6 Comment(0)
O
74

I ran into the same problem, and this procedure from this bug report fixed it:

Edit /var/lib/dpkg/info/libc6\:amd64.postinst

and comment out the line

# set -e

so $ apt-get -f install can continue.

Ottie answered 9/5, 2020 at 13:8 Comment(13)
Thank you, it helped, finally I can transfer from testing to 20.04LTSLordsandladies
@AdamMierzwiak Be careful, this merely disables "stop on errors" in that post-install script; Ubuntu fossal doesn't officially work in WSL1, so it's probably better to upgrade to WSL2 before. This might not be the only problem.Ottie
Thank you for the warning, currently system is blocked on older Win10 than that supporting WSL2 by domain administratorLordsandladies
If you cannot spot it, it is the second line!Constructive
You have saved me!Meghannmegiddo
Thank you. I am having to switch to WSL after my cygwin installation ballsed up, figured may as well make the switch now but ran into this issue quickly. Thank you for a simple and accurate solution.Leonerd
This solution I used also to transform from Ubuntu 20.04 to 20.10 testing. Same problem appearsLordsandladies
I faced with the problem with kaliKnew
Next time you cant find what youre looking for, use nano, Ctrl + W and type the keyword and enter. It will move the cursor where that keyword is. If it's not that one, press Ctrl + W again and just press enter (memorises your last input). I use this alot and it helpsThiazole
I have been trying to fix this for hours now, you just saved me. BTW after that I ran apt update and dist upgrade to wrap things up.Dentilabial
this file not exist in my ubuntu 20.04.3 LTSKimble
best possible solutionOwain
My laptop got powered off while apt upgrade-ing the system and everything got broken up (no graphical interface and apt got stuck somehow because of unsatisfied dependencies, especially on libuim-data). Thanks to your tip, I could finish the process and then fix the last few bits from within the graphical interface.Stricken
I
22

You can use this sequence of commands (up to 3) to force a re-download of the partial files of the offending packages. Remaining steps are done to merge the new files with the old one, to avoid warnings and issues on non-offending packages that do not get downloaded in this attempt.

  1. sudo mv /var/lib/dpkg/info /var/lib/dpkg/info_old
  2. sudo mkdir /var/lib/dpkg/info
  3. sudo apt-get update && sudo apt-get -f install
  4. sudo mv /var/lib/dpkg/info/* /var/lib/dpkg/info_old
  5. sudo rm -rf /var/lib/dpkg/info 
  6. sudo mv /var/lib/dpkg/info_old /var/lib/dpkg/info
Ipecac answered 20/4, 2020 at 15:12 Comment(8)
``` libkmod: ERROR ../libkmod/libkmod-module.c:1668 kmod_module_new_from_loaded: could not open /proc/modules: No such file or directory Error: could not get list of modules: No such file or directory setting xserver-xorg-legacy/xwrapper/allowed_users from configuration file Setting up libc6:amd64 (2.31-0ubuntu9) ... sleep: cannot read realtime clock: Invalid argument dpkg: error processing package libc6:amd64 (--configure): installed libc6:amd64 package post-installation script subprocess returned error exit status 1 Errors were encountered while processing: libc6:amd64 ```Lordsandladies
What is the aim of steps 4 to 6? Seems like not visible effect from system standpoint or I miss something ?Lordsandladies
THanks @Ipecac you saved my day .... I was having trouble installing libmysqlclient-dev and only this solution workedSarrusophone
In my case it did not solved the issue, but I see that some other people issues were covered. Thank youLordsandladies
Steps 4-6 literally do nothing. Steps 1-3 didn't help me.Mignon
Solved an issue with borked docker configuration. Tx.Housemaster
In my situation, I used dpkg --configure -a instead of apt update && apt -f install and finally successfully fix it.Dynamite
This basically destroyed my shell, I had to refit the entire system to gain access again! Not a solution. -bash: /usr/bin/apt: cannot execute: required file not foundCamacho
H
9

I ran into the same problem when upgrading Kali Linux inside WSL. I used these sequence of commands to fix the issue

  1. cd /tmp
  2. apt -y download libcrypt1
  3. dpkg-deb -x libcrypt1_1%3a4.4.27-1.1_amd64.deb .
  4. cp -av lib/x86_64-linux-gnu/* /lib/x86_64-linux-gnu/
  5. apt -y --fix-broken install
Halves answered 11/6, 2022 at 7:47 Comment(1)
I ran into this upgrading debian 10 to debian 12. This fixed it!Thurman
B
5

If you are under WSL and you encounter this error, I tried the following and it solved my problem. (See https://github.com/microsoft/WSL/discussions/11035#discussioncomment-8149890)

Add the following to /etc/wsl.conf (or create it if it doesn't exist)

[boot]
systemd=true

Then update and reboot WSL (windows console or terminal)

wsl --update
wsl --shutdown
Buiron answered 25/4 at 12:24 Comment(0)
M
2

This problem, even if old, still occu.

The solution is to get into the terminal :

  1. cd /etc

  2. sudo nano (to open a text editor)

  3. Insert these 2 lines of code :

    [boot]                                                    
    systemd=true
    
  4. Save it as wsl.conf by using CTRL+S then exit with CTRL+X.

  5. Exit from the Linux terminal using the exit command, get into the powershell terminal and use wsl --update followed by wsl --shutdown, close the powershell and reopen Kali Linux.

  6. Try and do an sudo apt upgrade if you didn't manage to upgrade anything because of the error; if the problem occurred when trying to install anything then retry the installation; if the error still occurs then use sudo apt --fix-broken install.

Now the problem should be fixed.

Meyerhof answered 8/6 at 15:7 Comment(0)
G
1

I just had the same issue. For wine, I had to install libc6:i386, into an existing docker image.

I checked /var/lib/dpkg/info/libc6:i386.postinst and saw that there is a call to ischroot. Its source code (first search result though) didn't show me anything I could fake, but I was able to fake the whole tool by simply replacing it.

The result was the following line (note the mv and cp commands)

RUN dpkg --add-architecture i386 \
 && apt-get update \
 && mv -v /usr/bin/ischroot /usr/bin/ischroot.disabled \
 && cp -v /usr/bin/true /usr/bin/ischroot \
 && DEBIAN_FRONTEND=noninteractive apt-get install -y \
        wine32 \
 && mv -v /usr/bin/ischroot.disabled /usr/bin/ischroot \
 && apt-get clean
Gird answered 11/3 at 1:12 Comment(2)
Great hint! What is your usecase with wine?Lordsandladies
right now it's only an experimental platform. I hate polluting my host system with packages I install only once for a little test. I have multiple Linux GUI applications packed into docker images which run very nicely and safe, for example a sandboxed firefox environment or spotifyGird
S
0

set -x showed that in my case /usr/share/debconf/frontend /var/lib/dpkg/info/libc6:amd64.postinst hangs on

  • [ yes = yes ]
  • telinit u

doesn't match well with wsl

Sweeny answered 7/1 at 14:20 Comment(1)
As it’s currently written, your answer is unclear. Please edit to add additional details that will help others understand how this addresses the question asked. You can find more information on how to write good answers in the help center.Jaquelin

© 2022 - 2024 — McMap. All rights reserved.