apt-get升级过程中出现错误怎么办?

apt-get升级过程中出现错误怎么办?

在之前检查可用磁盘空间之前,我不小心运行了 apt-get update、apt-get dist-upgrade...我几乎不知道我的根/分区被一些日志错误填满了。所以在更新过程中我遇到了这两个错误:

gdbm fatal: read error

/usr/bin/mandb: can't write to /var/cache/man/26407: No space left on device

除了这些警告之外,升级显然已成功完成。这是完整的升级日志:

root@titan:~# apt-get dist-upgrade
Reading package lists... Done
Building dependency tree       
Reading state information... Done
Calculating upgrade... Done
The following packages will be upgraded:
  libperl5.14 libssl-dev libssl-doc libssl1.0.0 linux-headers-3.2.0-4-amd64 linux-headers-3.2.0-4-common linux-image-3.2.0-4-amd64 linux-libc-dev openssl perl perl-base
  perl-modules
12 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.
Need to get 42.9 MB of archives.
After this operation, 1,041 kB of additional disk space will be used.
Do you want to continue [Y/n]? Y
Get:1 http://security.debian.org/ wheezy/updates/main perl amd64 5.14.2-21+deb7u3 [4,429 kB]
Get:2 http://security.debian.org/ wheezy/updates/main libperl5.14 amd64 5.14.2-21+deb7u3 [1,188 B]
Get:3 http://security.debian.org/ wheezy/updates/main perl-base amd64 5.14.2-21+deb7u3 [1,522 kB]
Get:4 http://security.debian.org/ wheezy/updates/main perl-modules all 5.14.2-21+deb7u3 [3,444 kB]
Get:5 http://security.debian.org/ wheezy/updates/main libssl-doc all 1.0.1e-2+deb7u20 [1,198 kB]
Get:6 http://security.debian.org/ wheezy/updates/main libssl-dev amd64 1.0.1e-2+deb7u20 [1,759 kB]
Get:7 http://security.debian.org/ wheezy/updates/main libssl1.0.0 amd64 1.0.1e-2+deb7u20 [1,263 kB]
Get:8 http://security.debian.org/ wheezy/updates/main linux-image-3.2.0-4-amd64 amd64 3.2.73-2+deb7u3 [23.5 MB]
Get:9 http://security.debian.org/ wheezy/updates/main linux-headers-3.2.0-4-amd64 amd64 3.2.73-2+deb7u3 [639 kB]                                                           
Get:10 http://security.debian.org/ wheezy/updates/main linux-headers-3.2.0-4-common amd64 3.2.73-2+deb7u3 [3,605 kB]                                                       
Get:11 http://security.debian.org/ wheezy/updates/main linux-libc-dev amd64 3.2.73-2+deb7u3 [848 kB]                                                                       
Get:12 http://security.debian.org/ wheezy/updates/main openssl amd64 1.0.1e-2+deb7u20 [702 kB]                                                                             
Fetched 42.9 MB in 9s (4,400 kB/s)                                                                                                                                         
Reading changelogs... Done
Preconfiguring packages ...
(Reading database ... 60824 files and directories currently installed.)
Preparing to replace perl 5.14.2-21+deb7u2 (using .../perl_5.14.2-21+deb7u3_amd64.deb) ...
Unpacking replacement perl ...
Preparing to replace libperl5.14 5.14.2-21+deb7u2 (using .../libperl5.14_5.14.2-21+deb7u3_amd64.deb) ...
Unpacking replacement libperl5.14 ...
Preparing to replace perl-base 5.14.2-21+deb7u2 (using .../perl-base_5.14.2-21+deb7u3_amd64.deb) ...
Unpacking replacement perl-base ...
Processing triggers for man-db ...
gdbm fatal: read error
Setting up perl-base (5.14.2-21+deb7u3) ...
(Reading database ... 60824 files and directories currently installed.)
Preparing to replace perl-modules 5.14.2-21+deb7u2 (using .../perl-modules_5.14.2-21+deb7u3_all.deb) ...
Unpacking replacement perl-modules ...
Preparing to replace libssl-doc 1.0.1e-2+deb7u19 (using .../libssl-doc_1.0.1e-2+deb7u20_all.deb) ...
Unpacking replacement libssl-doc ...
Preparing to replace libssl-dev 1.0.1e-2+deb7u19 (using .../libssl-dev_1.0.1e-2+deb7u20_amd64.deb) ...
Unpacking replacement libssl-dev ...
Preparing to replace libssl1.0.0:amd64 1.0.1e-2+deb7u19 (using .../libssl1.0.0_1.0.1e-2+deb7u20_amd64.deb) ...
Unpacking replacement libssl1.0.0:amd64 ...
Preparing to replace linux-image-3.2.0-4-amd64 3.2.73-2+deb7u2 (using .../linux-image-3.2.0-4-amd64_3.2.73-2+deb7u3_amd64.deb) ...
Unpacking replacement linux-image-3.2.0-4-amd64 ...
Examining /etc/kernel/postrm.d .
run-parts: executing /etc/kernel/postrm.d/initramfs-tools 3.2.0-4-amd64 /boot/vmlinuz-3.2.0-4-amd64
run-parts: executing /etc/kernel/postrm.d/zz-update-grub 3.2.0-4-amd64 /boot/vmlinuz-3.2.0-4-amd64
Preparing to replace linux-headers-3.2.0-4-amd64 3.2.73-2+deb7u2 (using .../linux-headers-3.2.0-4-amd64_3.2.73-2+deb7u3_amd64.deb) ...
Unpacking replacement linux-headers-3.2.0-4-amd64 ...
Preparing to replace linux-headers-3.2.0-4-common 3.2.73-2+deb7u2 (using .../linux-headers-3.2.0-4-common_3.2.73-2+deb7u3_amd64.deb) ...
Unpacking replacement linux-headers-3.2.0-4-common ...
Preparing to replace linux-libc-dev:amd64 3.2.73-2+deb7u2 (using .../linux-libc-dev_3.2.73-2+deb7u3_amd64.deb) ...
Unpacking replacement linux-libc-dev:amd64 ...
Preparing to replace openssl 1.0.1e-2+deb7u19 (using .../openssl_1.0.1e-2+deb7u20_amd64.deb) ...
Unpacking replacement openssl ...
Processing triggers for man-db ...
/usr/bin/mandb: can't write to /var/cache/man/26407: No space left on device
Setting up libperl5.14 (5.14.2-21+deb7u3) ...
Setting up libssl-doc (1.0.1e-2+deb7u20) ...
Setting up libssl1.0.0:amd64 (1.0.1e-2+deb7u20) ...
Setting up libssl-dev (1.0.1e-2+deb7u20) ...
Setting up linux-image-3.2.0-4-amd64 (3.2.73-2+deb7u3) ...
Running depmod.
Examining /etc/kernel/postinst.d.
run-parts: executing /etc/kernel/postinst.d/dkms 3.2.0-4-amd64 /boot/vmlinuz-3.2.0-4-amd64
run-parts: executing /etc/kernel/postinst.d/initramfs-tools 3.2.0-4-amd64 /boot/vmlinuz-3.2.0-4-amd64
update-initramfs: Generating /boot/initrd.img-3.2.0-4-amd64
run-parts: executing /etc/kernel/postinst.d/zz-update-grub 3.2.0-4-amd64 /boot/vmlinuz-3.2.0-4-amd64
Generating grub.cfg ...
Found linux image: /boot/vmlinuz-3.2.0-4-amd64
Found initrd image: /boot/initrd.img-3.2.0-4-amd64
done
Setting up linux-headers-3.2.0-4-common (3.2.73-2+deb7u3) ...
Setting up linux-headers-3.2.0-4-amd64 (3.2.73-2+deb7u3) ...
Examining /etc/kernel/header_postinst.d.
run-parts: executing /etc/kernel/header_postinst.d/dkms 3.2.0-4-amd64
Setting up linux-libc-dev:amd64 (3.2.73-2+deb7u3) ...
Setting up openssl (1.0.1e-2+deb7u20) ...
Setting up perl-modules (5.14.2-21+deb7u3) ...
Setting up perl (5.14.2-21+deb7u3) ...
root@titan:~#

