29

This question already has an answer here:

I am having a problem trying to install the guest additions for my ubuntu 18.04 and virtualbox 5.2.12
I thought I did something wrong so I tried to install the additions from the CLI, unistalled and installed dkms... I even deleted the virtual machine and installed ubuntu again and it has the same error.
Can anyone help please as I did not find an updated solution to my problem. Here is the message i get when trying to install the addons:

Verifying archive integrity... All good.
Uncompressing VirtualBox 5.2.12 Guest Additions for Linux........
VirtualBox Guest Additions installer
Copying additional installer modules ...
Installing additional modules ...
VirtualBox Guest Additions: Building the VirtualBox Guest Additions kernel modules.
This system is currently not set up to build kernel modules.
Please install the gcc make perl packages from your distribution.
VirtualBox Guest Additions: Running kernel modules will not be replaced until the system is restarted
VirtualBox Guest Additions: Starting.
Press Return to close this window...

marked as duplicate by Melebius, Eric Carvalho, Charles Green, Pablo A, waltinator May 4 at 13:51

This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.

39

In terminal...

sudo apt-get update
sudo apt-get install build-essential gcc make perl dkms
reboot

then reinstall the VB Guest Additions.

Update:

  • purge virtualbox-guest-dkms
  • purge virtualbox-5.2 and any other virtualbox softwares
  • ls -al /lib/modules/$(uname -r)/updates/dkms and look for any leftover virtualbox kernel drivers. These need to be manually deleted.
  • dpkg -l *virtualbox* and dkms status should show no virtualbox software
  • install virtualbox-5.2 and create your VM
  • in the VM, choose the Devices menu, then "Insert Guest Additions CD Image"
  • it'll ask if you wish to install the Guest Additions
  • Note: if it doesn't automatically ask to install Guest Additions, you have to do it manually.
    • find the CD icon, on your desktop, or in Files, and open it
    • open a terminal in this directory
    • sudo ./VBoxLinuxAdditions.run
  • I executed the commands as listed but i keep getting the error message even though i restarted the system more than once: – TOH19 May 11 '18 at 19:43
  • @TOH19 show me dpkg -l *irtualbox* and dkms status. – heynnema May 11 '18 at 19:49
  • dpkg -l *irtualbox* Name : <none> Version: <none> Architecture: <none> Description: (no description available) – TOH19 May 11 '18 at 19:58
  • dkms status has no return – TOH19 May 11 '18 at 19:59
  • @TOH19 I don't see VirtualBox installed? Maybe try dpkg -l *irtual*. You're not getting the same error messages as you did before, correct? – heynnema May 12 '18 at 1:33
11

I had the same problem on Lubuntu 18.04. I had to follow the steps in heynnema's answer, but also had to install dkms. Then I reinstalled Guest Additions (mine is 5.2.12) from the disk image and it worked after a reboot. All that was left was setting up permissions for shared folders, but that's another story.

So basically:

  1. Open your terminal
  2. sudo apt-get install build-essential gcc make perl dkms
  3. reboot
  4. Open your terminal
  5. Go to the installation disk
  6. sudo sh VBoxLinuxAdditions.run
  7. reboot

This was done on a fresh Lubuntu 18.04 install.

2

As heynnema said, you will need gcc make and perl to build the kernel modules which are not installed for some reason on my machine when installing.

Try:

sudo apt-get update
sudo apt-get install build-essential gcc make perl dkms
sudo /sbin/vboxconfig

Reboot.

1

I had similar issues. (Host: windows / Guest: Lubuntu 18.04)

Solution was simple: I had to update my Virtual Box Installation to the newest one (V5.2.22)

After updating the Virtual Box (in my host), the installtion of the virtualbox addons (in guest) worked without any problems.

Not the answer you're looking for? Browse other questions tagged or ask your own question.