查看终端文本。“等待缓存锁定”错误。如何修复?我在 Ubuntu 21.04 上

查看终端文本。“等待缓存锁定”错误。如何修复?我在 Ubuntu 21.04 上
advait@advait-Bravo-15-A4DDR:~$ sudo apt install ubuntu-restricted-extras
Waiting for cache lock: Could not get lock /var/lib/dpkg/lock-frontend. It is held by process 43843 (synaptic)      
Waiting for cache lock: Could not get lock /var/lib/dpkg/lock-frontend. It is held by process 43843 (synaptic)      
Waiting for cache lock: Could not get lock /var/lib/dpkg/lock-frontend. It is held by process 43843 (synaptic)      
Waiting for cache lock: Could not get lock /var/lib/dpkg/lock-frontend. It is held by process 43843 (synaptic)      
Waiting for cache lock: Could not get lock /var/lib/dpkg/lock-frontend. It is held by process 43843 (synaptic)      
Waiting for cache lock: Could not get lock /var/lib/dpkg/lock-frontend. It is held by process 43843 (synaptic)  

答案1

您可以使用进程 ID 强制关闭该进程。

如果你的终端显示,

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

那么,您的案例中的进程 ID 是43843

要终止该进程,请使用此命令,

sudo kill 43843

答案2

关闭 synaptic 包管理器,“sudo apt install”命令将自动继续。

您不能同时打开两个与 APT 包管理系统协同工作的不同应用程序。

是的,我经常看到与您相同的消息;)

答案3

这个答案在 Unix 和 Linux SE 上斯蒂芬·查泽拉斯有一些有用的命令:

如果您想根据名称或参数列表终止进程,请使用 pkill。

pkill regexp

将终止名称与 regexp 扩展正则表达式匹配的所有进程。

pkill -f regexp

将终止所有参数列表(包括第一个通常包含命令名的参数列表)用空格连接的与正则表达式匹配的进程。

相关内容