Linux报错'E: Could not get lock /var/lib/dpkg/lock-frontend快速解决

2d92ebe0376bf67968d2ac913f496f5b

经常在使用linux的过程中会出现这个错误

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?

为了给自己做个贴心的笔记,并且可以帮到遇到同样问题小伙伴。就有了如下的记录

这里以debian10为例,如果软件更新或者apt命令在后台运行的情况下

查询进程
ps -ef | grep apt-get

杀死进程
kill -9 apt apt-get

若没有起用作的话,那就进行删除吧

rm /var/cache/apt/archives/lock

rm /var/lib/dpkg/lock

rm /var/lib/dpkg/lock-frontend

然后重新配置

dpkg --configure -a

更新

apt update
THE END