解决apt-get install因为无法获得锁,而不能安装问题
机器:ubuntu16.04
报错信息1:
解决方法:
1、首先查看下
ls -l /var/lib/dpkg/lock-frontend
ls -l /var/cache/apt/archives/lock
2、删除:(注意:下面这两个顺序千万别搞反)
rm /var/cache/apt/archives/lock -f
rm /var/lib/dpkg/lock-frontend -f
问题解决:
报错信息2:
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?
解决方法:
1、delete the lock file
sudo rm /var/lib/apt/lists/lock -f
2、delete the lock file in the cache directory
sudo rm /var/cache/apt/archives/lock
sudo rm /var/lib/dpkg/lock
参考博客:
https://blog.csdn.net/always_and_forever_/article/details/81001260