如何修复此问题:“等待缓存锁:无法获取锁 /var/lib/dpkg/lock-frontend。它由进程 3321 (apt) 持有

如何修复此问题:“等待缓存锁:无法获取锁 /var/lib/dpkg/lock-frontend。它由进程 3321 (apt) 持有

我尝试过这个:

moncef@moncef-Latitude-E7270:~$ sudo apt install tor
Waiting for cache lock: Could not get lock /var/lib/dpkg/lock-frontend. It is held by process 3321 (apt)
Waiting for cache lock: Could not get lock /var/lib/dpkg/lock-frontend. It is held by process 3321 (apt)
Waiting for cache lock: Could not get lock /var/lib/dpkg/lock-frontend. It is held by process 3321 (apt)
Waiting for cache lock: Could not get lock /var/lib/dpkg/lock-frontend. It is held by process 3321 (apt)
Waiting for cache lock: Could not get lock /var/lib/dpkg/lock-frontend. It is held by process 3321 (apt)
Waiting for cache lock: Could not get lock /var/lib/dpkg/lock-frontend. It is held by process 3321 (apt)... 5s

这是我的命令历史记录:

  109  sudo apt install ubuntu-restricted-extras
  110  sudo snap install qbittorrent-arnatious
  111  exit
  112  shutdown -h now
  113  systemctl poweroff -i
  114  sudo
  115  sudo apt install nmap
  116  sudo dpkg --configure -a
  117  sudo apt install nmap
  118  nmap
  119  history
  120  sudo apt remove ubuntu-restricted-extras
  121  sudo apt-get remove ubuntu-restricted-extras
  122  sudo apt remove ubuntu-restricted-extras
  123  sudo apt install tor
  124  sudo apt-get install tor
  125  sudo dpkg --configure -a
  126  ps aux | grep -i apt
  127  shutdown -h now
  128  sudo apt install ubuntu-restricted-extras
  129  sudo apt install tor
  130  history
  131  sudo apt install ubuntu-restricted-extras
  132  history

答案1

您的系统上还有另一个apt实例正在运行,其 PID(在本例中)为 3321。您可以等到它完成,或者如果您真的很着急,可以使用以下命令终止它:

sudo kill 3321

如果没有效果则运行以下命令:

sudo kill -9 3321

使用错误给出的 PID 来代替 3321。

相关内容