72

What is the best way to install Guest Additions with all the resize and clipboard and file sharing features on Ubuntu 16.04?

jtpereyda
  • 2,115
  • 3
  • 20
  • 21

9 Answers9

79

For Ubuntu Server, it is necessary to install guest additions from command line.

sudo apt-get update
sudo apt-get install virtualbox-guest-dkms 
ThisClark
  • 891
36

There is a guest additions package, but this only enabled some of the features for me.

The most reliable way is probably to use the built-in installer that comes with VirtualBox.

This is for Ubuntu Desktop. For Ubuntu Server, see @ThisClark's answer.

Updates

  1. Make sure you have the latest version of VirtualBox.
  2. It might be good to first sudo apt update and sudo apt upgrade and restart if needed.

Guest Additions

  1. Power on virtual machine
  2. Click "Devices" on the VirtualBox menu at the top of the screen
  3. Click "Install Guest Additions CD Image..."
  4. Follow the on-screen prompts as needed, enter your password, etc.
  5. Restart the virtual machine

Enable features

  1. Machine -> Settings -> General -> Advanced -> enable Shared Clipboard and/or Drag'n'Drop.
  2. Make sure View -> Auto-resize Guest Display is checked.
jtpereyda
  • 2,115
  • 3
  • 20
  • 21
23

If you don't download the ISO, you won't get the "latest and greatest" version. If you'd like to stick with this option, please see the following notes for dependencies.

I have tested these instructions successfully under an Ubuntu 16.04 guest:

  1. Create Ubuntu server instance under VirtualBox (obviously).
  2. Start VM, go to Devices -> Insert Guest Additions CD image to mount the ISO image.

  3. From the terminal, run the following commands:

    sudo -i  
    apt install gcc make  
    mkdir -p /media/cdrom  
    mount /dev/cdrom /media/cdrom  
    /media/cdrom/VBoxLinuxAdditions.run  
    reboot  
    
  4. After reboot:

    sudo usermod --append --groups vboxsf USERNAME
    
  5. Host shares should now be mounted in Ubuntu guest under /media via the installed VBoxService service, set to start on system boot-up.

This impacted my install.

Noted from comment:

  • Log out and back in again after adding user account to vboxsf group
jonathan
  • 359
11

1) Install a package through the usual channels for your distribution. For example, you might use:

sudo apt-get install virtualbox-guest-additions-iso

2) Add in the guest additions by choosing Devices > Optical Drives > VBoxGuestAdditions.iso

When you use the above command to download the iso file. It can be found here:

/usr/share/virtualbox/VBoxGuestAdditions.iso
Zanna
  • 72,312
cloud99
  • 111
5

This worked for VirtualBox 5.1.28 MacOS host running Ubuntu Server 16.04.3 LTS guest. All instructions are for the guest Ubuntu Server.

Note: do not use the VirtualBox GUI to "Insert Guest Additions CD Image." It did not invoke "vboxadd.sh" as did the up-to-date .iso downloaded from the virtualbox website. In addition, your guest must have internet access (use "NAT" instead of "bridged adapter" if you are having trouble with your guest OS internet).

In terminal, download the VBoxGuestAdditions.iso for your version of VirtualBox (for me it's 5.1.28).

wget http://download.virtualbox.org/virtualbox/5.1.28/VBoxGuestAdditions_5.1.28.iso

Then create an empty directory in /media and mount it there:

sudo mkdir /media/iso
sudo mount VBoxGuestAdditions_5.1.28.iso /media/iso

Then go there and run the Linux installer:

cd /media/iso
sudo ./VBoxLinuxAdditions.run

Reboot your guest OS:

reboot

You should be able to access your shared folder under /media/sf_[your_folder_name]

Zanna
  • 72,312
5

This worked for me:

sudo mount /dev/cdrom /media/cdrom
sudo apt install -y dkms build-essential linux-headers-generic linux-headers-$(uname -r)
sudo sh /media/cdrom/VBoxLinuxAdditions.run

Then rebooted the virtual machine.

George Udosen
  • 37,534
1

Virtual Box 5.1 wanted?

If you intend to get and use Virtual Box 5.1 (not 5.0), at the time of writing, you won't afaik get it through apt. And adding 3rd party repos can get you unintendedly the 32bit version with an obscure error version, see this answer.

Thus it's probably best to download VirtualBox itself and the Guest Additions (now renamed/part of "Extension Pack" it directly from the highest 5.1.x version you can find here:

http://download.virtualbox.org/virtualbox/

i.e.

http://download.virtualbox.org/virtualbox/5.1.28/

(After abovemtioned 32bit nuisances, ) I got lucky with

virtualbox-5.1_5.1.28-117968~Ubuntu~xenial_amd64.deb

The two offered extension packs are identical (same checksum), pick any:

Oracle_VM_VirtualBox_Extension_Pack-5.1.28-117968.vbox-extpack
Oracle_VM_VirtualBox_Extension_Pack-5.1.28.vbox-extpack  

How to install all of that? Double-click. Opens standard ".deb"-Installer, respectively virtual box, to take care of the extension pack. (Yes, windows-ish, uncool, but works!)

Frank N
  • 1,430
0

I found this method was by far the easiest whilst also allowing dynamic screen resizing:

sudo apt install virtualbox-guest-dkms virtualbox-guest-utils virtualbox-guest-x11
SharpC
  • 115
0

I had the same problem as you, I'll explain what I've done:

  • I read the VirtualBox User Guide corresponding to the version of VB installed.

  • I installed the VB from the repositories of Ubuntu; it is now(july2017) the version 5.0.40

  • I download from VB www the extension pack corresponding to this version, double click and it is installed: I had access to USB devices.
  • It seems that the VBGuestAdditions.iso has to be installed with the installation of VM

    by checking in settings->user interface ->devices ->insert GuestAdditions CD image,

    but in my case it did not so I searched this ISO file in the host and in the case of the VB version this ISO file is in /usr/share/virtualbox.

  • Finally in the settings of the VM (the VBGuestAdditions is to be installed in the guest)

    in Storage, in controller IDE I put the path to the file VBGuestAdditions.iso and it appears in the VM as a CD device and you can access it and run the VBGuestAdditions and obtain the correct resizing of screen and access to the shared folder (this last feature at least in guest win7).

muru
  • 207,228
aure
  • 1