11
samip@samip510:~$ sudo apt-get install virtualbox
[sudo] password for samip: 
Reading package lists... Done
Building dependency tree       
Reading state information... Done
The following extra packages will be installed:
  libgsoap7 libvncserver1 virtualbox-dkms virtualbox-qt
Suggested packages:
  vde2 virtualbox-guest-additions-iso
The following NEW packages will be installed:
  libgsoap7 libvncserver1 virtualbox virtualbox-dkms virtualbox-qt
0 upgraded, 5 newly installed, 0 to remove and 0 not upgraded.
Need to get 6,970 kB/21.7 MB of archives.
After this operation, 92.7 MB of additional disk space will be used.
Do you want to continue? [Y/n] y
Get:1 http://np.archive.ubuntu.com/ubuntu/ wily/multiverse virtualbox-qt amd64 5.0.4-dfsg-2 [6,970 kB]
Fetched 2,245 kB in 4min 1s (9,282 B/s)                                        
Selecting previously unselected package libgsoap7:amd64.
dpkg: warning: files list file for package 'unity-scope-virtualbox' missing; assuming package has no files currently installed
(Reading database ... 205331 files and directories currently installed.)
Preparing to unpack .../libgsoap7_2.8.22-1_amd64.deb ...
Unpacking libgsoap7:amd64 (2.8.22-1) ...
Selecting previously unselected package libvncserver1:amd64.
Preparing to unpack .../libvncserver1_0.9.10+dfsg-3_amd64.deb ...
Unpacking libvncserver1:amd64 (0.9.10+dfsg-3) ...
Selecting previously unselected package virtualbox.
Preparing to unpack .../virtualbox_5.0.4-dfsg-2_amd64.deb ...
Unpacking virtualbox (5.0.4-dfsg-2) ...
Selecting previously unselected package virtualbox-dkms.
Preparing to unpack .../virtualbox-dkms_5.0.4-dfsg-2_all.deb ...
Unpacking virtualbox-dkms (5.0.4-dfsg-2) ...
Selecting previously unselected package virtualbox-qt.
Preparing to unpack .../virtualbox-qt_5.0.4-dfsg-2_amd64.deb ...
Unpacking virtualbox-qt (5.0.4-dfsg-2) ...
Processing triggers for man-db (2.7.4-1) ...
Processing triggers for systemd (225-1ubuntu9) ...
Processing triggers for ureadahead (0.100.0-19) ...
ureadahead will be reprofiled on next reboot
Processing triggers for hicolor-icon-theme (0.15-0ubuntu1) ...
Processing triggers for shared-mime-info (1.3-1) ...
Processing triggers for gnome-menus (3.13.3-6ubuntu1) ...
Processing triggers for bamfdaemon (0.5.2~bzr0+15.10.20150627.1-0ubuntu1) ...
Rebuilding /usr/share/applications/bamf-2.index...
Processing triggers for desktop-file-utils (0.22-1ubuntu3) ...
Processing triggers for mime-support (3.58ubuntu1) ...
Setting up libgsoap7:amd64 (2.8.22-1) ...
Setting up libvncserver1:amd64 (0.9.10+dfsg-3) ...
Setting up virtualbox (5.0.4-dfsg-2) ...
insserv: script virtualbox: service vboxdrv already provided!
insserv: exiting now!
update-rc.d: error: insserv rejected the script header
dpkg: error processing package virtualbox (--configure):
 subprocess installed post-installation script returned error exit status 1
dpkg: dependency problems prevent configuration of virtualbox-dkms:
 virtualbox-dkms depends on virtualbox (>= 5.0.4-dfsg-2); however:
  Package virtualbox is not configured yet.
  Package virtualbox-4.3 which provides virtualbox is not installed.

dpkg: error processing package virtualbox-dkms (--configure):
 dependency problems - leaving unconfigured
dpkg: dependency problems prevent configuration of virtualbox-qt:
 virtualbox-qt depends on virtualbox (= 5.0.4-dfsg-2); however:
  Package virtualbox is not configured yet.
  Package virtualbox-4.3 which provides virtualbox is not installed.

dpkg: error processing package virtualbox-qt (--configure):
 dependency problems - leaving unconfigured
Processing triggers for libc-bin (2.21-0ubuntu4) ...
No apport report written because the error message indicates its a followup error from a previous failure.
                          No apport report written because the error message indicates its a followup error from a previous failure.
                                                    Processing triggers for systemd (225-1ubuntu9) ...
Processing triggers for ureadahead (0.100.0-19) ...
Errors were encountered while processing:
 virtualbox
 virtualbox-dkms
 virtualbox-qt
E: Sub-process /usr/bin/dpkg returned an error code (1)

4 Answers 4

12

Whenever we install a newer major release of Virtual Box (e.g. 5.0.x) over an older release (e.g. 4.3.x) we have to remove the old version (including its kernel modules) before we can proceed.

For some reason this did not happen on your system where you still had the 4.3. kernel modules loaded.

To remove a previous VirtualBox installation we can issue:

sudo apt-get purge virtualbox*

We may have to reboot to unload the old kernel modules. After that we should be able to re-install the newer version from the repositories:

sudo apt-get update
sudo apt-get install virtualbox

The latest releases with bugfixes can also be installed by adding the official Oracle repository to our sources. I recommend to do so.

2
  • 1
    This still results in errors for me (Ubuntu 20.04) Jan 18, 2021 at 11:41
  • The error is still there. For some reason it tries to install kernel 5.4 instead of 5.8. Jan 20, 2021 at 20:52
2

I had this very problem and tried all the solutions and none of them worked!

But i saw this solution and it surprisingly worked! apparently the problem was because of my kernel version, and when you update the kernel, dkms module can be installed properly during installation of virtualbox.

So all you have to do is remove all the virtualbox packages:

sudo apt-get remove virtualbox virtualbox-4.* virtualbox-5.0

Then update kernel:

sudo apt-get update
sudo apt-get upgrade
sudo apt-get install linux-generic

Then reboot your system:

And then install virtualbox:

get the installation deb file fro virtualbox.org site and install it

I hope it works for you as well.

2

found the perfect solutions for this bug

cd /var/lib/dpkg/info/

sudo rm virtualbox*

sudo apt-get update

sudo apt-get autoremove

Should solve it. I did this in ubuntu 15.10 64bit.

Regards,

Hashim Neves

2
  • This seems to be no different than the prior two answers, other than the cd /var/lib/dpkg/info/ which does nothing for the process. Nov 22, 2015 at 22:02
  • there is also auto-remove and I am not sure it is the same
    – FantomX1
    Jan 8, 2021 at 12:52
0

I had faced the similar issue. In my case I was trying to install i386(32 bit) version of virtual box in Ubuntu 14.04 64 bit system. Then i downloaded AMD64 (64 bit) version and it worked fine. So make sure you are using appropriate version of virtual box.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .