Install virtualbox guest additions on elementary OS 0.2 luna
Elementary OS Luna
Elementary OS is a great distro in the Ubuntu family of linux distros that offers a mac like look and feel on the desktop. It features a completely new desktop environment called Pantheon that is built atop GTK libraries. The desktop itself looks very stylish but very user-friendly and intuitive at the same time. And it looks great on laptops.
For the time being I tried it on virtualbox where it works flawless, except that you need to install the virtualbox guest additions like every distro.
Install Virtualbox guest additions on elementary OS
The steps to install the virtualbox guest additions on elementary OS are exactly the same as ubuntu or debian. Just install the kernel headers and compile the guest additions from the disc image built inside virtualbox. However also know that there is a guest additions package that is available in the ubuntu repositories too. So you can install from either of the 2 places. Just that the repository version would generally be older or outdated. And the one thats inside virtualbox is the latest version.
1. Install the kernel headers and build tools
The first thing you need to do is prepare your system to be able to compile kernel modules like virtualbox guest additions. For this you need to install the correct kernel headers for your distro. These are readily available in the repositories.
$ sudo apt-get install build-essential module-assistant
The above command should download around 9MB of packages from the repository. After it finishes, run the m-a command to prepare the kernel headers
$ sudo m-a prepare
2. Compile virtualbox guest additions
That should prepare the kernel headers too. Now we are ready to compile the virtualbox guest additions. Click Devices > Install guest additions from virtualbox window, or press right Ctrl + D.
Now open a terminal and navigate to the virtualbox guest additions disc image and run the linux installer.
And it should start the installation, take a few minutes and finish successfully. Here is the actual output you should see if the compilation succeeds.
silver@silver:/media/VBOXADDITIONS_4.2.12_84980$ ./VBoxLinuxAdditions.run Verifying archive integrity... All good. Uncompressing VirtualBox 4.2.12 Guest Additions for Linux............ This program must be run with administrator privileges. Aborting silver@silver:/media/VBOXADDITIONS_4.2.12_84980$ sudo ./VBoxLinuxAdditions.run Verifying archive integrity... All good. Uncompressing VirtualBox 4.2.12 Guest Additions for Linux............ VirtualBox Guest Additions installer Removing installed version 4.2.12 of VirtualBox Guest Additions... Copying additional installer modules ... Installing additional modules ... Removing existing VirtualBox non-DKMS kernel modules ...done. Building the VirtualBox Guest Additions kernel modules The headers for the current running kernel were not found. If the following module compilation fails then this could be the reason. Building the main Guest Additions module ...done. Building the shared folder support module ...done. Building the OpenGL support module ...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.11 modules ...done. Setting up the Window System to use the Guest Additions ...done. You may need to restart the hal service and the Window System (or just restart the guest system) to enable the Guest Additions. Installing graphics libraries and desktop services components ...done. silver@silver:/media/VBOXADDITIONS_4.2.12_84980$
Verify that guest additions are working
Now restart elementary OS and after booting, the screen resolution should be perfect, mouse scroller should work etc. Verify the guest additions by checking the kernel loaded modules
$ lsmod | grep -io vboxguest | xargs modinfo | grep -iw version version: 4.2.12 silver@silver:~$
So version 4.2.12 is the latest at the time of writing this article.
Install from repository
The virtualbox guest additions are also available in the repository and can be installed directly with apt, without having to do the compilation stuff shown above
$ sudo apt-get install virtualbox-guest-additions-iso
But note that the version of guest additions available from the repositories would generally be behind the latest version, unless the virtualbox version on the host system is outdated.