当然,我跑的第一件事是:

root@titan:/# df
Filesystem                                             1K-blocks     Used Available Use% Mounted on
rootfs                                                   9611492  9124696         0 100% /

如果没有空间,apt-get 如何下载更新?(嗯,可能是 tmpfs,或者可能有足够的空间用于大部分更新)。我的问题是我现在如何检查我的系统是否搞砸了?跑步apt-get dist-upgrade再次显示没有错误并且无需执行任何操作。重新启动顺利,没有错误...但是我仍然想知道是否有办法验证以前的升级过程,或者以某种方式重复升级,甚至回滚上次升级(如果需要)? (这是 Debian Wheezy 7.9 安装)

答案1

  1. 它可能下载了这些软件包,因为在实际下载它们之前有足够的空间。

  2. 你跑步过apt-get clean或者apt-get autoclean最近跑步过吗?如果没有,您的/var/cache/apt/archives/目录(apt-get下载软件包的位置)可能会很大。试着du -sh /var/cache/apt/archives看看它有多大,然后apt-get clean

  3. 采取任何其他必要的步骤来释放更多磁盘空间,包括删除旧的日志文件。

  4. 如果apt-get dist-upgrade运行没有错误并且没有执行任何操作,则升级成功。没什么可做的了。

  5. dpkg --configure --pending如果没有,您可以通过首先运行配置任何安装一半的软件包,然后再次运行来重新进行升级apt-get dist-upgrade。它将重新下载所有必需的软件包(因为它们已被删除apt-get clean),然后安装它们。

如果升级严重混乱,您可能需要运行apt-get -f install(apt-get 会告诉您是否需要)甚至手动安装(或删除)dpkg之前的一些软件包apt-get,运行时不会出错。这可能看起来很可怕,但并不像看起来那么糟糕。要记住的关键是“不要惊慌!”。只需冷静而缓慢地对待它,仔细阅读任何错误消息,看看它正在抱怨哪个包,并在做任何事情之前三思而后行 - 惊慌、仓促、轻率的反应只会导致灾难。

  1. 如果您确实想强制重新安装这些软件包,请尝试:

    apt-get --reinstall install libperl5.14 libssl-dev libssl-doc libssl1.0.0 linux-headers-3.2.0-4-amd64 linux-headers-3.2.0-4-common linux-image-3.2.0-4-amd64 linux-libc-dev openssl perl perl-base perl-modules

即只需将包名称复制粘贴到apt-get --reinstall install命令行上即可。

相关内容