由于软件包损坏,无法使用 apt/dpkg 安装或删除

由于软件包损坏,无法使用 apt/dpkg 安装或删除

Ubuntu 17.10

我做了一个sudo apt-get upgrade。然后我尝试安装 software-properties-common 接下来的事情是 mysql-server-5.7 出现错误,所以我尝试重新安装它,现在我尝试做的每件事都有错误,例如:

root@rtcserver:~# apt install software-properties-common 
Reading package lists... Done
Building dependency tree       
Reading state information... Done
You might want to run 'apt --fix-broken install' to correct these.
The following packages have unmet dependencies:
 libc-dev-bin : Depends: libc6 (> 2.27) but 2.26-0ubuntu2.1 is to be installed
 libc6-dev : Depends: libc6 (= 2.27-3ubuntu1) but 2.26-0ubuntu2.1 is to be installed
 libnss3 : Depends: libnspr4 (>= 2:4.12) but it is not going to be installed
 librados2 : Depends: libnspr4 (>= 2:4.9-2~) but it is not going to be installed
 software-properties-common : Depends: python3-software-properties (= 0.96.24.32.1) but 0.96.24.17 is to be installed
E: Unmet dependencies. Try 'apt --fix-broken install' with no packages (or specify a solution).

当我跑步的时候dpkg --configure -a

root@rtcserver:~# dpkg --configure -aProcessing triggers for libc-bin (2.26-0ubuntu2.1) ...
Setting up mssql-server (14.0.3023.8-5) ...
locale: Cannot set LC_ALL to default locale: No such file or directory
debconf: DbDriver "config": /var/cache/debconf/config.dat is locked by another process: Resource temporarily unavailable
dpkg: error processing package mssql-server (--configure):
 subprocess installed post-installation script returned error exit status 1
Setting up unattended-upgrades (0.98ubuntu1.1) ...
locale: Cannot set LC_ALL to default locale: No such file or directory
debconf: DbDriver "config": /var/cache/debconf/config.dat is locked by another process: Resource temporarily unavailable
dpkg: error processing package unattended-upgrades (--configure):
 subprocess installed post-installation script returned error exit status 1
Setting up libpam0g:amd64 (1.1.8-3.2ubuntu3.1) ...
locale: Cannot set LC_ALL to default locale: No such file or directory
debconf: DbDriver "config": /var/cache/debconf/config.dat is locked by another process: Resource temporarily unavailable
dpkg: error processing package libpam0g:amd64 (--configure):
 subprocess installed post-installation script returned error exit status 1
dpkg: dependency problems prevent configuration of libpam-systemd:amd64:
 libpam-systemd:amd64 depends on libpam0g (>= 0.99.7.1); however:
  Package libpam0g:amd64 is not configured yet.

dpkg: error processing package libpam-systemd:amd64 (--configure):
 dependency problems - leaving unconfigured
Processing triggers for libc-bin (2.26-0ubuntu2.1) ...
Errors were encountered while processing:
 mssql-server
 unattended-upgrades
 libpam0g:amd64
 libpam-systemd:amd64

当我尝试dpkg -r --force-remove-reinstreq libc-dev-bin libc6-dev libnss3 librados2

