连接重置后如何恢复或放弃 apt-get dist-upgrade?

Dav*_*vid 6 upgrade ssh debian apt-get

在我的 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>
Run Code Online (Sandbox Code Playgroud)

“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
Run Code Online (Sandbox Code Playgroud)

我在 /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?
Run Code Online (Sandbox Code Playgroud)

我现在该怎么办?有什么办法可以恢复正在进行的dist升级?如果没有,退出并重试的好方法是什么?

小智 10

您可以killapt-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