From 06c8f73ab17e721860fc0618eeeeb3efb054ced3934d7061dda03f466088914b Mon Sep 17 00:00:00 2001 From: Larry Finger Date: Tue, 30 Jul 2019 19:54:24 +0000 Subject: [PATCH] Accepting request 719647 from home:lwfinger:branches:Virtualization - Merge host kmp and guest kmp into a single kmp. The existence of two different kernel module packages is believed to be the reason that it is possible for a new kernel not to include the necessary kernel modules (boo#1142955). Files "virtualbox-host-kmp-files" and "virtualbox-guest-kmp-files" are deleted. File "virtualbox-kmp-files" is added. Files "virtualbox-host-preamble" and virtualbox-guest-preamble" are deleted. File "virtualbox-kmp-preamble" is added. File "fix_conflict_between_host_and_guest.patch" is added. - Script vboxdrv.sh, which is called from the systemd service file, incorrectly called a routine that does not exist when the kernel modules were not available. This call is changed to /sbin/vboxconfig that will build the modules if the requisite packages are available. If that is not true, the systemctl status vboxdrv will list the command needed to load the missing packages. This change address part of boo#1142995. OBS-URL: https://build.opensuse.org/request/show/719647 OBS-URL: https://build.opensuse.org/package/show/Virtualization/virtualbox?expand=0&rev=498 --- fix_conflict_between_host_and_guest.patch | 13 ++++ vboxdrv.sh | 2 +- vboxguestconfig.sh | 8 +-- virtualbox-guest-kmp-files | 8 --- virtualbox-guest-preamble | 8 --- virtualbox-host-preamble | 8 --- ...box-host-kmp-files => virtualbox-kmp-files | 3 + virtualbox-kmp-preamble | 3 + virtualbox.changes | 21 ++++++ virtualbox.spec | 67 ++++++++----------- 10 files changed, 74 insertions(+), 67 deletions(-) create mode 100644 fix_conflict_between_host_and_guest.patch delete mode 100644 virtualbox-guest-kmp-files delete mode 100644 virtualbox-guest-preamble delete mode 100644 virtualbox-host-preamble rename virtualbox-host-kmp-files => virtualbox-kmp-files (67%) create mode 100644 virtualbox-kmp-preamble diff --git a/fix_conflict_between_host_and_guest.patch b/fix_conflict_between_host_and_guest.patch new file mode 100644 index 0000000..78daf05 --- /dev/null +++ b/fix_conflict_between_host_and_guest.patch @@ -0,0 +1,13 @@ +Index: VirtualBox-6.0.10/src/VBox/Additions/common/VBoxGuest/VBoxGuest-haiku.c +=================================================================== +--- VirtualBox-6.0.10.orig/src/VBox/Additions/common/VBoxGuest/VBoxGuest-haiku.c ++++ VirtualBox-6.0.10/src/VBox/Additions/common/VBoxGuest/VBoxGuest-haiku.c +@@ -130,7 +130,7 @@ static struct vboxguest_module_info g_VB + RTMemAllocExTag, + RTMemContAlloc, + RTMemContFree, +- RTMemFreeEx, ++ RTMemFreeExG, + RTMpIsCpuPossible, + RTMpNotificationDeregister, + RTMpNotificationRegister, diff --git a/vboxdrv.sh b/vboxdrv.sh index b47e78f..535e6e4 100644 --- a/vboxdrv.sh +++ b/vboxdrv.sh @@ -210,7 +210,7 @@ start_drv() failure "Cannot remove $DEVICE" fi if ! $MODPROBE vboxdrv > /dev/null 2>&1; then - setup + /sbin/vboxconfig if ! $MODPROBE vboxdrv > /dev/null 2>&1; then failure "modprobe vboxdrv failed. Please use 'dmesg' to find out why" fi diff --git a/vboxguestconfig.sh b/vboxguestconfig.sh index 959f9fc..db91e41 100644 --- a/vboxguestconfig.sh +++ b/vboxguestconfig.sh @@ -9,8 +9,8 @@ SOURCE="/usr/src/kernel-modules/" LOGFILE="/var/log/virtualbox.log" INCLUDE="/lib/modules/`uname -r`/build/include" # -# Test if vboxsf module loaded. If it is, skip everything else -loaded=$(lsmod | grep vboxsf) +# Test if vboxguest module loaded. If it is, skip everything else +loaded=$(lsmod | grep vboxguest) if [ -n "$loaded" ] ; then echo "Kernel modules available. but we will continue..." fi @@ -28,7 +28,7 @@ popd > /dev/null 2>&1 # # Check if virtualbox-guest-source version matches virtualbox version if [ "$(rpm -q virtualbox virtualbox-guest-source --queryformat='%{version}-%{release}\n' 2>/dev/null | sort -u | wc -l)" -ne "1" ] ; then - echo "virtualbox-host-source package version doesn't match the version of virtualbox package." + echo "virtualbox-guest-source package version doesn't match the version of virtualbox package." echo "This situation is probably not fatal, thus we will try to continue .." fi # Prerequisites are available, start build @@ -53,7 +53,7 @@ if [ "$?" -ne 0 ] ; then exit 1 fi depmod -a -modprobe -av vboxguest vboxvideo vboxsf +modprobe -av vboxsf vboxguest vboxvideo cd ../.. rm -rf additions popd > /dev/null 2>&1 diff --git a/virtualbox-guest-kmp-files b/virtualbox-guest-kmp-files deleted file mode 100644 index b5ac415..0000000 --- a/virtualbox-guest-kmp-files +++ /dev/null @@ -1,8 +0,0 @@ -%defattr (-,root,root) -%dir /lib/modules/%2-%1/ -%dir /lib/modules/%2-%1/extra -/lib/modules/%2-%1/extra/vboxsf.ko -/lib/modules/%2-%1/extra/vboxguest.ko -%if 0%{?suse_version} >= 1500 -/lib/modules/%2-%1/extra/vboxvideo.ko -%endif diff --git a/virtualbox-guest-preamble b/virtualbox-guest-preamble deleted file mode 100644 index dc1b5c3..0000000 --- a/virtualbox-guest-preamble +++ /dev/null @@ -1,8 +0,0 @@ -Requires: kernel-%1 -Provides: virtualbox-guest-kmp = %version -#rename from ose version: -Provides: virtualbox-ose-guest-kmp-%1 = %version -Obsoletes: virtualbox-ose-guest-kmp-%1 < %version -#host (vboxdrv) and guest (vboxguest) kmp exports the same symbol (RTMemFreeEx) -#which break loading modules using modprobe (bnc#661740) -Conflicts: virtualbox-host-kmp diff --git a/virtualbox-host-preamble b/virtualbox-host-preamble deleted file mode 100644 index 35ddcbb..0000000 --- a/virtualbox-host-preamble +++ /dev/null @@ -1,8 +0,0 @@ -Requires: kernel-%1 -Provides: virtualbox-host-kmp = %version -#rename from ose version: -Provides: virtualbox-ose-host-kmp-%1 = %version -Obsoletes: virtualbox-ose-host-kmp-%1 < %version -#host (vboxdrv) and guest (vboxguest) kmp exports the same symbol (RTMemFreeEx) -#which break loading modules using modprobe (bnc#661740) -Conflicts: virtualbox-guest-kmp diff --git a/virtualbox-host-kmp-files b/virtualbox-kmp-files similarity index 67% rename from virtualbox-host-kmp-files rename to virtualbox-kmp-files index 21f6599..c327efd 100644 --- a/virtualbox-host-kmp-files +++ b/virtualbox-kmp-files @@ -5,3 +5,6 @@ /lib/modules/%2-%1/extra/vboxnetadp.ko /lib/modules/%2-%1/extra/vboxnetflt.ko /lib/modules/%2-%1/extra/vboxpci.ko +/lib/modules/%2-%1/extra/vboxsf.ko +/lib/modules/%2-%1/extra/vboxvideo.ko +/lib/modules/%2-%1/extra/vboxguest.ko diff --git a/virtualbox-kmp-preamble b/virtualbox-kmp-preamble new file mode 100644 index 0000000..79ed2ff --- /dev/null +++ b/virtualbox-kmp-preamble @@ -0,0 +1,3 @@ +Requires: kernel-%1 +Provides: virtualbox-kmp = %version + diff --git a/virtualbox.changes b/virtualbox.changes index 3cef1dc..c844e03 100644 --- a/virtualbox.changes +++ b/virtualbox.changes @@ -1,3 +1,24 @@ +------------------------------------------------------------------- +Mon Jul 29 06:40:41 UTC 2019 - Larry Finger + +- Merge host kmp and guest kmp into a single kmp. The existence of two different kernel module + packages is believed to be the reason that it is possible for a new kernel not to include + the necessary kernel modules (boo#1142955). + Files "virtualbox-host-kmp-files" and "virtualbox-guest-kmp-files" are deleted. + File "virtualbox-kmp-files" is added. + Files "virtualbox-host-preamble" and virtualbox-guest-preamble" are deleted. + File "virtualbox-kmp-preamble" is added. + File "fix_conflict_between_host_and_guest.patch" is added. + +------------------------------------------------------------------- +Sat Jul 27 01:53:12 UTC 2019 - Larry Finger + +- Script vboxdrv.sh, which is called from the systemd service file, incorrectly called a routine + that does not exist when the kernel modules were not available. This call is changed to /sbin/vboxconfig + that will build the modules if the requisite packages are available. If that is not true, the + systemctl status vboxdrv will list the command needed to load the missing packages. This change + address part of boo#1142995. + ------------------------------------------------------------------- Thu Jul 18 11:48:00 UTC 2019 - Larry Finger diff --git a/virtualbox.spec b/virtualbox.spec index acb359e..0504d1d 100644 --- a/virtualbox.spec +++ b/virtualbox.spec @@ -62,10 +62,8 @@ Source0: VirtualBox-%{version}-patched.tar.bz2 Source1: UserManual.pdf Source3: %{name}-60-vboxguest.rules Source4: %{name}-default.virtualbox -Source5: %{name}-host-kmp-files -Source6: %{name}-guest-kmp-files -Source7: %{name}-host-preamble -Source8: %{name}-guest-preamble +Source5: %{name}-kmp-files +Source7: %{name}-kmp-preamble Source9: %{name}-wrapper.sh Source10: %{name}-LocalConfig.kmk Source11: %{name}-60-vboxdrv.rules @@ -119,6 +117,8 @@ Patch108: virtualbox-snpritnf-buffer-overflow.patch Patch109: vbox-usb-warning.diff # Patch to ensure that VirtualBoxVM is SUID Patch110: vbox-suid-warning.diff +# Fix symbol conflict between host and guest kmp +Patch111: fix_conflict_between_host_and_guest.patch # Fix change in kernel API for ttm_bo_move_memcpy() Patch112: modify_for_4_8_bo_move.patch # Remove all mention of _smp_mflags @@ -218,7 +218,7 @@ BuildRequires: pkgconfig(xineramaproto) BuildRequires: pkgconfig(xmu) BuildRequires: pkgconfig(xproto) BuildRequires: pkgconfig(xrandr) -Requires: %{name}-host-kmp = %{version} +Requires: %{name}-kmp = %{version} Requires(post): sysvinit(syslog) Requires(pre): permissions %if ! 0%{?suse_version} > 1325 @@ -283,30 +283,22 @@ Obsoletes: %{name}-vboxwebsrv The VirtualBox web server is used to control headless VMs using a browser. ######################################### -%package host-KMP -Summary: Host kernel module for VirtualBox +%package kmp +Summary: Kernel modules for VirtualBox Group: System/Emulators/PC -%kernel_module_package -t %{_builddir}/virtualbox-kmp-template -p %{SOURCE7} -n %{name}-host -f %{SOURCE5} -x kdump um xen pae xenpae pv +%kernel_module_package -t %{_builddir}/virtualbox-kmp-template -p %{SOURCE7} -n %{name} -f %{SOURCE5} -x kdump um xen pae xenpae pv Requires: %{kernel_module_package_buildreqs} +Obsoletes: %{name}-guest-kmp +Obsoletes: %{name}-host-kmp -%description host-KMP -This package contains the kernel-modules that VirtualBox uses to create virtual machines. -########################################## - -%package guest-KMP -Summary: Guest kernel modules for VirtualBox -Group: System/Emulators/PC -%kernel_module_package -t %{_builddir}/virtualbox-kmp-template -p %{SOURCE8} -n %{name}-guest -f %{SOURCE6} -x kdump um xen pae xenpae pv -Requires: %{kernel_module_package_buildreqs} - -%description guest-KMP -This package contains the VB kernel-modules for Linux guest virtual machines. +%description kmp +This package contains the kernel-modules that VirtualBox uses to create or run virtual machines. ########################################## %package guest-x11 Summary: VirtualBox X11 drivers for mouse and video Group: System/X11/Servers/XF86_4 -Requires: %{name}-guest-kmp = %{version} +Requires: %{name}-kmp = %{version} Supplements: modalias(xorg-x11-server:pci:v000080EEd0000BEEFsv*sd*bc*sc*i*) #rename from xorg-x11-driver-virtualbox-ose: Provides: xorg-x11-driver-virtualbox-ose = %{version} @@ -319,7 +311,7 @@ This package contains X11 guest utilities and X11 guest mouse and video drivers %package guest-tools Summary: VirtualBox guest tools Group: System/Emulators/PC -Requires: %{name}-guest-kmp = %{version} +Requires: %{name}-kmp = %{version} Supplements: modalias(pci:v000080EEd0000BEEFsv*sd*bc*sc*i*) #rename from "ose" version: Provides: %{name}-ose-guest-tools = %{version} @@ -390,7 +382,7 @@ BuildArch: noarch %description guest-source Source files for %{name} guest kernel modules These can be built for custom kernels using -cd %{_prefix}/src/kernel-modules/virtualbox/guest ; make ; make install +sudo /sbin/vboxguestconfig ########################################### %package guest-desktop-icons @@ -435,6 +427,7 @@ as an "extpack" for VirtualBox. The implementation is licensed under GPL. %patch108 -p1 %patch109 -p1 %patch110 -p1 +%patch111 -p1 %patch112 -p1 %patch113 -p1 %patch115 -p1 @@ -536,15 +529,15 @@ install -D -m 644 "COPYING" "%{buildroot}%{_datadir}/licenses/LICENSE.vnc" # # build kernel modules for guest and host (check novel-kmp package as example) # host modules : vboxdrv,vboxnetflt,vboxnetadp,vboxpci -# guest modules : vboxguest,vboxsf vboxvideo (for Leap 15.1) +# guest modules : vboxguest,vboxsf vboxvideo (for Leap 15.1 and older) echo "build kernel modules" -%if 0%{?suse_version} >= 1500 +#%if 0%{?suse_version} < 1550 for vbox_module in out/linux.*/release/bin/src/vbox{drv,netflt,netadp,pci} \ out/linux.*/release/bin/additions/src/vbox{guest,sf,video}; do -%else -for vbox_module in out/linux.*/release/bin/src/vbox{drv,netflt,netadp,pci} \ - out/linux.*/release/bin/additions/src/vbox{guest,sf}; do -%endif +#%else +#for vbox_module in out/linux.*/release/bin/src/vbox{drv,netflt,netadp,pci} \ +# out/linux.*/release/bin/additions/src/vbox{guest,sf}; do +#%endif #get the module name from path module_name=$(basename "$vbox_module") @@ -568,7 +561,7 @@ for vbox_module in out/linux.*/release/bin/src/vbox{drv,netflt,netadp,pci} \ fi # copy vboxguest (for guest) module symbols which are used by vboxsf and vboxvideo km's: if [ "$module_name" = "vboxsf" -o \ - "$module_name" = "vboxvideo" ] ; then + "$module_name" = "vboxvideo" ] ; then cp $PWD/modules_build_dir/$flavor/vboxguest/Module.symvers \ $PWD/modules_build_dir/$flavor/$module_name fi @@ -603,7 +596,7 @@ install -d -m 755 %{buildroot}%{_udevrulesdir} install -d -m 755 %{buildroot}%{_sysconfdir}/X11/xinit/xinitrc.d #################################################################################### -echo "entering virtualbox-kmp-guest and virtualbox-kmp-host install section" +echo "entering virtualbox-kmp install section" #################################################################################### export INSTALL_MOD_PATH=%{buildroot} export INSTALL_MOD_DIR=extra @@ -611,11 +604,11 @@ export INSTALL_MOD_DIR=extra export INITRD_IN_POSTTRANS=1 export KMP_NEEDS_MKINITRD=0 #to install modules we use here similar steps like in build phase, go through all the modules : -%if 0%{?suse_version} >= 1500 +#%if 0%{?suse_version} < 1550 for module_name in vbox{drv,netflt,pci,netadp,guest,sf,video} -%else -for module_name in vbox{drv,netflt,pci,netadp,guest,sf} -%endif +#%else +#for module_name in vbox{drv,netflt,pci,netadp,guest,sf} +#%endif do #and through the all flavors for flavor in %{flavors_to_build}; do @@ -816,7 +809,7 @@ getent group vboxusers >/dev/null || groupadd -r vboxusers # Add groups for seamless mode and shared folders: getent group vboxguest >/dev/null || groupadd -r vboxguest getent group vboxsf >/dev/null || groupadd -r vboxsf -%if 0%{?suse_version} >= 1500 +%if 0%{?suse_version} <= 1500 getent group vboxvideo >/dev/null || groupadd -r vboxvideo %endif %service_add_pre vboxadd-service.service @@ -1031,8 +1024,6 @@ export DISABLE_RESTART_ON_UPDATE=yes %{_bindir}/VBoxClient %{_libdir}/VBoxOGL*.so %{_libdir}/VBoxEGL*.so -#%%{_libdir}/xorg/modules/drivers/vboxvideo_drv.so -#%%{_libdir}/dri/vboxvideo_dri.so %{_sysconfdir}/X11/xinit/xinitrc.d/vboxadd-xclient.sh %files guest-tools