root@rtcserver:~# dpkg -r --force-remove-reinstreq libc-dev-bin libc6-dev libnss3 librados2 
dpkg: dependency problems prevent removal of libc6-dev:amd64:
 zlib1g-dev:amd64 depends on libc6-dev | libc-dev; however:
  Package libc6-dev:amd64 is to be removed.
  Package libc-dev is not installed.
  Package libc6-dev:amd64 which provides libc-dev is to be removed.
 libexpat1-dev:amd64 depends on libc6-dev | libc-dev; however:
  Package libc6-dev:amd64 is to be removed.
  Package libc-dev is not installed.
  Package libc6-dev:amd64 which provides libc-dev is to be removed.
 libstdc++-7-dev:amd64 depends on libc6-dev (>= 2.13-0ubuntu6).
 build-essential depends on libc6-dev | libc-dev; however:
  Package libc6-dev:amd64 is to be removed.
  Package libc-dev is not installed.
  Package libc6-dev:amd64 which provides libc-dev is to be removed.
 libpcre3-dev:amd64 depends on libc6-dev.
 libtool depends on libc6-dev | libc-dev; however:
  Package libc6-dev:amd64 is to be removed.
  Package libc-dev is not installed.
  Package libc6-dev:amd64 which provides libc-dev is to be removed.
 zlib1g-dev:amd64 depends on libc6-dev | libc-dev; however:
  Package libc6-dev:amd64 is to be removed.
  Package libc-dev is not installed.
  Package libc6-dev:amd64 which provides libc-dev is to be removed.
 libexpat1-dev:amd64 depends on libc6-dev | libc-dev; however:
  Package libc6-dev:amd64 is to be removed.
  Package libc-dev is not installed.
  Package libc6-dev:amd64 which provides libc-dev is to be removed.
 build-essential depends on libc6-dev | libc-dev; however:
  Package libc6-dev:amd64 is to be removed.
  Package libc-dev is not installed.
  Package libc6-dev:amd64 which provides libc-dev is to be removed.
 libtool depends on libc6-dev | libc-dev; however:
  Package libc6-dev:amd64 is to be removed.
  Package libc-dev is not installed.
  Package libc6-dev:amd64 which provides libc-dev is to be removed.

dpkg: error processing package libc6-dev:amd64 (--remove):
 dependency problems - not removing
dpkg: dependency problems prevent removal of libnss3:amd64:
 openjdk-8-jre-headless:amd64 depends on libnss3 (>= 2:3.17.1).
 liboauth0:amd64 depends on libnss3 (>= 2:3.13.4-2~).
 ca-certificates-java depends on libnss3 (>= 3.12.9+ckbi-1.82-0ubuntu3~).

dpkg: error processing package libnss3:amd64 (--remove):
 dependency problems - not removing
dpkg: dependency problems prevent removal of librados2:
 libcephfs2 depends on librados2 (>= 12.0.3).

dpkg: error processing package librados2 (--remove):
 dependency problems - not removing
dpkg: dependency problems prevent removal of libc-dev-bin:
 libc6-dev:amd64 depends on libc-dev-bin (= 2.27-3ubuntu1); however:
  Package libc-dev-bin is to be removed.

dpkg: error processing package libc-dev-bin (--remove):
 dependency problems - not removing
Errors were encountered while processing:
 libc6-dev:amd64
 libnss3:amd64
 librados2
 libc-dev-bin

当我尝试apt --fix-broken install

perl: warning: Falling back to a fallback locale ("C.UTF-8").
locale: Cannot set LC_ALL to default locale: No such file or directory
debconf: DbDriver "config": /var/cache/debconf/config.dat is locked by another process: Resource temporarily unavailable
(Reading database ... 127695 files and directories currently installed.)
Preparing to unpack .../libc6_2.27-3ubuntu1_amd64.deb ...
debconf: DbDriver "config": /var/cache/debconf/config.dat is locked by another process: Resource temporarily unavailable
dpkg: error processing archive /var/cache/apt/archives/libc6_2.27-3ubuntu1_amd64.deb (--unpack):
 subprocess new pre-installation script returned error exit status 1
Errors were encountered while processing:
 /var/cache/apt/archives/libc6_2.27-3ubuntu1_amd64.deb
E: Sub-process /usr/bin/dpkg returned an error code (1)

问题是我有未满足的依赖项,无法安装,而它们似乎每次安装都需要。有什么办法可以解决这个问题吗?

这也是一个我无法访问并重新启动的远程服务器。

编辑:看来我正在使用 Ubuntu 17.10 而不是 17.04

答案1

出于某种原因,这有效:

sudo rm /var/cache/debconf/*.dat 

正如我在这篇文章中发现的那样:

https://askubuntu.com/a/353423/826990

相关内容