升級系統到ubuntun到18.04後apt-get執行失敗

系統升級到18.04後執行apt-get install的時候報錯前端

root@zhf-maple:/home/zhf/桌面# apt-get install vim-scipts
E: 沒法得到鎖 /var/lib/dpkg/lock-frontend - open (11: 資源暫時不可用)
E: 沒法獲取 dpkg 前端鎖 (/var/lib/dpkg/lock-frontend),是否有其餘進程正佔用它?vim

這是由於升級後某些軟件包還在佔用apt資源,經過ps -aux | grep apt  查看哪些在佔用apt進程,下面紅色標紅的這些都是在佔用apt的進程frontend

root 5394 0.0 0.0 4628 772 ? Ss 14:36 0:00 /bin/sh /usr/lib/apt/apt.systemd.daily installspa

root 5405 0.0 0.0 4628 1660 ? S 14:36 0:00 /bin/sh /usr/lib/apt/apt.systemd.daily lock_is_held install進程

root 11471 0.0 0.0 55624 7128 pts/1 S+ 14:39 0:00 /usr/lib/apt/apt-helper download-file http://archive.canonical.com/pool/partner/a/adobe-flashplugin/adobe-flashplugin_20190409.1.orig.tar.gz /var/lib/update-notifier/package-data-downloads/partial/adobe-flashplugin_20190409.1.orig.tar.gz SHA256:b3ceaad9bfe610f0c6ea847b80a6cd3b6e5071c41efccc8974ea58d0e040fc9cip

_apt 11473 0.2 0.1 83828 9100 pts/1 S+ 14:39 0:01 /usr/lib/apt/methods/httpci

root 11564 0.0 0.0 55592 7184 ? S 14:39 0:00 /usr/lib/apt/apt-helper download-file http://archive.canonical.com/pool/partner/a/adobe-flashplugin/adobe-flashplugin_20190409.1.orig.tar.gz /var/lib/update-notifier/package-data-downloads/partial/adobe-flashplugin_20190409.1.orig.tar.gz SHA256:b3ceaad9bfe610f0c6ea847b80a6cd3b6e5071c41efccc8974ea58d0e040fc9c資源

_apt 11566 0.1 0.1 83828 9096 ? S 14:39 0:01 /usr/lib/apt/methods/httpget

root 12482 0.0 0.0 16180 1064 pts/2 S+ 14:52 0:00 grep --color=auto aptflash

 

執行kill命令殺掉這些進程

kill -9 5394

kill -9 5405

kill -9 11471

kill -9 11564

kill -9 11566

而後執行:

rm /var/cache/apt/archives/lock

 

 

rm /var/lib/dpkg/lock

 

 這樣就能順利執行apt-get install的命令了 

相關文章
相關標籤/搜索