Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!

Bug 641950

Summary: app-emulation/virtualbox-modules with kernel-4.14* vboxpci: Unknown symbol vfs_write (err 0)
Product: Gentoo Linux Reporter: urcindalo <urcindalo>
Component: Current packagesAssignee: Lars Wendler (Polynomial-C) (RETIRED) <polynomial-c>
Status: RESOLVED FIXED    
Severity: normal CC: chris, dimgel, masterzorag, raistlin
Priority: Normal    
Version: unspecified   
Hardware: All   
OS: Linux   
Whiteboard:
Package list:
Runtime testing required: ---
Attachments: uses kernel_write instead of vfs_write

Description urcindalo 2017-12-21 16:28:42 UTC
Since the recent stabilization of gentoo-sources-4.17, I get an error when loading the virtualbox module vboxpci at boot time on two different boxes:

===
-- Subject: Unit systemd-modules-load.service has begun start-up
-- Defined-By: systemd
-- Support: https://lists.freedesktop.org/mailman/listinfo/systemd-devel
-- 
-- Unit systemd-modules-load.service has begun starting up.
dic 21 09:56:03 Urci kernel: vboxpci: Unknown symbol vfs_write (err 0)
dic 21 09:56:03 Urci systemd-modules-load[1389]: Failed to insert 'vboxpci': No such file or directory
dic 21 09:56:03 Urci systemd[1]: systemd-modules-load.service: Main process exited, code=exited, status=1/FAILURE
dic 21 09:56:03 Urci systemd[1]: Failed to start Load Kernel Modules.                                                                                
-- Subject: Unit systemd-modules-load.service has failed                                                                                             
-- Defined-By: systemd                                                                                                                               
-- Support: https://lists.freedesktop.org/mailman/listinfo/systemd-devel                                                                             
-- 
-- Unit systemd-modules-load.service has failed.
-- 
-- The result is failed.
===

