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 that's 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
All essential packages to build the virtualbox guest additions are not installed.
Click Devices > Install guest additions from virtualbox window, or press right Ctrl + D. This will "insert" the guest additions cd into elementary. But we need to mount the cd to use it.
To mount the cd, open the file manager and click on the cd icon on the left under the "Devices" section.
It should be named "VBOXADDITIONS".
It will open the cd contents and also mount it. The mount directory is located in the /media directory.
If you wish to mount it from the terminal, then first use the lsblk command to find the device and then mount it somewhere in your home directory.
# find cdrom device $ lsblk NAME MAJ:MIN RM SIZE RO TYPE MOUNTPOINT sda 8:0 0 20G 0 disk ├─sda1 8:1 0 18G 0 part / ├─sda2 8:2 0 1K 0 part └─sda5 8:5 0 2G 0 part [SWAP] sr0 11:0 1 61.7M 0 rom $ cd ~/ $ mkdir vbox # mount the cd rom $ sudo mount /dev/sr0 ~/vbox mount: block device /dev/sr0 is write-protected, mounting read-only # start compiling vbox guest additions $ cd vbox/ ~/vbox$ sudo ./VBoxLinuxAdditions.run
Now open a terminal and navigate to the directory where the guest additions cd is mounted and run the linux installer.
/media/VBOXADDITIONS_4.2.12_84980$ sudo ./VBoxLinuxAdditions.run
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-desktop:/media/VBOXADDITIONS_4.3.10_93012$ sudo ./VBoxLinuxAdditions.run Verifying archive integrity... All good. Uncompressing VirtualBox 4.3.10 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. Starting the VirtualBox Guest Additions ...done. 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-desktop:/media/VBOXADDITIONS_4.3.10_93012$
Check the line that mentions "Building the VirtualBox Guest Additions kernel modules ...done." It must show "done" and not failed, for the compilation to succeed.
Unmount the guest additions cd image from the file image or from the terminal.
$ sudo umount /dev/sr0 $ eject /dev/sr0
After the installation completes, restart elementary OS. Or simply issue the command "sudo reboot".
3. Verify that guest additions are working
After reboot, the virtualbox guest additions should take effect. The screen resolution should now adapt to the size of the virtualbox window, the mouse scroller should now work inside elementary.
The virtualbox guest additions load as kernel modules that can be verified using the command shown below.
# kernel module $ lsmod | grep vboxguest vboxguest 244263 8 vboxsf # version information $ modinfo vboxguest filename: /lib/modules/3.2.0-51-generic/extra/vboxguest.ko version: 4.3.10 .....
The modinfo command shows that the installed version of virtualbox guest additions is 4.3.10
4. Configure shared folders
The process to access shared folders inside elementary OS running as guest, is same as other linux distros. First create a shared folder from "Devices > shared folder settings" option in virtualbox window and give it a distinct name.
Then create a directory inside elementary and mount the shared folder using either of the following one of the following commands.
# create a directory in your home directory $ mkdir shared # mount using the mount command. SHARENAME is the name of the shared directory $ sudo mount -t vboxsf SHARENAME ~/shared # or $ sudo mount.vboxsf SHARENAME ~/shared
Some versions of Virtualbox have a bug where the mount command fails to mount the shared folder. Both "mount.vboxsf" and "mount -t vboxsf" would fail in such cases. Here is an example
$ sudo mount -t vboxsf shared_folder ./shared [sudo] password for silver: mount: wrong fs type, bad option, bad superblock on shared_folder, missing codepage or helper program, or other error (for several filesystems (e.g. nfs, cifs) you might need a /sbin/mount.<type> helper program) In some cases useful info is found in syslog - try dmesg | tail or so # mount.vbox would also fail $ sudo mount.vboxsf shared_folder ./shared sudo: mount.vboxsf: command not found
The problem is caused because the mount.vboxsf command does not exist inside /sbin directory or points to a wrong path.
To fix this issue we need to use the correct path for the mount.vboxsf command.
In most cases the mount.vboxsf command is located at the following path
$ sudo /usr/lib/x86_64-linux-gnu/VBoxGuestAdditions/mount.vboxsf SHARENAME ./shared
The above command should be able to mount the shared folder and make it accessible from within elementary OS.
Alternative method - Install from repository
The compilation steps shown above can be skipped entirely and the virtualbox guest addons can be installed with a package from the repository.
$ sudo apt-get install virtualbox-guest-additions # or $ sudo apt-get install virtualbox-guest-additions-iso
However, the guest additions available in the repository would be outdated most of the times compared to the latest version of virtualbox available.
There might as well be a conflict with the virtualbox version and the guest addons from the repository.
Following the above mentioned steps you should be able to install the virtualbox guest additions in elementary os.
If you have any feedback or questions, let us know in the comments below.