LinuxQuestions.org
Latest LQ Deal: Latest LQ Deals
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > Slackware
User Name
Password
Slackware This Forum is for the discussion of Slackware Linux.

Notices


Reply
  Search this Thread
Old 12-04-2019, 01:59 PM   #1
rahrah
Member
 
Registered: Jun 2008
Location: London, England
Distribution: Slackware
Posts: 32

Rep: Reputation: 51
VirtualBox on Kernel 5.4.x


Hi,

Virtualbox 6.0.14 kernel modules did not compile against the latest 5.4.x kernel in slackware-current. The attached patch worked for me.

There are multiple copies of cdefs.h and the-linux-kernel.h, os if your copies aren't hard linked, you may have to copy the patched file over the other copies.

More details can be found here:

https://www.virtualbox.org/ticket/18...=0&cnum_hist=2

I note there are other builds on the VB site that that fix this, too.

Cheers,

===Rich

Code:
diff -ur vboxhost.old/vboxdrv/include/iprt/cdefs.h vboxhost/vboxdrv/include/iprt/cdefs.h
--- vboxhost.old/vboxdrv/include/iprt/cdefs.h	2019-02-02 12:26:56.000000000 +0000
+++ vboxhost/vboxdrv/include/iprt/cdefs.h	2019-12-02 23:07:00.385091894 +0000
@@ -1166,7 +1166,7 @@
  * Tell the compiler that we're falling through to the next case in a switch.
  * @sa RT_FALL_THRU  */
 #if RT_GNUC_PREREQ(7, 0)
-# define RT_FALL_THROUGH()      __attribute__((fallthrough))
+# define RT_FALL_THROUGH()      __attribute__((__fallthrough__))
 #else
 # define RT_FALL_THROUGH()      (void)0
 #endif

diff -ur vboxhost.old/vboxdrv/r0drv/linux/the-linux-kernel.h vboxhost/vboxdrv/r0drv/linux/the-linux-kernel.h
--- vboxhost.old/vboxdrv/r0drv/linux/the-linux-kernel.h	2019-09-11 10:59:56.000000000 +0100
+++ vboxhost/vboxdrv/r0drv/linux/the-linux-kernel.h	2019-12-02 23:34:24.912085621 +0000
@@ -336,7 +336,11 @@
 # endif
 #endif
 
-#if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 25)
+/* XXX The 5.4 kernel has no interface anymore to make kernel pages execcutable */
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(5, 4, 0)                                 
+# define MY_SET_PAGES_EXEC(pPages, cPages)   do {} while (0) 
+# define MY_SET_PAGES_NOEXEC(pPages, cPages) do {} while (0)     
+#elif LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 25)
 # define MY_SET_PAGES_EXEC(pPages, cPages)    set_pages_x(pPages, cPages)
 # define MY_SET_PAGES_NOEXEC(pPages, cPages)  set_pages_nx(pPages, cPages)
 #else

