一、问题描述:
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杀死掉。
jack@ubuntu16:~$ ps aux|grep apt
root 3374 0.9 0.7 311676 123668 ? SNl 20:37 0:02 /usr/bin/python3 /usr/sbin/aptd
_apt 4272 0.0 0.0 63440 6460 ? SN 20:40 0:00 /usr/lib/apt/methods/http
_apt 4273 0.0 0.0 63440 6420 ? SN 20:40 0:00 /usr/lib/apt/methods/http
_apt 4274 0.4 0.0 63440 6048 ? SN 20:40 0:00 /usr/lib/apt/methods/http
_apt 4275 0.4 0.0 63440 6324 ? SN 20:40 0:00 /usr/lib/apt/methods/http
_apt 4276 0.0 0.0 63440 6380 ? SN 20:40 0:00 /usr/lib/apt/methods/http
_apt 4278 0.0 0.0 59104 6112 ? SN 20:40 0:00 /usr/lib/apt/methods/gpgv
_apt 4573 10.1 0.0 67488 14648 ? SN 20:40 0:07 /usr/lib/apt/methods/store
jack 4990 0.0 0.0 15968 1012 pts/2 S+ 20:42 0:00 grep --color=auto apt
jack@ubuntu16:~$ ps afx|grep apt
4996 pts/2 S+ 0:00 \_ grep --color=auto apt
3374 ? SNl 0:02 /usr/bin/python3 /usr/sbin/aptd
4272 ? SN 0:00 \_ /usr/lib/apt/methods/http
4273 ? SN 0:00 \_ /usr/lib/apt/methods/http
4274 ? SN 0:00 \_ /usr/lib/apt/methods/http
4275 ? SN 0:00 \_ /usr/lib/apt/methods/http
4276 ? SN 0:00 \_ /usr/lib/apt/methods/http
4278 ? SN 0:00 \_ /usr/lib/apt/methods/gpgv
4573 ? SN 0:07 \_ /usr/lib/apt/methods/store
jack@ubuntu16:~$ sudo kill 4272
jack@ubuntu16:~$ sudo kill 4273
jack@ubuntu16:~$ sudo kill 4274
jack@ubuntu16:~$ sudo kill 4275
jack@ubuntu16:~$ sudo kill 4276
jack@ubuntu16:~$ ps afx|grep apt
5189 pts/2 S+ 0:00 | \_ grep --color=auto apt
3374 ? SNl 0:03 /usr/bin/python3 /usr/sbin/aptd
jack@ubuntu16:~$ sudo kill 3374
然后就可以继续执行你的安装步骤了,
若是还出现问题则执行下面这行指令,手动删除 /var/lib/dpkg/lock
jack@ubuntu16:~$ sudo rm -rf /var/lib/dpkg/lock
参考文章:
https://www.cnblogs.com/lgjlife/p/11029463.html