![連線重置後如何恢復或放棄 apt-get dist-upgrade?](https://rvso.com/image/1475791/%E9%80%A3%E7%B7%9A%E9%87%8D%E7%BD%AE%E5%BE%8C%E5%A6%82%E4%BD%95%E6%81%A2%E5%BE%A9%E6%88%96%E6%94%BE%E6%A3%84%20apt-get%20dist-upgrade%EF%BC%9F.png)
在我的 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 升級嗎?如果沒有,退出並重試的好方法是什麼?
答案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。