Ubuntu Linux处理Waiting for cache lock: Could not get lock /var/lib/dpkg/lock-frontend. It is held by

问题

在Ubuntu中,执行apt install后,出现以下问题:

Waiting for cache lock: Could not get lock /var/lib/dpkg/lock-frontend. It is held by process 3365 (unattended-upgr)

看着描述就是有3365的进程进行占用了source文件。

解决办法:

删除锁定的文件

rm /var/lib/dpkg/lock-frontend 

实在没办法解除,直接进行干掉进程。

kill -9 3365 

注意:这里的3365是占用文件的进程号。