E: Could not get lock /var/lib/dpkg/lock-frontend - open (11: Resource temporarily unavailable) E: U

在这里插入代码片@TOC

使用Linux中的apt工具时报错

我在写作业时,因为要安装gparted,执行sudo apt install gparted命令时直接报错,如图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?

小白我查遍无数资料,脑袋晕了一年终于解决了

那就是:
1.ps aux | grep -i apt
2.sudo killall apt apt-get (结果不管用。。。)如图:
找不到进程。。。
好吧,我可是打不死的小强!第三步来了!
3.lsof /var/lib/dpkg/lock
lsof /var/lib/apt/lists/lock
lsof /var/cache/apt/archives/lock
sudo rm /var/lib/apt/lists/lock
sudo rm /var/cache/apt/archives/lock
sudo rm /var/lib/dpkg/lock
sudo dpkg --configure -a

lsof /var/lib/dpkg/lock
lsof /var/lib/apt/lists/lock
lsof /var/cache/apt/archives/lock
sudo rm /var/lib/apt/lists/lock
sudo rm /var/cache/apt/archives/lock
sudo rm /var/lib/dpkg/lock
sudo dpkg --configure -a

4,本以为就可以搞定了,结果还是error,哭!如图:

E: Could not get lock /var/lib/dpkg/lock-frontend - open (11: Resource temporarily unavailable) E: U_第1张图片
dpkg: error: dpkg frontend lock is locked by another process不怕你那就再来!执行lsof /var/lib/dpkg/lock-frontend
sudo rm /var/lib/dpkg/lock-frontend
sudo dpkg --configure -a

lsof /var/lib/dpkg/lock-frontend
sudo rm /var/lib/dpkg/lock-frontend
sudo dpkg --configure -a

这下总可以了吧吧吧。呵呵果然还是想多了,执行sudo apt install gparted还是报错,,说什么E: Unable to locate package gparted
哭了。在这里插入图片描述
5.再再再来!执行sudo apt-get update

sudo apt-get update

这回终于成功了,看着满屏的不认识的英语竟然格外的开心E: Could not get lock /var/lib/dpkg/lock-frontend - open (11: Resource temporarily unavailable) E: U_第2张图片
6,sudo apt install gparted sudo apt install gpartedE: Could not get lock /var/lib/dpkg/lock-frontend - open (11: Resource temporarily unavailable) E: U_第3张图片
当当当大功告成!看着终端上的绿色进度条,觉得他真的好帅啊啊啊啊。希望对你有帮助吧,这还是我第一次写博客嘻嘻嘻

你可能感兴趣的:(Linux)