尽管我多次尝试,但我还是无法从 UBuntu 20.04 中卸载/删除 Virtualbox

尽管我多次尝试,但我还是无法从 UBuntu 20.04 中卸载/删除 Virtualbox

我尝试直接通过 Ubuntu 软件中心删除它,但它说无法删除 Virtualbox,因为它不存在在此处输入图片描述

我尝试运行 sudo apt-get remove virtualbox-*,但也没有用。我从官方网站下载了 .deb 文件来安装 Vbox。双击 .deb 文件打开了 Ubuntu 软件应用程序,我从中安装了 Vbox。以下是 remove cmd 的输出

anjug@anjug-vostro-15-3568:~$ sudo apt-get remove virtualbox-\*
[sudo] password for anjug: 
Sorry, try again.
[sudo] password for anjug: 
Reading package lists... Done
Building dependency tree       
Reading state information... Done
Note, selecting 'virtualbox-source' for glob 'virtualbox-*'
Note, selecting 'virtualbox-guest-utils' for glob 'virtualbox-*'
Note, selecting 'virtualbox-ose' for glob 'virtualbox-*'
Note, selecting 'virtualbox-guest-modules' for glob 'virtualbox-*'
Note, selecting 'virtualbox-guest-additions-iso' for glob 'virtualbox-*'
Note, selecting 'virtualbox-guest-dkms' for glob 'virtualbox-*'
Note, selecting 'virtualbox-dkms' for glob 'virtualbox-*'
Note, selecting 'virtualbox-guest-dkms-hwe' for glob 'virtualbox-*'
Note, selecting 'virtualbox-ext-pack' for glob 'virtualbox-*'
Note, selecting 'virtualbox-guest-modules-hwe' for glob 'virtualbox-*'
Note, selecting 'virtualbox-guest-x11-hwe' for glob 'virtualbox-*'
Note, selecting 'virtualbox-guest-source' for glob 'virtualbox-*'
Note, selecting 'virtualbox-qt' for glob 'virtualbox-*'
Note, selecting 'virtualbox-guest-source-hwe' for glob 'virtualbox-*'
Note, selecting 'virtualbox-2.0' for glob 'virtualbox-*'
Note, selecting 'virtualbox-2.1' for glob 'virtualbox-*'
Note, selecting 'virtualbox-2.2' for glob 'virtualbox-*'
Note, selecting 'virtualbox-modules' for glob 'virtualbox-*'
Note, selecting 'virtualbox-3.0' for glob 'virtualbox-*'
Note, selecting 'virtualbox-3.1' for glob 'virtualbox-*'
Note, selecting 'virtualbox-3.2' for glob 'virtualbox-*'
Note, selecting 'virtualbox-4.0' for glob 'virtualbox-*'
Note, selecting 'virtualbox-4.1' for glob 'virtualbox-*'
Note, selecting 'virtualbox-4.2' for glob 'virtualbox-*'
Note, selecting 'virtualbox-4.3' for glob 'virtualbox-*'
Note, selecting 'virtualbox-5.0' for glob 'virtualbox-*'
Note, selecting 'virtualbox-5.1' for glob 'virtualbox-*'
Note, selecting 'virtualbox-5.2' for glob 'virtualbox-*'
Note, selecting 'virtualbox-guest-utils-hwe' for glob 'virtualbox-*'
Note, selecting 'virtualbox-6.0' for glob 'virtualbox-*'
Note, selecting 'virtualbox-6.1' for glob 'virtualbox-*'
Note, selecting 'virtualbox-guest-x11' for glob 'virtualbox-*'
Package 'virtualbox-5.0' is not installed, so not removed
Package 'virtualbox-5.1' is not installed, so not removed
Package 'virtualbox-5.2' is not installed, so not removed
Package 'virtualbox-6.0' is not installed, so not removed
Note, selecting 'virtualbox-dkms' instead of 'virtualbox-modules'
Package 'virtualbox-2.0' is not installed, so not removed
Package 'virtualbox-2.1' is not installed, so not removed
Package 'virtualbox-2.2' is not installed, so not removed
Package 'virtualbox-3.0' is not installed, so not removed
Package 'virtualbox-3.1' is not installed, so not removed
Package 'virtualbox-3.2' is not installed, so not removed
Package 'virtualbox-4.0' is not installed, so not removed
Package 'virtualbox-4.1' is not installed, so not removed
Package 'virtualbox-4.2' is not installed, so not removed
Package 'virtualbox-4.3' is not installed, so not removed
Package 'virtualbox-guest-modules-hwe' is not installed, so not removed
Package 'virtualbox-ose' is not installed, so not removed
Package 'virtualbox-dkms' is not installed, so not removed
Package 'virtualbox-ext-pack' is not installed, so not removed
Package 'virtualbox-guest-additions-iso' is not installed, so not removed
Package 'virtualbox-guest-dkms' is not installed, so not removed
Package 'virtualbox-guest-dkms-hwe' is not installed, so not removed
Package 'virtualbox-guest-source' is not installed, so not removed
Package 'virtualbox-guest-source-hwe' is not installed, so not removed
Package 'virtualbox-guest-utils' is not installed, so not removed
Package 'virtualbox-guest-utils-hwe' is not installed, so not removed
Package 'virtualbox-guest-x11' is not installed, so not removed
Package 'virtualbox-guest-x11-hwe' is not installed, so not removed
Package 'virtualbox-qt' is not installed, so not removed
Package 'virtualbox-source' is not installed, so not removed
The following packages were automatically installed and are no longer required:
  libdouble-conversion3 libpcre2-16-0 libpython2-stdlib libpython2.7-minimal
  libpython2.7-stdlib libqt5core5a libqt5dbus5 libqt5gui5 libqt5network5
  libqt5opengl5 libqt5printsupport5 libqt5svg5 libqt5widgets5 libqt5x11extras5
  libsdl-ttf2.0-0 libsdl1.2debian libxcb-xinerama0 libxcb-xinput0
  linux-headers-5.4.0-58 linux-headers-5.4.0-58-generic
  linux-image-5.4.0-58-generic linux-modules-5.4.0-58-generic
  python-is-python2 python2 python2-minimal python2.7 python2.7-minimal
  qt5-gtk-platformtheme qttranslations5-l10n
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 12 not upgraded.
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 ... 221902 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)
anjug@anjug-vostro-15-3568:~$ ^C

VirtualBox 目前已安装在我的系统中,因为我可以通过点击其图标来运行该应用程序。我怀疑它安装在默认目录之外,因此标准卸载无法检测到它。以下是根目录中“Virtualbox”的搜索结果视图 在此处输入图片描述

答案1

我不太喜欢 globs。运行sudo dpkg -P virtualbox-6.1,或者更强烈地sudo mv /var/lib/dpkg/info/virtualbox-6.1.0.prerm $HOME将脚本移动到 /home/$USER。

然后再次

sudo dpkg -P virtualbox-6.1

对于锁问题

点击这里

删除 virtualbox-6.1 后,运行

sudo dpkg --configure -a && sudo apt -f install

相关内容