问题描述
今天在使用 sudo sudo apt install node.js 的时候出现错误。错误如下:
ubuntu:~$ sudo sudo apt install node.js
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?
问题产生原因
apt 进程还在运行,导致文件被锁定。
解决方法
找到 apt 进程,并将其杀死。
$ ps -au|grep apt
root 1051 0.0 0.0 62860 4304 pts/0 T 11:35 0:00 sudo sudo apt install node.js
root 1052 0.0 0.0 62860 4208 pts/0 T 11:35 0:00 sudo apt install node.js
root 1053 1.0 1.1 145388 90864 pts/0 T 11:35 0:00 apt install node.js
ubuntu 1283 0.0 0.0 13772 1068 pts/0 S+ 11:36 0:00 grep --color=auto apt
ubuntu@VM-16-11-ubuntu:~$ sudo pkill -9 apt

其实直接 sudo pkill -9 apt 就可以了。

本文描述了在Ubuntu系统中使用apt安装Node.js时遇到的锁冲突问题及解决方法。当apt进程运行中,尝试再次使用apt会导致锁文件被占用,从而引发错误。解决策略为查找并终止apt相关进程。

被折叠的 条评论
为什么被折叠?



