making guest additions work for all installed kernels

Discussions about using Linux guests in VirtualBox.
Post Reply
murphyc
Posts: 38
Joined: 21. Mar 2012, 07:09

making guest additions work for all installed kernels

Post 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?
Perryg
Site Moderator
Posts: 34369
Joined: 6. Sep 2008, 22:55
Primary OS: Linux other
VBox Version: OSE self-compiled
Guest OSses: *NIX

Re: making guest additions work for all installed kernels

Post 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.
murphyc
Posts: 38
Joined: 21. Mar 2012, 07:09

Re: making guest additions work for all installed kernels

Post 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.)
Perryg
Site Moderator
Posts: 34369
Joined: 6. Sep 2008, 22:55
Primary OS: Linux other
VBox Version: OSE self-compiled
Guest OSses: *NIX

Re: making guest additions work for all installed kernels

Post 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.
murphyc
Posts: 38
Joined: 21. Mar 2012, 07:09

Re: making guest additions work for all installed kernels

Post 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.
Perryg
Site Moderator
Posts: 34369
Joined: 6. Sep 2008, 22:55
Primary OS: Linux other
VBox Version: OSE self-compiled
Guest OSses: *NIX

Re: making guest additions work for all installed kernels

Post by Perryg »

Well I have explained it the best I can. Someday when you understand Linux better you will have your answer.
Post Reply