Ubuntu 14 中的 Apt-get 出现故障

Ubuntu 14 中的 Apt-get 出现故障

我无法安装或更新任何 Ubuntu 软件包或软件。当我尝试运行任何命令时,apt-get我收到以下错误。我尝试了以下命令:

sudo apt-get update
apt-get: symbol lookup error: apt-get: undefined symbol: _ZN11CommandLine10GetCommandEPKNS_8DispatchEjPKPKc

sudo apt-get install --reinstall apt
apt-get: symbol lookup error: apt-get: undefined symbol: _ZN11CommandLine10GetCommandEPKNS_8DispatchEjPKPKc

我尝试过以下解决方案:从以下位置下载 apt 包apt 包并尝试使用 dpkg 安装:

sudo dpkg -i apt_1.0.1ubuntu2.13_amd64.deb libapt-pkg4.12_0.8.16~exp12ubuntu10.21_amd64.deb
(Reading database ... 265812 files and directories currently installed.)
Preparing to unpack apt_1.0.1ubuntu2.13_amd64.deb ...
Unpacking apt (1.0.1ubuntu2.13) over (1.0.1ubuntu2.13) ...
Preparing to unpack libapt-pkg4.12_0.8.16~exp12ubuntu10.21_amd64.deb ...
Unpacking libapt-pkg4.12:amd64 (0.8.16~exp12ubuntu10.21) over 
(0.8.16~exp12ubuntu10.21) ...
dpkg: dependency problems prevent configuration of apt:
 apt depends on libapt-pkg4.12 (>= 0.9.16); however:
  Version of libapt-pkg4.12:amd64 on system is 0.8.16~exp12ubuntu10.21.

dpkg: error processing package apt (--install):
dependency problems - leaving unconfigured
Setting up libapt-pkg4.12:amd64 (0.8.16~exp12ubuntu10.21) ...
Processing triggers for man-db (2.6.7.1-1ubuntu1) ...
Processing triggers for libc-bin (2.19-0ubuntu6.7) ...
Errors were encountered while processing:
 apt

即使我尝试重新安装 Ubuntu,它也不起作用。

答案1

手动重新安装 的方法是正确的apt,但您需要对所有软件包执行相同的操作 apt源码包这也是该包的依赖项apt,即最重要的是libapt-pkg4.12

dpkg命令看起来类似于以下内容:

sudo dpkg -i apt_1.0.1ubuntu2.13_amd64.deb libapt-pkg4.12_1.0.1ubuntu2.13_amd64.deb

之后你应该:

  1. 检查存储库列表中没有以前版本的软件包存储库:

    grep -e '^\s*[^\s#].*trusty' /etc/apt/sources.list /etc/apt/sources.list.d/*.list
    

    应该有空的输出。

    如果你想绝对安全,恢复默认

  2. 更新本地包索引:

    sudo apt-get update
    
  3. 将 Precise 中可能剩余的软件包升级到 Trusty 中的较新版本:

    sudo apt-get dist-upgrade
    

相关内容