Updating/adding kernel headers to Fedora to support VirtualBox Guest Additions

Installing VirtualBox Guest Additions on Fedora 16 and 17 fails because it looks like the kernel headers are not installed by default. After you’ve installed Fedora to VirtualBox, you can manually install the required kernel headers with these steps (summarized from this post)

sudo yum -y update kernel
sudo yum -y install kernel-devel kernel-headers dkms gcc gcc-c++

Reboot then install the VirtualBox Guest Additions from the Devices menu.

Adding a user on Fedora to sudoers

When you create a new user on Fedora during the setup steps, there’s a checkbox to add the user to the administers group, which allows them to sudo commands. If you forget to check this box, you can add the user to the sudoers group like this:

echo 'loginname ALL=(ALL) ALL' >> /etc/sudoers

Expanding virtual disk size for a Fedora guest on VirtualBox

First, while the virtual machine is down, resize the disk image:

vboxmanage modifyhd vdi_disk_image_name.vdi --resize new_size_in_mb

Now boot the image and logon. If you’re not using LVM, I think to resize regular partitions it’s as simple as starting gparted, and then just drag the size of the partition to take up the new unformatted space. If you are using LVM, then do the following:

sudo lvm

List physical volumes with pvs, find the one containing the logical volume that you want to resize, and then use pvresize:

pvresize --setphysicalvolumesize xxG /dev/name

To show volume groups:

vgs

To show logical volumes:

lvs

To expand a logical volume to use the newly added space:

lvextend -L +sizeG vg_groupname/lv_volumename

where size is the new size in GB.

VirtualBox vdi disk image failed

I’ve had physical drives fail before, but this is a first. I’ve used VirtualBox on and off for years for those times when you need to fire up a guest os and it’s always worked fine, no issues. I just installed Fedora 16 on a new virtual drive image and on the first reboot after installing the VM crashed. After that point VirtualBox wouldn’t boot it any more saying the vdi headers were corrupt.

Wow, ok. Other than messing with headers physically in the image file, it appears there’s no repair options or tools. This is the first time I’ve seen this, so giving it the benefit of the doubt, I downloaded the latest version, 4.1.8, created a new vm and new disk image, and I’m installing again.