无法获取 dpkg 前端锁 (/var/lib/dpkg/lock-frontend),您是 root 吗?

无法获取 dpkg 前端锁 (/var/lib/dpkg/lock-frontend),您是 root 吗?
(base) rusiru@rusiru-X556UV:~$ sudo apt-get upgrade
Reading packages lists... Done
Building dependency tree
Reading state information... Done
E: The package packettracer needs to be installed, but I can't find an archive for it.
(base) rusiru@rusiru-X556UV:~$ sudo apt-get update
Hit:1 http://security.ubuntu.com/ubuntu focal-security InRelease
Hit:2 http://lk.archive.ubuntu.com/ubuntu focal InRelease
Hit:3 http://lk.archive.ubuntu.com/ubuntu focal-updates InRelease
Hit:4 http://lk.archive.ubuntu.com focal-backports InRelease
Reading package lists... Done
(base) rusiru@rusiru-X556UV:~$ sudo apt-get upgrade
Reading packages lists... Done
Building dependency tree
Reading state information... Done
E: The package packettracer needs to be installed, but I can't find an archive for it.
(base) rusiru@rusiru-X556UV:~$ sudo apt-get update && apt-get install --reinstall packettracer
Hit:1 http://security.ubuntu.com/ubuntu focal-security InRelease
Hit:2 http://lk.archive.ubuntu.com/ubuntu focal InRelease
Hit:3 http://lk.archive.ubuntu.com/ubuntu focal-updates InRelease
Hit:4 http://lk.archive.ubuntu.com focal-backports InRelease
Reading package lists... Done
E: Could not open lock file /var/lib/dpkg/lock-frontend - open (13: Permission denied)
E: Unable to acquire the dpkg frontend lock (/var/lib/dpkg/lock-frontend), are you root?
(base) rusiru@rusiru-X556UV:~$ sudo dpkg -l packettracer
Desired-Unknown/Install/Remove/Purge/Hold
| Status=Not/Inst/Conf-files/Unpacked/half-conf/Half-inst/trig-aWait/Trig-pend
|/ Err?=(none)/Reinst-required (Status,Err: uppercase=bad)
||/ Name           Version      Architecture Description
+++-==============-============-============-=================================
pHR packettracer   7.3.0        amd64        (no description available)
(base) rusiru@rusiru-X556UV:~$ sudo apt-get upgrade
Reading packages lists... Done
Building dependency tree
Reading state information... Done
E: The package packettracer needs to be installed, but I can't find an archive for it.
(base) rusiru@rusiru-X556UV:~$ 

我尝试过这个但没有成功。我怎样才能解决这个问题?

答案1

您的apt-get install --reinstall命令前面没有 sudo。

诸如以下的命令sudo x && y 仅有的在;x下运行命令sudoy命令以普通用户权限运行。

因此,如果您想使用该语法,您应该这样做sudo x && sudo y

答案2

它可以在 Kali Linux 上与下面的一个一起使用

sudo apt-get update && sudo apt-get upgrade -y

答案3

我知道这已经很晚了,但是输入 sudo su 并重试您要执行的命令更简单。

相关内容