进行 apt-get 升级或使用 apt-get 安装某些内容时出错

进行 apt-get 升级或使用 apt-get 安装某些内容时出错

我尝试在 Debian 9.0 服务器中安装或升级任何内容时遇到错误。

这就是终端返回给我的内容。

root@engelmar:~# apt-get upgrade
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:
 cdebconf : Depends: libdebian-installer4 (>= 0.110) but it is not installed
            Depends: libtextwrap1 but it is not installed
 libc-bin : Depends: libc6 (< 2.25) but 2.28-10 is installed
 libc-dev-bin : Depends: libc6 (< 2.25) but 2.28-10 is installed
 libc6-dev : Depends: libc6 (= 2.24-11+deb9u4) but 2.28-10 is installed
E: Unmet dependencies. Try 'apt --fix-broken install' with no packages (or specify a solution).
root@engelmar:~# 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:
  linux-libc-dev python-all sysstat
Use 'apt autoremove' to remove them.
The following additional packages will be installed:
  libdebian-installer4 libtextwrap1
The following packages will be REMOVED:
  build-essential g++ g++-6 libc-bin libc-dev-bin libc6-dev libexpat1-dev libpython-all-dev libpython-dev libpython2.7-dev libstdc++-6-dev python-all-dev python-dev
  python2.7-dev
The following NEW packages will be installed:
  libdebian-installer4 libtextwrap1
WARNING: The following essential packages will be removed.
This should NOT be done unless you know exactly what you are doing!
  libc-bin
0 upgraded, 2 newly installed, 14 to remove and 0 not upgraded.
5 not fully installed or removed.
Need to get 0 B/201 kB of archives.
After this operation, 102 MB disk space will be freed.
You are about to do something potentially harmful.
To continue type in the phrase 'Yes, do as I say!'
 ?] Yes, do as I say!
perl: warning: Setting locale failed.
perl: warning: Please check that your locale settings:
        LANGUAGE = "pt_BR:pt:en",
        LC_ALL = (unset),
        LANG = "pt_BR.UTF-8"
    are supported and installed on your system.
perl: warning: Falling back to the standard locale ("C").
locale: Cannot set LC_ALL to default locale: Arquivo ou diretório não encontrado
debconf: delaying package configuration, since apt-utils is not installed
dpkg: error processing package debconf (--configure):
 package is in a very bad inconsistent state; you should
 reinstall it before attempting configuration
Errors were encountered while processing:
 debconf
E: Sub-process /usr/bin/dpkg returned an error code (1)
root@engelmar:~#

有人知道如何修复它吗?

答案1

很抱歉,您的系统可能已损坏,无法合理修复。尝试向后确定发生了什么,您说您正在运行 Debian 9 系统,但您已从libc6以下位置安装了软件包Debian 10 (2.28)。这通常是由于尝试混合使用多个 Debian 版本或 Debian 衍生版本(例如 Ubuntu)的存储库而导致的。Debian 的 wiki 有一些关于这个主题的话要说:

不要制作 FrankenDebian

Debian Stable 不应与其他版本结合使用。如果您尝试安装当前 Debian 稳定版本中不可用的软件,那么为其他 Debian 版本添加存储库并不是一个好主意。这些问题可能不会立即发生,而是在您下次安装更新时发生。

事情可能会出现问题的原因是,为某个 Debian 版本打包的软件是为了与该版本的其他软件兼容而构建的。例如,在stretch系统上安装buster的软件包也可以安装更新版本的核心库,包括libc6。这会导致系统未经过测试或稳定,而是两者的混合体。

在这个阶段,您最好的选择可能是备份数据并重新安装操作系统,这一次确保没有存储库试图从不适合 Debian 9 的存储库中提取数据。

相关内容