Virtual machines came in handy when we need to create a testing machine for a specific project, or when we want to experiment with new development environments. For example, if you want to try the swift language used to develop iOS applications in your Linux box, you can simply create a specific VM for that purpose.

Want to install WordPress in a FreeBSD machine but you are unsure of the steps to follow, and do not want to mess up the real system? Once again, VM to the rescue.

When I run across a Linux distribution that I want to try like Antergos, Nutyx, etc, I find it way quicker and more comfortable to just install it in a VM than creating a new partition in my real computer. There is always time to install it in my real computer, if after trying it, I decide I want to use it on a regular basis.

The virtualization software of my choice in Linux is usually VirtualBox, but a just created VM running in VirtualBox it is displayed in a ridiculously tiny screen that it really does not invite you to use the system. Luckily we can fix that, and display our guest system in full screen mode.

Basically, if we want to display our Virtual Box system in full screen mode in Linux, we had to perform these two steps:

    • Make sure that we have enough video memory, and that we have enabled 3D acceleration in our virtual machine settings
    • Install in the Guest system the VirtualBox  Guest Additions.

The first step is simple enough since it only requires to adjust the Display settings, in the VM settings screen:

Display settings for the VM

Now, installing the VirtualBox Guest Additions can be a bit more tricky varying on the specific system. In this guide I will show the steps to follow in a Debian Stretch guest.

Installing VirtualBox Guest Additions in Debian Stretch

For starters we should update our system:

apt-get update
apt-get upgrade

In order to install our Guest Additions we are going to install a kernel module, so we will need to use some libraries that are used to compile software and build kernel modules. The simplest way to make sure we have the required tools and libraries is to install the following packages:

apt-get install build-essential module-assistant

We also need to download the kernel headers, and we can do that by running this command:

m-a prepare

We are finally ready to install the guest additions; in the toolbar of our Virtual Box machine we can find an option to download and mount the CD containing the software for the Guest Additions: Devices/Insert Guest Additions CD Image

Guest Additions

Now we move to the cdrom folder:

cd /media/cdrom

And finally run the VBoxLinuxAdditions.run script:

sh VBoxLinuxAdditions.run

Now if you reboot your guest system, you should be able to resize the screen according to your needs, making it full screen if you wish to do so.

Permission denied to run VBoxLinuxAdditions.run

I noticed that in my Debian Stretch box running the script VBoxLinuxAdditions.run from the terminal I got the following error: Permission denied.

At first I thought it maybe a problem with the file permissions but a quick ls -l confirmed that the file had the execution bit activated. It seems that the problem laid at the /etc/fstab configuration: when mounting the Guest Additions iso image, the nonexec option is used, and that results in the execution permission bits being ignored, and the impossibility of running the script in that filesystem.

As suggested in the link above from the virtualbox forums, you can either modify the fstab configuration, or simply run the script by calling the shell interpreter as I did above.

Advertisements