我在 Ubuntu 12.04 机器上执行了aptitude apt-get
然后,并得到:aptitude upgrade
root@li393-189:~# aptitude upgrade
Resolving dependencies...
The following packages will be upgraded:
accountsservice apache2 apache2-mpm-prefork apache2-utils apache2.2-bin
apache2.2-common apparmor apport apt-transport-https apt-utils bind9-host
dmsetup dnsutils icedtea-6-jre-cacao icedtea-6-jre-jamvm initramfs-tools
initramfs-tools-bin iptables isc-dhcp-client isc-dhcp-common
postfix-doc python-apport python-problem-report rsyslog sudo
ubuntu-minimal udev upstart
The following partially installed packages will be configured:
apt
The following packages are RECOMMENDED but will NOT be installed:
firefox-locale-en libssl-doc
76 packages upgraded, 0 newly installed, 0 to remove and 9 not upgraded.
Need to get 4,168 kB/60.3 MB of archives. After unpacking 1,225 kB will be used.
Do you want to continue? [Y/n/?] Y
Get: 1 http://us.archive.ubuntu.com/ubuntu/ precise-updates/main libdevmapper1.02.1 i386 2:1.02.48-4ubuntu7.3 [67.4 kB]
Get: 2 http://us.archive.ubuntu.com/ubuntu/ precise-updates/main dmsetup i386 2:1.02.48-4ubuntu7.3 [36.9 kB]
Get: 3 http://us.archive.ubuntu.com/ubuntu/ precise-updates/main libxml2 i386 2.7.8.dfsg-5.1ubuntu4.4 [662 kB]
Get: 4 http://us.archive.ubuntu.com/ubuntu/ precise-updates/main rsyslog i386 5.8.6-1ubuntu8.1 [431 kB]
Get: 5 http://us.archive.ubuntu.com/ubuntu/ precise-updates/main bind9-host i386 1:9.8.1.dfsg.P1-4ubuntu0.6 [54.0 kB]
Get: 6 http://us.archive.ubuntu.com/ubuntu/ precise-updates/main dnsutils i386 1:9.8.1.dfsg.P1-4ubuntu0.6 [143 kB]
Get: 7 http://us.archive.ubuntu.com/ubuntu/ precise-updates/main libisc83 i386 1:9.8.1.dfsg.P1-4ubuntu0.6 [161 kB]
Get: 8 http://us.archive.ubuntu.com/ubuntu/ precise-updates/main libdns81 i386 1:9.8.1.dfsg.P1-4ubuntu0.6 [705 kB]
Get: 9 http://us.archive.ubuntu.com/ubuntu/ precise-updates/main libisccc80 i386 1:9.8.1.dfsg.P1-4ubuntu0.6 [18.0 kB]
Get: 10 http://us.archive.ubuntu.com/ubuntu/ precise-updates/main libisccfg82 i386 1:9.8.1.dfsg.P1-4ubuntu0.6 [40.3 kB]
Get: 11 http://us.archive.ubuntu.com/ubuntu/ precise-updates/main liblwres80 i386 1:9.8.1.dfsg.P1-4ubuntu0.6 [38.8 kB]
Get: 12 http://us.archive.ubuntu.com/ubuntu/ precise-updates/main libbind9-80 i386 1:9.8.1.dfsg.P1-4ubuntu0.6 [24.4 kB]
Get: 13 http://us.archive.ubuntu.com/ubuntu/ precise-updates/main libruby1.8 i386 1.8.7.352-2ubuntu1.2 [1,787 kB]
Fetched 4,168 kB in 0s (11.4 MB/s)
Extracting templates from packages: 100%
Preconfiguring packages ...
postconf: warning: /etc/postfix/main.cf: unused parameter: virtual_create_maildirsize=yes
postconf: warning: /etc/postfix/main.cf: unused parameter: virtual_maildir_extended=yes
postconf: warning: /etc/postfix/main.cf: unused parameter: virtual_create_maildirsize=yes
postconf: warning: /etc/postfix/main.cf: unused parameter: virtual_maildir_extended=yes
postconf: warning: /etc/postfix/main.cf: unused parameter: virtual_create_maildirsize=yes
postconf: warning: /etc/postfix/main.cf: unused parameter: virtual_maildir_extended=yes
Setting up apt (0.8.16~exp12ubuntu10.10) ...
gpg: error while loading shared librariesgpg: error while loading shared libraries: libgdbm.so.2: cannot open shared object file: No such file or directory
: libgdbm.so.2: cannot open shared object file: No such file or directory
dpkg: error processing apt (--configure):
subprocess installed post-installation script returned error exit status 127
No apport report written because MaxReports is reached already
Errors were encountered while processing:
apt
E: Sub-process /usr/bin/dpkg returned an error code (1)
A package failed to install. Trying to recover:
Setting up apt (0.8.16~exp12ubuntu10.10) ...
gpg: error while loading shared libraries: libgdbm.so.2: cannot open shared object file: No such file or directory
gpg: error while loading shared libraries: libgdbm.so.2: cannot open shared object file: No such file or directory
dpkg: error processing apt (--configure):
subprocess installed post-installation script returned error exit status 127
Errors were encountered while processing:
apt
如何解决此错误并升级到最新的 Ubuntu 12.04 版本,然后将发行版升级到最新的 12.10 版本?
答案1
看来您之前中断了升级并支付了费用。
这应该会让你回到快乐的轨道上。
wget http://archive.ubuntu.com/ubuntu/pool/main/a/apt/apt_0.7.9ubuntu17_i386.deb
dpkg -i apt_0.7.9ubuntu17_i386.deb
答案2
apt
未完全配置。这里的“已配置”意味着文件存在于磁盘上,但程序运行所需的某些操作尚未完成(可以安装另一个包、更新库数据库、创建配置文件……)。
运行apt-get -f install
或dpkg --configure -a
完成半配置包的配置。如果这些命令都不起作用,请使用运行它们的记录更新您的问题。
答案3
apt
被打破只是偶然的。真正的问题是gpg
无法加载libgdbm
共享库。你需要更换那在做任何其他事情之前。
要获取 12.04 版本:
curl -LOC - http://archive.ubuntu.com/ubuntu/pool/main/g/gdbm/libgdbm3_1.8.3-10_i386.deb
dpkg -i libgdbm3_1.8.3-10_i386.deb
要获取 12.10 版本:
curl -LOC - http://kr.archive.ubuntu.com/ubuntu/pool/main/g/gdbm/libgdbm3_1.8.3-11_i386.deb
dpkg -i libgdbm3_1.8.3-11_i386.deb
我不确定您所拥有的 apt 版本到底需要哪一个,但其中任何一个都应该可以工作。不过,我的建议是先尝试 12.04,然后再尝试 12.10。修复此问题后,一切都应该重新开始工作。如果没有,请尝试 Georgyo 的建议。