无法删除 Virtualbox-6.1

无法删除 Virtualbox-6.1

我想从我的 ubuntu 20.0 Kernal 中删除 Virtualbox-6.1,但我无法这样做。我不知道它出了什么问题!?

当我尝试使用以下命令删除它时:

$ sudo apt-get remove virtual-6.1

它给出了以下错误:

eading package lists... Done

Building dependency tree       
Reading state information... Done

The following packages were automatically installed and are no longer required:

  libpython2-stdlib libpython2.7-minimal libpython2.7-stdlib libqt5opengl5

  libqt5printsupport5 libsdl-ttf2.0-0 python-is-python2 python2

  python2-minimal python2.7 python2.7-minimal

Use 'sudo apt autoremove' to remove them.

The following packages will be REMOVED:

  virtualbox-6.1*

0 upgraded, 0 newly installed, 1 to remove and 2 not upgraded.

1 not fully installed or removed.

After this operation, 216 MB disk space will be freed.

Do you want to continue? [Y/n] y

debconf: DbDriver "config": /var/cache/debconf/config.dat is locked by another process: Resource
temporarily unavailable

(Reading database ... 206983 files and directories currently installed.)
Removing virtualbox-6.1 (6.1.16-140961~Ubuntu~eoan) ...

debconf: DbDriver "config": /var/cache/debconf/config.dat is locked by another process: Resource temporarily unavailable

dpkg: error processing package virtualbox-6.1 (--remove):

 installed virtualbox-6.1 package pre-removal script subprocess returned error exit status 1
dpkg: too many errors, stopping

过了一会儿,它继续说道:

   debconf: DbDriver "config": /var/cache/debconf/config.dat is locked by another process: Resource temporarily unavailable

vboxdrv.sh: failed: modprobe vboxdrv failed. Please use 'dmesg' to find out why.


There were problems setting up VirtualBox.  To re-start the set-up process, run

  /sbin/vboxconfig

as root.  If your system is using EFI Secure Boot you may need to sign the

kernel modules (vboxdrv, vboxnetflt, vboxnetadp, vboxpci) before you can load

them. Please see your Linux system's documentation for more information.

Errors were encountered while processing:

 virtualbox-6.1

Processing was halted because there were too many errors.

E: Sub-process /usr/bin/dpkg returned an error code (1)

有人能解释一下如何解决这个问题吗?谢谢!

答案1

这种情况偶尔会发生。幸运的是,修复起来比较棘手。请按照以下步骤操作:

首先,找出哪个进程正在使用该文件:

sudo fuser -v /var/cache/debconf/config.dat

你会看到类似这样的内容:

USER        PID ACCESS COMMAND /var/cache/debconf/config.dat:
root       8440 F.... frontend

取PID值并终止:

sudo kill <PID>
sudo kill -9 <PID>

这将解锁config.dat文件。然后您就可以删除 VirtualBox:

sudo apt purge virtualbox-6.1
sudo apt purge virtualbox-dkms 

希望这能满足您的需要。

相关内容