Unable to acquire the dpkg frontend lock


當運行sudo apt-get install/update/其他命令時,會出現如下提示:

E: 無法獲得鎖 /var/lib/dpkg/lock-frontend - open (11: 資源暫時不可用)
E: Unable to acquire the dpkg frontend lock (/var/lib/dpkg/lock-frontend), is another process using it?

出現這個問題的原因可能是:

在ubuntu系統的termial下,用apt-get install 安裝軟件的時候,如果在未完成下載的情況下將terminal close。此時 apt-get進程可能沒有結束。結果,如果再次運行apt-get install 命令安裝軟件時,出現如上錯誤。即有另一個程序正在占用apt-get install進程,由於它在運行時,會占用軟件源更新時的系統鎖(簡稱‘系統更新鎖’),此時資源被鎖。

我們只需要殺死之前的進程,釋放系統鎖就可以了:

ps -A|grep apt
顯示

921 ? 00:00:01 apt
然后執行

sudo kill 921
————————————————
ps -A 顯示所有進程,

grep apt 查找包含字符apt的進程

wczlinux@ubuntu:~/test$ sudo apt install gcc
E: Could not get lock /var/lib/dpkg/lock-frontend - open (11: Resource temporarily unavailable)
E: Unable to acquire the dpkg frontend lock (/var/lib/dpkg/lock-frontend), is another process using it?
wczlinux@ubuntu:~/test$ ps -A|grep apt
   921 ?        00:00:00 apt.systemd.dai
   961 ?        00:00:00 apt.systemd.dai
wczlinux@ubuntu:~/test$ sudo kill 921
wczlinux@ubuntu:~/test$ sudo kill 961
kill: (961): No such process
wczlinux@ubuntu:~/test$ gcc

 


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM