Installing VirtualBox Guest Additions in openSUSE VM

I’m trying to install the Virtual Box Guest Addition for my openSUSE 11.3 VM, but I’m having some problems.

The Virtual Box manual says I need to install the kernel-default-devel package, so I did that, but it also says :

Make sure that your running kernel (uname -a) and the kernel packages you have installed (rpm -qa kernel*) have the exact same version number. Proceed with the installation as described above.

So I ran both commands and here is the output :

edgar@linux-t7uc:/> uname -a
Linux linux-t7uc 2.6.34-12-default #1 SMP 2010-06-29 02:39:08 +0200 i686 athlon i386 GNU/Linux
edgar@linux-t7uc:/> rpm -qa kernel*
kernel-default-2.6.34-12.3.i586
kernel-default-devel-2.6.34.7-0.7.1.i586
kernel-devel-2.6.34.7-0.7.1.noarch

So the devel packages are version 2.6.34.7-0.7.1 and the kernel is version 2.6.34-12.

How do I install the correct version of the kernel-default-devel and kernel-devel package with zypper?

I thought maybe the versions could be compatible somehow, so I tried to install the Guest Addition and here’s the result :

edgar@linux-t7uc:/media/VBOXADDITIONS_4.0.4_70112> sudo sh ./VBoxLinuxAdditions.run
root’s password:
Verifying archive integrity… All good.
Uncompressing VirtualBox 4.0.4 Guest Additions for Linux…
VirtualBox Guest Additions installer
Removing installed version 4.0.4 of VirtualBox Guest Additions…
Removing existing VirtualBox DKMS kernel modules done
Removing existing VirtualBox non-DKMS kernel modules done
Building the VirtualBox Guest Additions kernel modules
The headers for the current running kernel were not found. If the following
module compilation fails then this could be the reason.
The missing package can be probably installed with
zypper install kernel-2.6.34-12-default

failed
Your system does not seem to be set up to build kernel modules.
Look at /var/log/vboxadd-install.log to find out what went wrong.

Once you have corrected it, you can run

/etc/init.d/vboxadd setup

to build them.

Doing non-kernel setup of the Guest Additions done
Installing the Window System drivers
Installing X.Org Server 1.8 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
edgar@linux-t7uc:/media/VBOXADDITIONS_4.0.4_70112>

So I tried
zypper install kernel-2.6.34-12-default
but it doesn’t find the package.

I also looked at /var/log/vboxadd-install.log to see what went wrong, and this is what it says :

Makefile:25: Warning: using /usr/src/linux as the source directory of your Linux kernel. If this is not correct, specify KERN_DIR=<directory> and run Make again.
grep: /usr/src/linux/include/linux/version.h: No such file or directory
make KBUILD_VERBOSE=1 -C /usr/src/linux SUBDIRS=/tmp/vbox.0 SRCROOT=/tmp/vbox.0 modules
test -e include/generated/autoconf.h -a -e include/config/auto.conf || (
echo;
echo " ERROR: Kernel configuration is invalid.“;
echo " include/generated/autoconf.h or include/config/auto.conf are missing.”;
echo " Run ‘make oldconfig && make prepare’ on kernel src to fix it.";
echo;
/bin/false)

** ERROR: Kernel configuration is invalid.
include/generated/autoconf.h or include/config/auto.conf are missing.
Run ‘make oldconfig && make prepare’ on kernel src to fix it.**

