20

我的系统在 WSL 中运行,我至少每隔几天升级一次。我坚持安装一个软件包,并寻找解决此问题的方法:

$ 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)

接下来我可以尝试什么?

4

2 回答 2

64

我遇到了同样的问题,这个错误报告中的这个过程修复了它:

编辑/var/lib/dpkg/info/libc6\:amd64.postinst

并注释掉该行

# set -e

所以 $apt-get -f install可以继续。

于 2020-05-09T13:08:29.927 回答
8

您可以使用此命令序列(最多 3 个)来强制重新下载有问题的软件包的部分文件。完成剩余步骤以将新文件与旧文件合并,以避免在此尝试中未下载的非违规软件包出现警告和问题。

  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
于 2020-04-20T15:12:48.107 回答