In this tutorial, I’m going to show you how to install Virtualbox guest Additions on Elementary OS virtual machine. What the guest additions offer are the ability to share directories, files and clipboard between your host machine and guest machine. It can also power up the graphics ability of your guest machine so the guest machine can enter full-screen mode. Once you installed the guest additions, you will have more option in the resolution selection.
Install Virtualbox Guest Additions on Elementary OS Virtual Machine
Log into Elementary OS (guest OS) and update your software packages.
sudo apt-get update;sudo apt-get upgrade;sudo apt-get dist-upgrade
Install required packages for building kernel modules.
sudo apt-get install build-essential module-assistant
Prepare your system for building kernel module
sudo m-a prepare
In the virtual machine window, select Devices > Insert Guest Additions CD image.
It will ask you to download the guest additions iso image. Click Download.
The VBoxGuestAdditions_<version_number>.iso file will be downloaded into /home/<username>/.config/Virtualbox directory
Once the download is complete, it will ask you to insert the iso image into the virtual CD/DVD drive. Click Insert.
Now open a terminal in Elementary OS, and issue the following command:
/dev/sr0: LABEL="VBOXADDITIONS_4.3.36_105129" TYPE="iso9660"
/dev/sr0 is the name of the virtual CD/DVD drive.
FYI, /dev/sr0 is a device on the SCSI controller, whereas /dev/hda is a device on the IDE controller, /dev/cdrom is a symlink to either /dev/sr0 or /dev/hda (the first CD/DVD device).
make a cdrom directory under /media and mount the virtualbox guest additions iso image.
sudo mkdir /media/cdrom sudo mount /dev/sr0 /media/cdrom
Now change your working directory to /media/cdrom and run the vbox additions installer.
cd /media/cdrom sudo sh VBoxLinuxAdditions.run
Verifying archive integrity... All good. Uncompressing VirtualBox 4.3.36 Guest Additions for Linux............ VirtualBox Guest Additions installer Copying additional installer modules ... Installing additional modules ... Removing existing VirtualBox DKMS kernel modules ...done. Removing existing VirtualBox non-DKMS kernel modules ...done. Building the VirtualBox Guest Additions kernel modules ...done. Doing non-kernel setup of the Guest Additions ...done. You should restart your guest to make sure the new modules are actually used Installing the Window System drivers Installing X.Org Server 1.16 modules ...done. Setting up the Window System to use the Guest Additions ...done. You may need to restart the the Window System (or just restart the guest system) to enable the Guest Additions. Installing graphics libraries and desktop services components ...done.
Reboot your guest OS.
Now the resolution of Elementary OS will adjust with the size of virtulbox window. So you don’t need to manually adjust the resolution. You can also press right Ctrl and F keyboard shortcut to enter full-screen mode.