i want to remove Virtualbox-6.1 from my ubuntu 20.0 Kernal but i am un able to do so. I donot know what's wrong with it!?

when i try to remove it using:

$ sudo apt-get remove virtual-6.1

it gives the following error:

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

afte a while it continues and says:

   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)

Can somebody explain how to solve this problem. Thank you!


This can happen on occasion. Fortunately, it's not too tricky to fix. Follow these steps:

First, find out what process is using the file:

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

You'll see something like this:

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

Take the PID value and put an end to it:

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

This will unlock the config.dat file. From there you'll be able to remove VirtualBox:

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

Hope this gives you what you need.