在安裝軟件包時如果出現(xiàn)Could not get lock /var/lib/dpkg/lock-frontend,說明之前使用apt時出現(xiàn)異常,沒有正常關閉,還在運行。 lgj@lgj-Lenovo-G470:~$ sudo apt-get install alien [sudo] password for lgj: 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? 解決,使用ps 和 grep查找apt的pid,并使用kill殺死掉。 lgj@lgj-Lenovo-G470:~$ ps afx|grep apt 16214 ? S 0:00 \_ sudo apt install rpm 16215 ? S 0:01 | \_ apt install rpm 16721 pts/3 S+ 0:00 \_ grep --color=auto apt lgj@lgj-Lenovo-G470:~$ kill 16214 bash: kill: (16214) - Operation not permitted lgj@lgj-Lenovo-G470:~$ sudo kill 16214 lgj@lgj-Lenovo-G470:~$ sudo kill 16215 執(zhí)行安裝指令 lgj@lgj-Lenovo-G470:~$ sudo apt-get install alien 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? 如果仍然出現(xiàn),需要手動刪除 /var/lib/dpkg/lock即可。 lgj@lgj-Lenovo-G470:~$ rm -rf /var/lib/dpkg/lock |
|