Page 1 of 1

making guest additions work for all installed kernels

Posted: 13. Apr 2014, 17:12
by murphyc
Is it possible to build guest additions such that it's available for all installed kernels? For example I have installed these kernels, chosen with the GRUB menu:

3.11.10-200.fc20.x86_64
3.12.11-201.fc19.x86_64
3.13.9-200.fc20.x86_64
3.14.0-1.fc21.x86_64

If I build guest additions running any one of these kernels, then reboot that same kernel version, guest additions work as expected. If I reboot with any other kernel they fail to load. If I boot any other kernel and build guest additions again the very first thing the script does is uninstall prior guest additions. So now guest additions only works with the current running kernel version and not the previous one. I'd like it to be available for all kernels so I can switch between them. Is this possible?

Re: making guest additions work for all installed kernels

Posted: 13. Apr 2014, 18:30
by Perryg
Afraid not. That would require 4 different guest additions being installed. You should be able to just run /etc/init.d/vboxadd setup instead of doing a complete install though.

Re: making guest additions work for all installed kernels

Posted: 13. Apr 2014, 19:18
by murphyc
I don't have /etc/init.d/vboxdrv, but I do have vboxadd.

# ./vboxadd setup
[snip]
Building the main Guest Additions module [FAILED]
(Look at /var/log/vboxadd-install.log to find out what went wrong)

Log contains this line:
/tmp/vbox.0/Makefile.include.header:115: *** Error: unable to find the include directory for your current Linux kernel. Specify KERN_INCL=<directory> and run Make again. Stop.

So I'm going to guess because kernel-headers isn't installed, this fails. But then I can't have multiple kernel-headers installed at the same time apparently (yum and dnf won't permit more than one version, and elsewhere I've read it's not possible although it's not explained why.)

Re: making guest additions work for all installed kernels

Posted: 13. Apr 2014, 19:27
by Perryg
I correct my post, sorry for the confusion.
It is as I explained. The additions need to be compiled against the running kernel for it to work. There are tests in the code to prevent this from being usurped because bad things can happen if they are not right. The additions are what allows the guest to talk to the host side code which in turns controls the operation of the PC.

Re: making guest additions work for all installed kernels

Posted: 13. Apr 2014, 19:52
by murphyc
I don't have a problem with the dependency to build guest additions per kernel. What would be nice is if it wouldn't *remove* already built guest additions for prior kernels, i.e. this line: Removing existing VirtualBox non-DKMS kernel modules.

Are those modules stored somewhere other than /lib/modules/<version> ? It seems if the guest additions are kernel version specific, the guest addition bits ought to only be placed in a kernel version specific directory, and not deleted unless that kernel version is running. That way I could build the kernel module per kernel.

What's presently happening is when I build guest additions while running kernel 3.14.0, the step "Removing existing VirtualBox non-DKMS kernel modules" is deleting kernel modules for non-running kernel 3.13.9.

Re: making guest additions work for all installed kernels

Posted: 13. Apr 2014, 20:27
by Perryg
Well I have explained it the best I can. Someday when you understand Linux better you will have your answer.