Cannot Install VirtualBox Guest Additions: Installer Hangs


For a CentOS based guest, the update of the VirtualBox Guest Additions hangs after the step: “Removing exiting VirtualBox non-DKMS kernel modules”



  • Check the log file in /var/log/VBoxGuestAdditions-uninstall.log. See if there is anything obvious reported there you can fix.
  • Check if your RAM disks are valid by running the command `sudo lsinitrd`.
    • If they are not, try rebuilding broken images with `sudo dracut -f [broken-image].img [kernel version]`
  • Verify you have all dependencies installed:
    • yum install dkms
    • yum groupinstall “Development Tools”
    • yum install kernel-devel
  • Reinstall your Kernel image
  • Verify that you have the correct version of kernel-devel installed
    • yum remove kernel-devel
    • yum install kernel-devel-`uname -r`
    • Restart system!
  • Wait!
    • Let the installation run for a while, at least 15-20 min. It might do something!

Sharing Folders with VirtualBox


You would like to share a folder between a VirtualBox Linux Guest and a Windows Host.


  • Start your VM
  • Switch to Windowed Mode
  • Select Devices / Shared Folders / Shared Folder Settings …
  • Create a New Folder on your Linux Guest. e.g.:
    • /home/[Your User]/WinDocuments
  • Add a new Shared folder there, e.g.
    • Share Name WinDocuments
    • Windows Folder: C:\Users\[Your User]\Documents
  • Open a Terminal and run the following:
sudo mount -t vboxsf -o rw,uid=1000,gid=1000 Documents /home/[Your User]/WinDocuments

Now you should be able to copy files to and from Windows from your Linux host.


Permission Problems

There are often tricky permission problems that prevent you from copying folders to Windows. You will get messages like ‘Access denied’ or ‘Error while copying’ or ‘You do not have permissions for this operation’.

There are many ways to fix this, but the easiest is to start your the file browser of your Linux system with sudo or, if your Linux doesn’t come with an UI, copy the files using sudo.

For instance, if you have the Nautilus file browser installed, run the following on the command line:

sudo nautilus

Then navigate to your shared folder and copy the files there.

Otherwise, copy files as follows:

sudo cp /local/file /home/[Your User]/WinDocuments

Unmounting the Folder

When you are done working with the files, simply run the following from the command line:

sudo umount /home/[Your User]/WinDocuments


Access Apache on VirtualBox OS from Host OS


You have a RHEL or CentOS 6 VirtualBox Virtual Machine and a Windows or other host and would like to access a web server on the VM from the Host OS.


Assure that the Apache Web Server is available and started on the guest OS:

`sudo httpd start`

Assure that firewall allows the guest OS to handle web requests.

Type ` sudo system-config-firewall` and enable the WWW service.

Configure port forwarding for the VM. Go to the VM settings in the Oracle VM VirtualBox Manager / Page ‘Network’.

Click on the button [Port Forwarding] and add an entry such as the following:

Now, on your host OS, you should be able to see the Apache Server test page when opening `http://localhost:8080` in a browser.


Since every system is configured differently there might be some problems you encounter. If you don’t see the test page, you could try the following:

  • Disable SELinux by opening the file ` /etc/selinux/config` and setting the configuration to ` SELINUX=disabled` (see a more detailed guide here)
  • This tutorial assumes that you use the default NAT network adapter for you VM. If you use a ‘host-only’ or ‘bridged’ connection, the process will be a bit different.


Stackoverflow – How to SSH to a VirtualBox guest externally through a host? Very helpful, also read the comments

Stackoverflow – Apache restart causes DocumentRoot must be a directory, even though it is a directory and there seem to be no privilege issues

CentOS Board – Basic firewall config (just port 80 and ssh 22)


Convert Dynamically Sized VirtualBox VDI Hard Drive to Fixed Size

The Problem

You have got a dynamically sized, VDI virtual hard drive in VirtualBox and would like to convert it into a fixed size hard drive.

You are using Windows.

The Solution

  • Locate VBoxManage.exe on your machine. It should be in the VirtualBox program directory (usually found under C:\Program Files\Oracle\VirtualBox) .
  • Open a command prompt (e.g. by searching for “cmd”+Enter Windows 7 or 8).
  • Go to the directory in which VBoxManage.exe is located by typing something like:

cd “C:\Program Files\Oracle\VirtualBox”

  • Convert your dynamically sized hard drive to a fixed size harddrive using the command:

C:\Program Files\Oracle\VirtualBox>VBoxManage.exe clonehd <path-to-source-vdi> <path-to-destination-vdi> –variant Fixed

This might take a while depending on the size of your drive. You probably have used this drive as part of a virtual machine. In order to use the new hard drive you need to go through a few more steps.

  • Open the virtual box manager, go to settings for your machine and remove the old (dynamically sized) drive from the SATA controller for this machine.

  • Go back to the command line and display a list of your currently registered hard drives:

VBoxManage.exe list hdds

  • Manually remove your old drive from the list by running the command:

C:\Program Files\Oracle\VirtualBox>vboxmanage closemedium disk <UUID of your drive> –delete

ATTENTION: This will delete your old hard drive file. You may want to make a backup copy of the image before running this operation.

  • Rename the new (fixed size) hard drive file to the name of your original vdi file. For instance, if your old drive’s name was ‘myhdd-10GB.vdi’ and your new fixed size drive’s name is ‘fixed-10GB.vdi’, rename ‘fixed-10GB.vdi’ to ‘myhdd-10GB.vdi’
  • Go to the VirtualBox Manager and add the freshly renamed drive to the SATA controller for your VM.

Now you should be able to start your VM with the new drive and (hopefully) enjoy the performance benefits of a fixed size drive.


HOWTO: Convert VDIs Between Fixed-Sized and Dynamic In VirtualBox

Stackoverflow – Convert VirtualBox dynamic VDI disk image to static, fixed VDI

coderwall – Purge deleted hard disks from Virtual Box