Thursday, September 19, 2013

Making Work VirtualBox on Fedora 19

After many hours trying to solve a basic problem while installing Virtual Box on my recently installed Fedora 19, i found a very simple solution, which no one post has.

Problem.

I've got the following description:

Trying to register the VirtualBox kernel modules using DKMSError! echo
Your kernel headers for kernel 3.3.4-5.fc17.x86_64 cannot be found at
/lib/modules/3.9.5-301.fc19.x86_64/build or /lib/modules/3.9.5-301.fc19.x86_64/source.
[FAILED]
(Failed, trying without DKMS)
Recompiling VirtualBox kernel modules [FAILED]
(Look at /var/log/vbox-install.log to find out what went wrong)


Paying attention to the source of the problem, the directory /lib/modules/3.9.5-301.fc19.x86_64 doesn't exists, when I go to the path /lib/modules/, an making an LS, I got:

[root@localhost modules]# ls -al /lib/modules
total 48
drwxr-xr-x.  5 root root  4096 Sep 19 08:26 .
dr-xr-xr-x. 68 root root 32768 Sep 19 12:49 ..
drwxr-xr-x.  6 root root  4096 Sep 19 12:29 3.10.11-200.fc19.x86_64
drwxr-xr-x.  7 root root  4096 Sep 19 16:12 3.11.1-200.fc19.x86_64
drwxr-xr-x.  6 root root  4096 Sep 19 12:29 3.9.5-301.fc19.x86_64


It looks like there is the requiered directory, but checking it better, I realize that ...

$[miguel@localhost kernels]$ ll 3.9.5-301.fc19.x86_64/
lrwxrwxrwx.  1 root root     38 Jun 27 13:14 build -> /usr/src/kernels/3.9.5-301.fc19.x86_64
drwxr-xr-x.  5 root root   4096 Sep 19 12:29 extra
drwxr-xr-x. 12 root root   4096 Jun 27 13:14 kernel


And build sym link has an error, because the origin /usr/src/kernels, doesn't contains the 3.9.5-301.fc19.x86_64 directory.

$[miguel@localhost kernels]$ ls -al /usr/src/kernels/
total 16
drwxr-xr-x.  4 root root 4096 Sep 19 15:39 .
drwxr-xr-x.  4 root root 4096 Sep 19 12:49 ..
drwxr-xr-x. 22 root root 4096 Sep 18 01:57 3.10.11-200.fc19.x86_64
drwxr-xr-x. 22 root root 4096 Sep 19 12:05 3.11.1-200.fc19.x86_64


Actually, this is correct, such that directory doesn't exists.

Solution.

After many hours, trying to get the missing kernel headers, and so..............


I realized that making

[root@localhost modules]# uname -r
3.9.5-301.fc19.x86_64


Even when I updated the Kernel, the old kernel still was referenced, and so I decided to use that kernel in my next boot, so editing the /boot/grub2/grub.cfg file, solves the problem. Just add a new entry to grub referencing to the updated kernel, and reboot.

### BEGIN /etc/grub.d/10_linux ###

### The configuration to make work the new kernel version, this for fixing the VirtualBox problem
menuentry 'Fedora, with Linux 3.11.1-200.fc19.x86_64' --class fedora --class gnu-linux --class gnu --class os $menuentry_id_option 'gnulinux-3.11.1-200.fc19.x86_64-advanced-68e3207d-d9ac-41ee-8db8-2bcb2dc308a1' {
    load_video
    set gfxpayload=keep
    insmod gzio
    insmod part_msdos
    insmod ext2
    set root='hd0,msdos6'
    if [ x$feature_platform_search_hint = xy ]; then
      search --no-floppy --fs-uuid --set=root --hint-bios=hd0,msdos6 --hint-efi=hd0,msdos6 --hint-baremetal=ahci0,msdos6 --hint='hd0,msdos6'  63534bc2-5c8b-49a8-8156-8ba8bfe5d2df
    else
      search --no-floppy --fs-uuid --set=root 63534bc2-5c8b-49a8-8156-8ba8bfe5d2df
    fi
    linux    /vmlinuz-3.11.1-200.fc19.x86_64 root=UUID=68e3207d-d9ac-41ee-8db8-2bcb2dc308a1 ro rd.md=0 rd.lvm=0 rd.dm=0 vconsole.keymap=us acpi_backlight=vendor acpi_osi=Linux rd.luks=0 vconsole.font=latarcyrheb-sun16 rhgb quiet
    initrd    /initramfs-3.11.1-200.fc19.x86_64.img
}

###End of custom configuration

menuentry 'Fedora, with Linux 3.9.5-301.fc19.x86_64' --class fedora...


Ok, now in the start screen, the new entry appears, and use the new entry, try to use VirtualBox as usuarl, and everything goes ok.

I hope it would be helpful, have a nice day community...