diff -ur vboxhost.old/vboxdrv/r0drv/linux/thread2-r0drv-linux.c vboxhost/vboxdrv/r0drv/linux/thread2-r0drv-linux.c
--- vboxhost.old/vboxdrv/r0drv/linux/thread2-r0drv-linux.c	2019-01-23 11:39:29.000000000 +0000
+++ vboxhost/vboxdrv/r0drv/linux/thread2-r0drv-linux.c	2019-12-02 23:35:58.608085263 +0000
@@ -36,6 +36,9 @@
 #include <iprt/errcore.h>
 #include "internal/thread.h"
 
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 11, 0)
+    #include <uapi/linux/sched/types.h>
+#endif
 
 RTDECL(RTTHREAD) RTThreadSelf(void)
 {

diff -ur vboxhost.old/vboxnetflt/linux/VBoxNetFlt-linux.c vboxhost/vboxnetflt/linux/VBoxNetFlt-linux.c
--- vboxhost.old/vboxnetflt/linux/VBoxNetFlt-linux.c	2019-09-12 13:21:27.000000000 +0100
+++ vboxhost/vboxnetflt/linux/VBoxNetFlt-linux.c	2019-12-02 23:31:34.265086272 +0000
@@ -924,8 +924,13 @@
     for (i = 0; i < skb_shinfo(pBuf)->nr_frags; i++)
     {
         skb_frag_t *pFrag = &skb_shinfo(pBuf)->frags[i];
+# if LINUX_VERSION_CODE >= KERNEL_VERSION(5, 4, 0)
+        pSG->aSegs[iSeg].cb = pFrag->bv_len;
+        pSG->aSegs[iSeg].pv = VBOX_SKB_KMAP_FRAG(pFrag) + pFrag->bv_offset;
+# else /* < KERNEL_VERSION(5, 4, 0) */
         pSG->aSegs[iSeg].cb = pFrag->size;
         pSG->aSegs[iSeg].pv = VBOX_SKB_KMAP_FRAG(pFrag) + pFrag->page_offset;
+# endif /* >= KERNEL_VERSION(5, 4, 0) */
         Log6((" %p", pSG->aSegs[iSeg].pv));
         pSG->aSegs[iSeg++].Phys = NIL_RTHCPHYS;
         Assert(iSeg <= pSG->cSegsAlloc);
@@ -940,8 +945,14 @@
         for (i = 0; i < skb_shinfo(pFragBuf)->nr_frags; i++)
         {
             skb_frag_t *pFrag = &skb_shinfo(pFragBuf)->frags[i];
+# if LINUX_VERSION_CODE >= KERNEL_VERSION(5, 4, 0)
+            pSG->aSegs[iSeg].cb = pFrag->bv_len;
+            pSG->aSegs[iSeg].pv = VBOX_SKB_KMAP_FRAG(pFrag) + pFrag->bv_offset;
+# else /* < KERNEL_VERSION(5, 4, 0) */
+
             pSG->aSegs[iSeg].cb = pFrag->size;
             pSG->aSegs[iSeg].pv = VBOX_SKB_KMAP_FRAG(pFrag) + pFrag->page_offset;
+# endif /* >= KERNEL_VERSION(5, 4, 0) */
             Log6((" %p", pSG->aSegs[iSeg].pv));
             pSG->aSegs[iSeg++].Phys = NIL_RTHCPHYS;
             Assert(iSeg <= pSG->cSegsAlloc);
 
Old 12-04-2019, 06:10 PM   #2
denydias
Member
 
Registered: Dec 2013
Distribution: Slackware
Posts: 299

Rep: Reputation: Disabled
Kudos to you @rahrah! For pointing out the upstream discussion, for the patch which have worked great and for bringing my dev env back on duty.

Others have pointed that VirtualBox 6.0.15 testbuild also worked with kernel 5.4.1. But to install a testbuild one need to uninstall the stable one then install the testbuild. Once the stable build is released from the testbuild, then the testbuild should also be uninstalled so the stable can be installed again. Too much hassle...

The patch you suggest does the job for VirtualBox 6.0.14 with no testbuild involved, which is a much more elegant solution IMHO.

For future reference, to apply the patch, copy de contents of the OP, save to "/opt/VirtualBox/src/vboxhost/kernel541.patch" then run:

Code:
# cd /opt/VirtualBox/src/vboxhost
# patch -p1 <kernel541.patch
# vboxconfig
Then you're done. Just open VirtualBox and run your VMs as usual.

Last edited by denydias; 12-04-2019 at 06:11 PM.
 
4 members found this post helpful.
Old 12-05-2019, 06:59 AM   #3
rahrah
Member
 
Registered: Jun 2008
Location: London, England
Distribution: Slackware
Posts: 32

Original Poster
Rep: Reputation: 51
Pleased it worked out for you!

===Rich
 
Old 12-05-2019, 10:06 AM   #4
gian_d
Member
 
Registered: Nov 2019
Location: Cagliari, Sardinia (Italy)
Distribution: Slackware
Posts: 76

Rep: Reputation: Disabled
https://www.linuxquestions.org/questions/slackware-14/virtualbox-on-kernel-5-4-x-4175665409

Thanks a lot, Rahrah!
The patch works fine with vbox 6.0.14 and kernel 5.4.1
 
1 members found this post helpful.
Old 12-05-2019, 10:10 AM   #5
Aeterna
Senior Member
 
Registered: Aug 2017
Location: Terra Mater
Distribution: VM Host: Slackware-current, VM Guests: Artix, Venom, antiX, Gentoo, FreeBSD, OpenBSD, OpenIndiana
Posts: 1,011

Rep: Reputation: Disabled
@denydias
Quote:
Others have pointed that VirtualBox 6.0.15 testbuild also worked with kernel 5.4.1. But to install a testbuild one need to uninstall the stable one then install the testbuild. Once the stable build is released from the testbuild, then the testbuild should also be uninstalled so the stable can be installed again. Too much hassle...
Nope,
just install 6.0.15 over 6.0.14. No need to uninstall first old (stable) and install next a new version (testbuild) and then when it come repead uninstall/install with new stable version.
 
1 members found this post helpful.
Old 12-05-2019, 10:47 AM   #6
aikempshall
Member
 
Registered: Nov 2003
Location: Bristol, Britain
Distribution: Slackware
Posts: 902

Rep: Reputation: 153Reputation: 153
The above patch appears to be written for the host.

I think I've got this problem on a guest.

Is their a patch readily available for the guest or do I need to hack the patch?

Alex
 
Old 12-05-2019, 11:52 AM   #7
aikempshall
Member
 
Registered: Nov 2003
Location: Bristol, Britain
Distribution: Slackware
Posts: 902

Rep: Reputation: 153Reputation: 153
I decided to download https://www.virtualbox.org/download/....15-135274.iso
  1. uninstalled 6.0.14
  2. rebooted for good measure
  3. Mounted the 6.0.15 iso
  4. ran VBoxLinuxAdditions.run
  5. rebooted for good measure

Problem fixed. Will try and remember to uninstall/install 6.0.15 when it comes out of test.
 
Old 12-05-2019, 06:30 PM   #8
denydias
Member
 
Registered: Dec 2013
Distribution: Slackware
Posts: 299

Rep: Reputation: Disabled
Quote:
Originally Posted by Aeterna View Post
Nope,
just install 6.0.15 over 6.0.14. No need to uninstall first old (stable) and install next a new version (testbuild) and then when it come repead uninstall/install with new stable version.
That's not what testbuild documentation says. Quoting:

Installing Linux test builds
Test builds for Linux hosts are generally packed up in a shell script installer with the extension ".run". To install them, you first need to remove your existing VirtualBox installation (but not your virtual machines - they will continue to work with the test build) and then execute the installer. To remove the test build again, execute the installer with the parameter "uninstall" on the command line.

Edit: btw, I tried to install 6.0.15 testcase on top of 6.0.14 stable without uninstalling it first. It doesn't worked for me tough.

Last edited by denydias; 12-05-2019 at 06:33 PM.
 
Old 12-05-2019, 08:53 PM   #9
Aeterna
Senior Member
 
Registered: Aug 2017
Location: Terra Mater
Distribution: VM Host: Slackware-current, VM Guests: Artix, Venom, antiX, Gentoo, FreeBSD, OpenBSD, OpenIndiana
Posts: 1,011

Rep: Reputation: Disabled
Quote:
Originally Posted by denydias View Post
That's not what testbuild documentation says. Quoting:

Installing Linux test builds
Test builds for Linux hosts are generally packed up in a shell script installer with the extension ".run". To install them, you first need to remove your existing VirtualBox installation (but not your virtual machines - they will continue to work with the test build) and then execute the installer. To remove the test build again, execute the installer with the parameter "uninstall" on the command line.

Edit: btw, I tried to install 6.0.15 testcase on top of 6.0.14 stable without uninstalling it first. It doesn't worked for me tough.
You are correct. Sorry. However, I only followed uninstall/install/uninstall/install routine only for RC but I never had any issues with client VM when just updating installation to test or upgrading test to official installation

Last edited by Aeterna; 12-05-2019 at 08:55 PM.
 
Old 12-06-2019, 03:09 AM   #10
aikempshall
Member
 
Registered: Nov 2003
Location: Bristol, Britain
Distribution: Slackware
Posts: 902

Rep: Reputation: 153Reputation: 153
I followed the uninstall/install route. It eventually worked for me.

On two guests the uninstall took about 20 minutes to run. When finished it appeared to have removed a lot more than what I was expecting. I got ktown installed on these failing VirtualBox hosts. I'd lost the following -
  1. in init 4 the ability to type in a password on the plasma login dialog
  2. in init 4 the ability to move the mouse on the plasma login dialog
  3. in init 3 eth0 was missing
  4. in init 3 couldn't mount a previously downloaded VBoxGuestAdditions.iso got error "can't open blockdev"
  5. in init 3 couldn't start udev because of missing modules

A sorry mess.

At this stage I thought I should try to reinstall the kernel packages by running

Code:
slackpkg reinstall kernel*
the packages to install were still in the cache. This was successful.

Rebooted and all the above problems went away, though when I booted to init 4 just got a black screen.

Booted to init 3 which now allowed me to
  1. mount the testcase VBoxGuestAdditions.iso for 6.0.15
  2. run VBoxLinuxAdditions.run

Rebooted to init 4 everything now in working order.
 
Old 12-06-2019, 02:59 PM   #11
Aeterna
Senior Member
 
Registered: Aug 2017
Location: Terra Mater
Distribution: VM Host: Slackware-current, VM Guests: Artix, Venom, antiX, Gentoo, FreeBSD, OpenBSD, OpenIndiana
Posts: 1,011

Rep: Reputation: Disabled
Quote:
Originally Posted by aikempshall View Post
I followed the uninstall/install route. It eventually worked for me.

On two guests the uninstall took about 20 minutes to run. When finished it appeared to have removed a lot more than what I was expecting. I got ktown installed on these failing VirtualBox hosts. I'd lost the following -
  1. in init 4 the ability to type in a password on the plasma login dialog
  2. in init 4 the ability to move the mouse on the plasma login dialog
  3. in init 3 eth0 was missing
  4. in init 3 couldn't mount a previously downloaded VBoxGuestAdditions.iso got error "can't open blockdev"
  5. in init 3 couldn't start udev because of missing modules

A sorry mess.

At this stage I thought I should try to reinstall the kernel packages by running

Code:
slackpkg reinstall kernel*
the packages to install were still in the cache. This was successful.

Rebooted and all the above problems went away, though when I booted to init 4 just got a black screen.

Booted to init 3 which now allowed me to
  1. mount the testcase VBoxGuestAdditions.iso for 6.0.15
  2. run VBoxLinuxAdditions.run

Rebooted to init 4 everything now in working order.
Interesting. This is what I did.
attached VBoxGuestAdditions_6.0.15-134636.iso through VM host to all VM clients (3xlinux, and Windows 8.1, BSDs either do not support VB or require different setup for the upgrade)
start VM client
mount iso
from iso run
sudo sh VBoxLinuxAdditions.run

Installer automatically removed previous version of VBoxGuestAdditions and installed new (6.0.15) version.
reboot

That is all, took 5 min without any issues.
I run VM on a 5yrs old laptop and VM host is Slackware-current, though I doubt that distro matters.

I don't know why @aikempshall have so much trouble or why @denydias could not update VM host without uninstalling previous version first (this actually seems fishy).

Unless you are running VM installation from sbo, I don't see why you would have so much problems.
 
1 members found this post helpful.
Old 12-06-2019, 08:53 PM   #12
denydias
Member
 
Registered: Dec 2013
Distribution: Slackware
Posts: 299

Rep: Reputation: Disabled
Quote:
Originally Posted by Aeterna View Post
I don't know why @aikempshall have so much trouble or why @denydias could not update VM host without uninstalling previous version first (this actually seems fishy).
What looks fishy to me is someone finding fishy other people statements about their very own experience.

Maybe, and just maybe, VirtualBox 6.0.15 is a testbuild at this moment because the varying results it produces. Also maybe, and just maybe, the definition of testbuild is something that works for you in a different way that works for others.
 
Old 12-07-2019, 01:59 AM   #13
aikempshall
Member
 
Registered: Nov 2003
Location: Bristol, Britain
Distribution: Slackware
Posts: 902

Rep: Reputation: 153Reputation: 153
Quote:
Originally Posted by Aeterna View Post
Interesting. This is what I did.
attached VBoxGuestAdditions_6.0.15-134636.iso through VM host to all VM clients (3xlinux, and Windows 8.1, BSDs either do not support VB or require different setup for the upgrade)
start VM client
mount iso
from iso run
sudo sh VBoxLinuxAdditions.run

Installer automatically removed previous version of VBoxGuestAdditions and installed new (6.0.15) version.
reboot

That is all, took 5 min without any issues.
I run VM on a 5yrs old laptop and VM host is Slackware-current, though I doubt that distro matters.

I don't know why @aikempshall have so much trouble or why @denydias could not update VM host without uninstalling previous version first (this actually seems fishy).

Unless you are running VM installation from sbo, I don't see why you would have so much problems.

For me it could have been because of one or more of these -
  1. which kernel is in use generic, huge or some other. On one of my guests I had huge and on the others I had generic.
  2. which VBoxGuestAdditions was being upgraded. Not gone back to look, but I seem to remember I might have had 6.0.1 on some guests and 6.0.14 on others

Agreed should be a short task and complete without issue. In Slackware we seem to be ahead of the crowd here - no complaints.

The post I'm sure will help people. I'd never heard of testcase VBoxGuestAdditions builds before. Certainly helped me.

Don't know how many minutes it took me on the final guest, it wasn't long.
 
Old 12-16-2019, 02:30 AM   #14
duturo1953
LQ Newbie
 
Registered: Aug 2017
Location: Miland, Italy
Distribution: Slackware64, now current
Posts: 6

Rep: Reputation: Disabled
Thumbs up virtualbox on kernel 5.4.xx

Quote:
Originally Posted by denydias View Post
Kudos to you @rahrah! For pointing out the upstream discussion, for the patch which have worked great and for bringing my dev env back on duty.

Others have pointed that VirtualBox 6.0.15 testbuild also worked with kernel 5.4.1. But to install a testbuild one need to uninstall the stable one then install the testbuild. Once the stable build is released from the testbuild, then the testbuild should also be uninstalled so the stable can be installed again. Too much hassle...

The patch you suggest does the job for VirtualBox 6.0.14 with no testbuild involved, which is a much more elegant solution IMHO.

For future reference, to apply the patch, copy de contents of the OP, save to "/opt/VirtualBox/src/vboxhost/kernel541.patch" then run:

Code:
# cd /opt/VirtualBox/src/vboxhost
# patch -p1 <kernel541.patch
# vboxconfig
Then you're done. Just open VirtualBox and run your VMs as usual.

Thank you both, rahrah and denydias: with your patch and instructions, now VirtualBox 6.0.14 play very very well for me.
 
Old 12-16-2019, 04:27 AM   #15
chrisretusn
Senior Member
 
Registered: Dec 2005
Location: Philippines
Distribution: Slackware64-current
Posts: 2,979

Rep: Reputation: 1556Reputation: 1556Reputation: 1556Reputation: 1556Reputation: 1556Reputation: 1556Reputation: 1556Reputation: 1556Reputation: 1556Reputation: 1556Reputation: 1556
Just thought I'd throw this in. I running VirtualBox Version 6.1.0 r135406 with kernel 5.4.3 no issues. This is on a Slackware64-current host and using a clean Slackware64-current guest. I previously had testing 6.0.15-135299 installed.
 
1 members found this post helpful.
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
VirtualBox broken, VirtualBox fixed; kernel 5.4.1 phalange Slackware 4 12-03-2019 08:26 AM
[SOLVED] virtualbox is installed along with virtualbox-dkms and virtualbox-ext-pack and linux-headers-generic, but error for no /dev/vboxdrv Astral Axiom Linux - Software 2 03-04-2019 08:09 PM
Issues activating virtualbox within my linux fedora 25 virtualbox on my windows device. QuantumChaos Linux - Virtualization and Cloud 5 02-21-2017 08:31 AM
Move Slackware guest from a Slackware hosted Virtualbox to Windows hosted Virtualbox? damgar Slackware 1 08-07-2012 11:28 PM
virtualbox or virtualbox ose manuleka Linux - Software 2 06-11-2009 02:56 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > Slackware

All times are GMT -5. The time now is 04:06 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration