﻿id	summary	reporter	owner	description	type	status	component	version	resolution	keywords	cc	guest	host
20827	VBox Guest Additions to prompt Linux users to install development modules	Rajeev Sreedharan		"Note : Below is not a bug, but a user experience enhancement.

'''Scenario :'''
- During Oracle Linux 8 (OL8) VM creation, only 'Server with GUI' selected in installation software selection
- Post OL installation, Insert guest addition image, which will in most cases automatically popup an installation 
- Installation fails with error 'Kernel headers not found' or 'Kernel driver not installed (rc=-1908)'

'''Available Solutions :''' 
It's already well documented in [https://www.virtualbox.org/manual/ch04.html#additions-linux-install ch04] and [https://www.virtualbox.org/manual/ch02.html#externalkernelmodules ch02] of Virtualbox manuals that : Required packages may include GNU compiler (GCC), GNU Make (make), Kernel header files. So incase of OL with UEK, running below and installing vbox extension works perfectly:
{{{
sudo dnf install kernel-uek-devel-$(uname -r)
}}} 


'''Practical Scenario :'''
For users (which may include non-technical users), after a successful Linux installation, generally vbox extensions is next step. The installation of extension fails with below characteristics
- The 'Kernel headers not found' is logged between other info logs and is not necessarily the final text in the console output.
- Many first time users, including tech folks, may not spot the error initially or may not understand them at all
- The log copy-paste function cannot be enabled until the extensions are installed successfully
Users may eventually get it working by searching amongst several other fixes around the web with same generic message, but let's say it does not do that out of the box. 

'''Sample solution :'''
I'll leave the solution part to the experts, but typically for a seamless installation, perhaps something like below should be fine?[[BR]]

If kernel headers not found, then vbox extension scripts (src/VBox/Additions/linux/installer/vboxadd.sh) can prompt users : [[BR]]
`Your system is not configured for building modules needed by vbox. You may run <$install_kernel_headers> as a super user. Alternately, if you would like vbox-extensions to do this for you, press 'y' now`.

where : $install_kernel_headers = 

* `IF (UEK) THEN $install_kernel_headers = dnf install kernel-uek-devel-$(uname -r)`
* `IF (Non-UEK/RHEL/Fedora) THEN $install_kernel_headers = dnf install kernel-devel-$(uname -r)`
* `IF (UBUNTU/DEBIAN) THEN $install_kernel_headers = apt install linux-headers-$(uname -r)`
* `IF (SUSE) Install kernel-source and kernel-syms?`

and so on.. 

I also understand making a standardized approach for all distros may not be possible. But if most major ones are handled that should make one last tiny step closer to a seamless experience.

'''Error log 1:'''

{{{
VirtualBox Guest Additions: Starting
VirtualBox Guest Additions: Building the VirtualBox Guest Additions kernel modules.  This may take a while.
VirtualBox Guest Additions: To build modules for other installed kernels, run
VirtualBox Guest Additions:  /sbin/rcvboxadd quicksetup <version>
VirtualBox Guest Additions: or
VirtualBox Guest Additions:  /sbin/rcvboxadd quicksetup all
VirtualBox Guest Additions: Kernel headers not found for target kernel
5.4.17-2136.302.7.2.el8uek.x86_64. Please install them and execute
  /sbin/rcvboxadd setup
ValueError: File context for /opt/VBoxGuestAdditions-6.1.32/other/mount.vboxsf already defined
modprobe vboxguest failed
The log file /var/log/vboxadd-setup.log may contain further information.
}}}


'''Error log 2: ''' Secure boot turned off. (The aspect of why official vbox modules are unsigned is not being highlighted here, since this also gets solved just by installing kernel-headers)

{{{
Kernel driver not installed (rc=-1908)
The VirtualBox Linux kernel driver is either not loaded or not set up correctly. Please try setting it up again by executing
'/sbin/vboxconfig'
as root.
If your system has EFI Secure Boot enabled you may also need to sign the kernel modules (vboxdrv, vboxnetflt, vboxnetadp, vboxpci) before you can load them. Please see your Linux system's documentation for more information.
where: suplibOsInit what: 3 VERR_VM_DRIVER_NOT_INSTALLED (-1908) - The support driver is not installed. On linux, open returned ENOENT.
}}}

"	enhancement	new	guest additions	VirtualBox 6.1.32		Kernel driver not installed (rc=-1908)		Linux	all