Apparently, it is a failure with kernel version 4-17*:
https://github.com/manjaro/packages-core/issues/86
Comment 1 Mike Gilbert gentoo-dev 2017-12-21 16:50:23 UTC
Did you rebuild app-emulation/virtualbox-modules after upgrading to the new kernel?
Comment 2 urcindalo 2017-12-21 17:23:06 UTC
(In reply to Mike Gilbert from comment #1)
> Did you rebuild app-emulation/virtualbox-modules after upgrading to the new
> kernel?

Yep, several times. In fact, I always perform an "emerge -1 @module-rebuild" whenever I update the kernel.
Comment 3 Mike Gilbert gentoo-dev 2017-12-21 17:52:08 UTC
What version of virtualbox-modules do you have installed?
Comment 4 CFuga 2017-12-21 18:58:53 UTC
I'm using the current stable version, app-emulation/virtualbox-modules-5.1.26, and I also found the same error when loading the module.

I patched 5.1.26 with virtualbox-modules-5.1.30-udp.patch to 5.1.26, already present in tree, and it works.

In order to fix this bug, either apply the referred patch to the 5.1.26 version or make stable the version 5.1.30.
Comment 5 urcindalo 2017-12-21 22:22:22 UTC
I run a Windows 10 guest in VirtualBox. Here you are my results:

* Current stable virtualbox-5.1.26 & previous stable kernel-4.12.12 just works: systemd-modules-load.service loads OK *and* the guest OS runs well.

* The combo virtualbox-5.1.26/kernel-4.14* is not able to load systemd-modules-load.service AND the guest OS freezes my Gentoo host when running, to the point of having to press the hardware reset key.

* virtualbox-5.1.30 allows for modules-load.service to be loaded with any kernel version (4.12.12 or 4.14*), but it makes the guest OS to freeze my box when running (like before).

* The virtualbox-5.2*/kernel-4.14* combo prevents modules-load.service from loading and it also makes the the guest OS to freeze my box when running (like before).
Comment 6 urcindalo 2017-12-21 23:09:40 UTC
(In reply to urcindalo from comment #5)
> I run a Windows 10 guest in VirtualBox. Here you are my results:
> 
> * Current stable virtualbox-5.1.26 & previous stable kernel-4.12.12 just
> works: systemd-modules-load.service loads OK *and* the guest OS runs well.
> 
> * The combo virtualbox-5.1.26/kernel-4.14* is not able to load
> systemd-modules-load.service AND the guest OS freezes my Gentoo host when
> running, to the point of having to press the hardware reset key.
> 
> * virtualbox-5.1.30 allows for modules-load.service to be loaded with any
> kernel version (4.12.12 or 4.14*), but it makes the guest OS to freeze my
> box when running (like before).
> 
> * The virtualbox-5.2*/kernel-4.14* combo prevents modules-load.service from
> loading and it also makes the the guest OS to freeze my box when running
> (like before).

Update:
after reverting back to virtualbox-5.1.26 from virtualbox-5.1.30 (with kernel-4.12.12) everything works again: Windows 10 as guest OS runs OK *even though* it still has the 5.1.30 guess additions installed. Keyboard/mouse integration and shared folders work.
Comment 7 Sergio 2017-12-23 09:44:47 UTC
Take a look here: https://www.linuxquestions.org/questions/slackware-14/virtualbox-kernel-module-no-longer-builds-under-current-kernel-update-of-17-nov-2017-a-4175617829/
There's a patch, more complex than needed, as they say.

The relevant part should be simply:

--- a/vboxpci/linux/VBoxPci-linux.c	2017-10-27 15:43:49.927830000 -0400
+++ b/vboxpci/linux/VBoxPci-linux.c	2017-10-28 08:23:54.946946774 -0400
@@ -357,7 +357,7 @@ static int vboxPciFileWrite(struct file*
 
     fs_save = get_fs();
     set_fs(get_ds());
-    ret = vfs_write(file, data, size, &offset);
+    ret = kernel_write(file, data, size, &offset);
     set_fs(fs_save);
     if (ret < 0)
printk(KERN_DEBUG "vboxPciFileWrite: error %d\n", ret);

Regards,
HUjuice
Comment 8 Dmitry Grigoriev 2017-12-24 21:40:33 UTC
I confirm on amd64. Brief googling found that virtualbox-5.1 might not compile with kernel 4.14, and that was fixed in virtualbox-5.2: https://www.virtualbox.org/ticket/17267. Didn't try, but if it's true then virtualbox-5.2 should be unmasked, because current stable 5.1 won't compile nor properly work with current stable kernel 4.14.8-r1.
Comment 9 Christophe PEREZ 2017-12-25 16:18:06 UTC
(In reply to Sergio from comment #7)
> The relevant part should be simply:
> 
> --- a/vboxpci/linux/VBoxPci-linux.c	2017-10-27 15:43:49.927830000 -0400
> +++ b/vboxpci/linux/VBoxPci-linux.c	2017-10-28 08:23:54.946946774 -0400
> @@ -357,7 +357,7 @@ static int vboxPciFileWrite(struct file*
>  
>      fs_save = get_fs();
>      set_fs(get_ds());
> -    ret = vfs_write(file, data, size, &offset);
> +    ret = kernel_write(file, data, size, &offset);
>      set_fs(fs_save);
>      if (ret < 0)
> printk(KERN_DEBUG "vboxPciFileWrite: error %d\n", ret);

I can confirm that vboxpci loads with this patch.
Comment 10 Pablo Yanez Trujillo 2017-12-26 01:35:53 UTC
I can confirm that as well. Currently running 4.14.8-gentoo-r1, when rebuilding =virtualbox-modules-5.1.26 depmod complains about missing symbols and dmesg shows

[29702.656778] vboxpci: Unknown symbol vfs_write (err 0)

After applying the patch (through /etc/portage/patches/app-emulation/virtualbox-modules-5.1.26) depmode didn't complain and the module could be loaded. The strange thing is that even with an unloaded vboxpci module, VirtualBox would run and my guests seemed to run fine as well.
Comment 11 Pablo Yanez Trujillo 2017-12-26 01:36:46 UTC
Created attachment 511618 [details, diff]
uses kernel_write instead of vfs_write
Comment 12 Stefano 2017-12-27 13:00:40 UTC
(In reply to Pablo Yanez Trujillo from comment #10)
> I can confirm that as well. Currently running 4.14.8-gentoo-r1, when

Same here, even at compile time:
DEPMOD  4.14.8-gentoo-r1
depmod: WARNING: /lib/modules/4.14.8-gentoo-r1/misc/vboxpci.ko needs unknown symbol vfs_write
Comment 13 Lars Wendler (Polynomial-C) (RETIRED) gentoo-dev 2018-02-16 13:13:09 UTC
commit 7ff37f8ec285b82d5de3b3e3fec4d5aa76f4bc1e
Author: Lars Wendler <polynomial-c@gentoo.org>
Date:   Wed Jan 17 14:37:35 2018

    app-emulation/virtualbox-modules: Re-added accidentally dropped patch.

    Package-Manager: Portage-2.3.19, Repoman-2.3.6