在我的 Raspberry Pi 上执行“sudo apt-get dist-upgrade”时,在等待用户输入时,我的 ssh 连接被重置了。我没有在屏幕上运行。最后几行如下所示:
Installing new version of config file /etc/init.d/procps ...
Configuration file '/etc/sysctl.conf'
==> Modified (by you or by a script) since installation.
==> Package distributor has shipped an updated version.
What would you like to do about it ? Your options are:
Y or I : install the package maintainer's version
N or O : keep your currently-installed version
D : show the differences between the versions
Z : start a shell to examine the situation
The default action is to keep your current version.
*** sysctl.conf (Y/I/N/O/D/Z) [default=N] ? Connection reset by <ip>
“ps” 仍然显示旧的 apt-get 进程正在运行......
$ ps -aux | grep apt
root 2375 0.0 0.3 6008 1636 ? S 03:03 0:00 sudo apt-get dist-upgrade
root 2376 0.0 6.2 33428 27872 ? S 03:03 0:18 apt-get dist-upgrade
/var/cache/apt/archives 中有 1.1G,无法成功尝试新的 apt-get dist-upgrade。
$ sudo apt-get dist-upgrade
E: Could not get lock /var/lib/dpkg/lock - open (11: Resource temporarily unavailable)
E: Unable to lock the administration directory (/var/lib/dpkg/), is another process using it?
我现在该怎么办?有什么方法可以恢复正在进行的 dist-upgrade 吗?如果没有,有什么好方法可以退出并重试?
答案1
您可以kill
apt-get 并在运行后再次运行它dpkg --configure --pending
来配置以前已安装的软件包。
如果由于系统崩溃而无法继续,您可以尝试使用 apt-get 进行修复:
apt-get --fix-broken install
在 Unix & Linux 上看到类似的问题,https://unix.stackexchange.com/questions/46534/how-to-safely-resume-an-aptitude-dist-upgrade-after-ssh-timeout。