dpkg 的重新配置问题

Not*_*ras 6 package-management apt dpkg virtualbox dkms

我在使用 apt 安装软件包时遇到了一些问题。终端在安装过程中挂断了,除了关闭终端,我别无选择。然而,问题是我似乎无法解决由此引起的问题。

作为典型,我得到:

E: Could not get lock /var/lib/dpkg/lock - open (11: Resource temporarily unavailable)
E: Unable to lock the administration directory (/var/lib/dpkg/), is another process using it?
Run Code Online (Sandbox Code Playgroud)

这让我无处可去,我被锁在外面,直到我跑sudo dpkg --configure -a。说得通。但是,这个过程吐出以下内容,然后挂在最后一行:

Setting up virtualbox-dkms (5.2.10-dfsg-6) ...
Removing old virtualbox-5.2.10 DKMS files...

-------- Uninstall Beginning --------
Module:  virtualbox
Version: 5.2.10
Kernel:  4.15.0-23-generic (x86_64)
-------------------------------------

Status: This module version was INACTIVE for this kernel.
depmod...

DKMS: uninstall completed.

------------------------------
Deleting module version: 5.2.10
completely from the DKMS tree.
------------------------------
Done.
Loading new virtualbox-5.2.10 DKMS files...
Building for 4.15.0-23-generic
Building initial module for 4.15.0-23-generic
Run Code Online (Sandbox Code Playgroud)

我读过的一个典型解决方案是您需要修复损坏的包。当我尝试修复损坏的包 ( sudo apt install -f) 时,系统也挂在同一行上,尽管输出不同:

Reading package lists... Done
Building dependency tree       
Reading state information... Done
0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.
3 not fully installed or removed.
After this operation, 0 B of additional disk space will be used.
Setting up virtualbox-dkms (5.2.10-dfsg-6) ...
Removing old virtualbox-5.2.1

0 DKMS files...

------------------------------
Deleting module version: 5.2.10
completely from the DKMS tree.
------------------------------
Done.
Loading new virtualbox-5.2.10 DKMS files...
Building for 4.15.0-23-generic
Building initial module for 4.15.0-23-generic
Run Code Online (Sandbox Code Playgroud)

除非我终止进程,否则我无法摆脱它。为此,我检查当前正在运行的与 apt( ps aux |grep apt)相关的内容,然后使用sudo kill -9 process_number_here.

如果我在那之后尝试运行,它会告诉我我仍然需要重新配置 dpkg。

我尝试四处寻找 dpkg 的更多解决方案,但我真正看到的只是核选项:

sudo rm /var/lib/dpkg/lock
sudo rm /var/cache/apt/archives/lock
sudo rm /var/lib/apt/lists/lock
Run Code Online (Sandbox Code Playgroud)

我还删除了 /var/lib/dpkg/updates 中的文件,因为当我进行一些挖掘时,其中的一个文件与上述长输出具有完全相同的文本......但我完全承认在这里不合时宜我不知道该怎么办。

看看错误消息,我意识到它挂在构建与内核相关的东西上。但我不知道从哪里开始解决这个问题。任何帮助表示赞赏。我的系统是 ubuntu 18.04

小智 2

系统正在后台等待密码。

  1. 输入您的 root 密码并按 Enter 键
  2. 输入新密码,该密码将用于注册 vboxdrv 内核模块的机器所有者密钥 (MOK)
  3. 重复您在 (2) 中输入的密码
  4. 等待该过程完成并重新启动系统
  5. 启动时,按照说明注册 MOK

这对我来说很有效。


小智 0

这表明您的包管理器正在工作:

E: Could not get lock /var/lib/dpkg/lock - open (11: Resource temporarily unavailable)
E: Unable to lock the administration directory (/var/lib/dpkg/), is another process using it?
Run Code Online (Sandbox Code Playgroud)

事实上,它似乎为您的内核构建内核模块,这取决于您的硬件,可能需要一些时间 - 如果您不像以前那样中断该过程。

重新开始sudo dpkg --configure -a并多一点耐心。然后再做sudo apt install -f一次。

  • 不,我让它运行了一整夜,但没有任何改变。也没有任何进展。想法? (2认同)