mkdir -p /tmp/vbox.0/.tmp_versions ; rm -f /tmp/vbox.0/.tmp_versions/*

** WARNING: Symbol version dump /usr/src/linux-2.6.34.7-0.7/Module.symvers
is missing; modules will have no dependencies and modversions.**

make -f scripts/Makefile.build obj=/tmp/vbox.0
/tmp/vbox.0/Makefile:25: Warning: using /usr/src/linux as the source directory of your Linux kernel. If this is not correct, specify KERN_DIR=<directory> and run Make again.
grep: /usr/src/linux/include/linux/version.h: No such file or directory
gcc -Wp,-MD,/tmp/vbox.0/.test.o.d -nostdinc -isystem /usr/lib/gcc/i586-suse-linux/4.5/include -I/usr/src/linux-2.6.34.7-0.7/arch/x86/include -Iinclude -include include/generated/autoconf.h -D__KERNEL__ -Wall -Wundef -Wstrict-prototypes -Wno-trigraphs -fno-strict-aliasing -fno-common -Werror-implicit-function-declaration -Wno-format-security -fno-delete-null-pointer-checks -O2 -m64 -mno-red-zone -mcmodel=kernel -maccumulate-outgoing-args -DCONFIG_AS_CFI_SIGNAL_FRAME=1 -pipe -Wno-sign-compare -fno-asynchronous-unwind-tables -fomit-frame-pointer -I/usr/src/linux/include -I/tmp/vbox.0/ -I/tmp/vbox.0/include -I/tmp/vbox.0/r0drv/linux -D__KERNEL__ -DMODULE -DRT_OS_LINUX -DIN_RING0 -D_X86_ -DIN_RT_R0 -DIN_SUP_R0 -DVBGL_VBOXGUEST -DVBGL_HGCM -DVBOX_WITH_HGCM -DMODULE -D"KBUILD_STR(s)=#s" -D"KBUILD_BASENAME=KBUILD_STR(test)" -D"KBUILD_MODNAME=KBUILD_STR(vboxadd_test)" -c -o /tmp/vbox.0/test.o /tmp/vbox.0/test.c
/tmp/vbox.0/test.c:1:0: error: code model ‘kernel’ not supported in the 32 bit mode
/tmp/vbox.0/test.c:1:0: sorry, unimplemented: 64-bit mode not compiled in
make[2]: *** [/tmp/vbox.0/test.o] Error 1
make[1]: *** [module/tmp/vbox.0] Error 2
make: *** [vboxadd_test] Error 2
Creating user for the Guest Additions.
Creating udev rule for the Guest Additions kernel module.

So does anyone know what I should do differently to fix this and get it running?

Thanks, Edgar

zypper install kernel-2.6.34-12-default

is wrong drop the default part. or use Yast to sort it out. Attention to the version tab below the package list.

Okay, I think I got it working using the YaST Software Manager. I had to install some extra packages, namely those listed below after ‘rpm -qa kernel*’.

edgar@linux-xdcd:~> uname -a
Linux linux-xdcd 2.6.34-12-default #1 SMP 2010-06-29 02:39:08 +0200 i686 athlon i386 GNU/Linux
edgar@linux-xdcd:~> rpm -qa kernel*
kernel-default-2.6.34-12.3.i586
kernel-xen-devel-2.6.34-12.3.i586
kernel-default-devel-2.6.34-12.3.i586
kernel-desktop-devel-2.6.34-12.3.i586
kernel-source-2.6.34-12.3.noarch
kernel-syms-2.6.34-12.3.i586
kernel-devel-2.6.34-12.3.noarch
kernel-pae-devel-2.6.34-12.3.i586
edgar@linux-xdcd:~>

So the main packages were kernel-default-devel, kernel-source, and kernel-syms, with the other packages co-installed as dependencies.

The package versions don’t exactly match the kernel version, but they were the closest I could find, matching exactly up to the .3 part. Hopefully they’re still compatible.

Everything appeared to build okay, except for the warning about having a preinstalled version of the Guest Additions. I said yes to continue anyway.

edgar@linux-xdcd:/media/VBOXADDITIONS_4.0.4_70112> sudo sh ./VBoxLinuxAdditions.run
root’s password:
Verifying archive integrity… All good.
Uncompressing VirtualBox 4.0.4 Guest Additions for Linux…
VirtualBox Guest Additions installer
You appear to have a version of the VBoxGuestAdditions software
on your system which was installed from a different source or using a
different type of installer. If you installed it from a package from your
Linux distribution or if it is a default part of the system then we strongly
recommend that you cancel this installation and remove it properly before
installing this version. If this is simply an older or a damaged
installation you may safely proceed.

Do you wish to continue anyway? [yes or no]
yes
Removing existing VirtualBox DKMS kernel modules
Removing existing VirtualBox non-DKMS kernel modules
Removing existing VirtualBox DKMS kernel modules
Removing existing VirtualBox non-DKMS kernel modules
Building the VirtualBox Guest Additions kernel modules
Building the main Guest Additions module
Building the shared folder support module
Building the OpenGL support module
Doing non-kernel setup of the Guest Additions
You should restart your guest to make sure the new modules are actually used

Installing the Window System drivers
Installing X.Org Server 1.8 modules
Setting up the Window System to use the Guest Additions
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
edgar@linux-xdcd:/media/VBOXADDITIONS_4.0.4_70112>

I restarted the VM and it seems everything is working okay so far, now I’ve got a Shared Folder between host and guest (VM Menu->Devices->Shared Folders) and the clipboard is shared as well.

Two new questions :

  1. How do I change the machine name (from edgar@linux-xdcd to edgar@cloud9)?

  2. How do I change the color depth of the virtual monitor? It’s stuck at 16bit color. I tried using the quick launch icon to Configure Display Settings, but there’s no option to change the color depth. Is there some other configuration somewhere?

You should only need
kernel-source-2.6.34-12.3.noarch
kernel-syms-2.6.34-12.3.i586

In yast in Network Settings - Hostname/DNS tab to set machine name or it can be done at install but you need to select the advanced install option (don’t know why they changed that)

Have you installed the Guest Additions this is normally required for any advanced video settings