Unable to build linux guest kernel module - kernel 6.2.x

Discussions about using Linux guests in VirtualBox.
Post Reply
nbanba
Posts: 16
Joined: 27. Feb 2023, 10:48

Unable to build linux guest kernel module - kernel 6.2.x

Post by nbanba »

Hi Linux users

Since a few days, Linux 6.2 kernel had been released
But since I upgrade a VM running a Debian GNU Linux 12 in sid version (sid = still in developpement / unstable / very close to debian 13) and I build Linux 6.2.X on it, I had some troubles after booting linux 6.2.x for building VirtualBox Linux Guest addition inside the VM

It seems there are some declaration troubles with the new version of Linux kernel:

I think the VM had sufficient ressources requirements for building Linux 6.2.1 kernel module : 16 vCPU on a big Xeon / 32GB ram / 50g free space on nvme ssd drive.
As it's enough to build the entire Linux 6.2.X kernel in 45 minutes, I suppose it would be sufficient for building Virtualbox Guest kernel module

I had the same troubles when trying to build this module under and for :
Linux 6.0.X
Linux 6.1.X
Linux 6.2.X


Here is the error found in the attached log file:

Code: Select all

  ./scripts/check-local-export /tmp/vbox.0/VBoxGuestR0LibPhysHeap.o
   { echo ; echo '/tmp/vbox.0/VBoxGuestR0LibPhysHeap.o: $(wildcard ./tools/objtool/objtool)' ; } >> /tmp/vbox.0/.VBoxGuestR0LibPhysHeap.o.cmd
  if nm /tmp/vbox.0/VBoxGuestR0LibPhysHeap.o 2>/dev/null | grep -q __ksymtab; then gcc -E -D__GENKSYMS__ -Wp,-MMD,/tmp/vbox.0/.VBoxGuestR0LibPhysHeap.o.d -nostdinc -I./arch/x86/include -I./arch/x86/include/generated  -I./include -I./arch/x86/include/uapi -I./arch/x86/include/generated/uapi -I./include/uapi -I./include/generated/uapi -include ./include/linux/compiler-version.h -include ./include/linux/kconfig.h -include ./include/linux/compiler_types.h -D__KERNEL__ -fmacro-prefix-map=./= -Wall -Wundef -Werror=strict-prototypes -Wno-trigraphs -fno-strict-aliasing -fno-common -fshort-wchar -fno-PIE -Werror=implicit-function-declaration -Werror=implicit-int -Werror=return-type -Wno-format-security -funsigned-char -std=gnu11 -mno-sse -mno-mmx -mno-sse2 -mno-3dnow -mno-avx -fcf-protection=none -m64 -falign-jumps=1 -falign-loops=1 -mno-80387 -mno-fp-ret-in-387 -mpreferred-stack-boundary=3 -mskip-rax-setup -mtune=generic -mno-red-zone -mcmodel=kernel -Wno-sign-compare -fno-asynchronous-unwind-tables -mindirect-branch=thunk-extern -mindirect-branch-register -mindirect-branch-cs-prefix -mfunction-return=thunk-extern -fno-jump-tables -fpatchable-function-entry=16,16 -fno-delete-null-pointer-checks -Wno-frame-address -Wno-format-truncation -Wno-format-overflow -Wno-address-of-packed-member -O2 -fno-allow-store-data-races -Wframe-larger-than=2048 -fstack-protector-strong -Wno-main -Wno-unused-but-set-variable -Wno-unused-const-variable -Wno-dangling-pointer -fno-stack-clash-protection -pg -mrecord-mcount -mfentry -DCC_USING_FENTRY -falign-functions=16 -Wdeclaration-after-statement -Wvla -Wno-pointer-sign -Wcast-function-type -Wno-stringop-truncation -Wno-stringop-overflow -Wno-restrict -Wno-maybe-uninitialized -Wno-array-bounds -Wno-alloc-size-larger-than -Wimplicit-fallthrough=5 -fno-strict-overflow -fno-stack-check -fconserve-stack -Werror=date-time -Werror=incompatible-pointer-types -Werror=designated-init -Wno-packed-not-aligned -g -Wno-declaration-after-statement -fno-pie -include /tmp/vbox.0//include/VBox/VBoxGuestMangling.h -fshort-wchar -I./include -I/tmp/vbox.0/ -I/tmp/vbox.0/include -I/tmp/vbox.0/r0drv/linux -D__KERNEL__ -DMODULE -DRT_WITHOUT_PRAGMA_ONCE -DRT_OS_LINUX -DIN_RING0 -DIN_RT_R0 -DIN_SUP_R0 -DVBOX -DVBOX_WITH_HGCM -DIN_MODULE -DIN_GUEST -DIN_GUEST_R0 -DRT_NO_EXPORT_SYMBOL -DVBOX_WITH_64_BITS_GUESTS -DRT_ARCH_AMD64  -DMODULE  -DKBUILD_BASENAME='"VBoxGuestR0LibPhysHeap"' -DKBUILD_MODNAME='"vboxsf"' -D__KBUILD_MODNAME=kmod_vboxsf /tmp/vbox.0/VBoxGuestR0LibPhysHeap.c | scripts/genksyms/genksyms   -r /dev/null >> /tmp/vbox.0/.VBoxGuestR0LibPhysHeap.o.cmd; fi
/tmp/vbox.0/regops.c: In function ‘vbsf_iter_lock_pages’:
/tmp/vbox.0/regops.c:2188:28: error: too few arguments to function ‘iov_iter_get_pages’
 2188 |                 cbSegRet = iov_iter_get_pages(iter, papPages, iov_iter_count(iter), cMaxPages, &offPage0);
      |                            ^~~~~~~~~~~~~~~~~~
In file included from ./include/linux/bio.h:11,
                 from ./include/linux/writeback.h:208,
                 from ./include/linux/backing-dev.h:16,
                 from /tmp/vbox.0/vfsmod.h:49,
                 from /tmp/vbox.0/regops.c:35:
./include/linux/uio.h:253:9: note: declared here
  253 | ssize_t iov_iter_get_pages(struct iov_iter *i, struct page **pages,
      |         ^~~~~~~~~~~~~~~~~~
/tmp/vbox.0/regops.c:2214:28: error: too few arguments to function ‘iov_iter_get_pages’
 2214 |                 cbSegRet = iov_iter_get_pages(iter, &papPages[cPages], iov_iter_count(iter), 1, &offPgProbe);
      |                            ^~~~~~~~~~~~~~~~~~
./include/linux/uio.h:253:9: note: declared here
  253 | ssize_t iov_iter_get_pages(struct iov_iter *i, struct page **pages,
      |         ^~~~~~~~~~~~~~~~~~
/tmp/vbox.0/regops.c:2232:40: error: too few arguments to function ‘iov_iter_get_pages’
 2232 |                             cbSegRet = iov_iter_get_pages(iter, &papPages[cPages], iov_iter_count(iter), cMaxPages, &offPgProbe);
      |                                        ^~~~~~~~~~~~~~~~~~
./include/linux/uio.h:253:9: note: declared here
  253 | ssize_t iov_iter_get_pages(struct iov_iter *i, struct page **pages,
      |         ^~~~~~~~~~~~~~~~~~
make[2]: *** [scripts/Makefile.build:252 : /tmp/vbox.0/regops.o] Erreur 1
make[2]: *** Attente des tâches non terminées....


and the final error :

Code: Select all

make[1]: *** [Makefile:2021: /tmp/vbox.0] Error 2
make: *** [/tmp/vbox.0/Makefile-footer.gmk:117: vboxsf] Error 2

About the physical host running VirtualBox hypervisor (which let me run the VM 'deb13-lab-10.lab.lan' with Linux 6.X.X kernel inside - Linux kernel 6.X.X was build inside this VM):

I'm using Virtualbox 6.1.36 on :

Code: Select all

10:11:24 nba@14RV-SERVER-243:~$ uname -a && cat /etc/*ease
Linux 14RV-SERVER-243.14rv.lan 5.10.0-16-amd64 #1 SMP Debian 5.10.127-2 (2022-07-23) x86_64 GNU/Linux
PRETTY_NAME="Debian GNU/Linux 11 (bullseye)"
NAME="Debian GNU/Linux"
VERSION_ID="11"
VERSION="11 (bullseye)"
VERSION_CODENAME=bullseye

VirtualBox Guest comes from the iso image I found on the physical host after virtualbox install in /usr/share/virtualbox/VBoxGuestAdditions.iso

Does someone already had this problem ?
Is there any solution other than rewriting VBoxGuestR0LibPhysHeap source code ?


Thanks for help

Kind regards
nbanba
Attachments
vboxadd-setup-20230227.log
(62.96 KiB) Downloaded 3 times
fth0
Volunteer
Posts: 5668
Joined: 14. Feb 2019, 03:06
Primary OS: Mac OS X other
VBox Version: PUEL
Guest OSses: Linux, Windows 10, ...
Location: Germany

Re: Unable to build linux guest kernel module - kernel 6.2.x

Post by fth0 »

Summary from the VirtualBox Changelog:

Linux kernel 6.2 is only supported by VirtualBox 7.0.6 and newer.
Linux kernel 6.1 is only supported by VirtualBox 7.0.2 and newer.
Linux kernel 6.1 and 6.2 are only supported by VirtualBox 6.1.42 and newer.
Linux kernel 6.0 is only supported by VirtualBox 6.1.38 and newer.
nbanba
Posts: 16
Joined: 27. Feb 2023, 10:48

Re: Unable to build linux guest kernel module - kernel 6.2.x

Post by nbanba »

Thanks for answer
I cannot find some hot patches
It seems that I will have no other choice than upgrading VirtualBox on the physical host.
Is the upgrade safe ?
Should I try the upgrade on a test machine before upgrading this production node ?
Kind regards
nbanba
scottgus1
Site Moderator
Posts: 20965
Joined: 30. Dec 2009, 20:14
Primary OS: MS Windows 10
VBox Version: PUEL
Guest OSses: Windows, Linux

Re: Unable to build linux guest kernel module - kernel 6.2.x

Post by scottgus1 »

7.0 is still in bug hunt phase.
nbanba wrote:Should I try the upgrade on a test machine before upgrading this production node ?
Absolutely. Never trust new software on production hosts until it's been tested. And take good host backups.
fth0
Volunteer
Posts: 5668
Joined: 14. Feb 2019, 03:06
Primary OS: Mac OS X other
VBox Version: PUEL
Guest OSses: Linux, Windows 10, ...
Location: Germany

Re: Unable to build linux guest kernel module - kernel 6.2.x

Post by fth0 »

Since you're coming from 6.1.36, I'd suggest to try 6.1.42.
nbanba
Posts: 16
Joined: 27. Feb 2023, 10:48

Re: Unable to build linux guest kernel module - kernel 6.2.x

Post by nbanba »

Hi

Thanks, I will try that first (upgrade to 6.1.41)

Kind regards
nbanba
nbanba
Posts: 16
Joined: 27. Feb 2023, 10:48

Re: Unable to build linux guest kernel module - kernel 6.2.x

Post by nbanba »

Hello

Sorry for the mistake in writing, I will test 6.1.42 and not 6.1.41...

As strange as it could appears, 6.1.42 Guest Additions is working with Linux Kernel 6.2.x on a Virtualbox 6.1.36 install, I explane

I was a bit afraid when I realize I would have to upgrade virtualbox on the physical layer out of the standard patching process
So I did try to just install 6.1.42 guest tools (after a proper uninstall of 6.1.36 guest tools ) inside the LinuxVM which have kernel 6.2.1 and which is running under Virtualbox 6.1.36.

After a reboot of the linux 6.2.1 kernel VM with 6.1.42 Guest Additions inside, everything seems to be and to work fine (video driver is OK and loaded by linux kernel 6.2.1)

The only error I have is :

Code: Select all

[mar. 28 févr. 10:13:32 2023] process 'VBoxClient' launched '/opt/VBoxGuestAdditions-6.1.42/bin/VBoxDRMClient' with NULL argv: empty string added
[mar. 28 févr. 10:13:32 2023] [drm:vmw_msg_ioctl [vmwgfx]] *ERROR* Failed to open channel.
[mar. 28 févr. 10:13:32 2023] [drm:vmw_msg_ioctl [vmwgfx]] *ERROR* Failed to open channel.
[mar. 28 févr. 10:13:32 2023] [drm:vmw_msg_ioctl [vmwgfx]] *ERROR* Failed to open channel.
[mar. 28 févr. 10:13:32 2023] [drm:vmw_msg_ioctl [vmwgfx]] *ERROR* Failed to open channel.
[mar. 28 févr. 10:13:33 2023] [drm:vmw_msg_ioctl [vmwgfx]] *ERROR* Failed to open channel.
[mar. 28 févr. 10:13:33 2023] [drm:vmw_msg_ioctl [vmwgfx]] *ERROR* Failed to open channel.

But having a look a on a VM running Linux kernel 5.10.149-2 and running Virtualbox Guest additions 6.1.36, I have the exact same error (and no version mismatch between the running VM and the underlying hardware system running Virtualbox 6.1.36 hypervisor), so I think maybe the error may be related to another issue

Code: Select all

[mar. févr. 28 09:24:08 2023] process 'VBoxClient' launched '/opt/VBoxGuestAdditions-6.1.36/bin/VBoxDRMClient' with NULL argv: empty string added
[mar. févr. 28 09:24:08 2023] [drm:vmw_msg_ioctl [vmwgfx]] *ERROR* Failed to open channel.
[mar. févr. 28 09:24:08 2023] [drm:vmw_msg_ioctl [vmwgfx]] *ERROR* Failed to open channel.
[mar. févr. 28 09:24:08 2023] [drm:vmw_msg_ioctl [vmwgfx]] *ERROR* Failed to open channel.
[mar. févr. 28 09:24:08 2023] [drm:vmw_msg_ioctl [vmwgfx]] *ERROR* Failed to open channel.
[mar. févr. 28 09:24:08 2023] [drm:vmw_msg_ioctl [vmwgfx]] *ERROR* Failed to open channel.
[mar. févr. 28 09:24:08 2023] [drm:vmw_msg_ioctl [vmwgfx]] *ERROR* Failed to open channel.

I'm not sure this workarround is safe but it does not require to upgrade the hypervisor of the physical layer


Kind regards
nbanba
fth0
Volunteer
Posts: 5668
Joined: 14. Feb 2019, 03:06
Primary OS: Mac OS X other
VBox Version: PUEL
Guest OSses: Linux, Windows 10, ...
Location: Germany

Re: Unable to build linux guest kernel module - kernel 6.2.x

Post by fth0 »

If it works, it's probably ok. For the background rationale:

During the installation of the VirtualBox application on a Linux host, VirtualBox kernel drivers get built on the host, so the VirtualBox application must support the Linux kernel on the host.

During the installation of the VirtualBox Guest Additions in a Linux guest, VirtualBox Guest Additions kernel drivers get built in the guest, so the VirtualBox Guest Additions must support the Linux kernel in the guest.
nbanba
Posts: 16
Joined: 27. Feb 2023, 10:48

Re: Unable to build linux guest kernel module - kernel 6.2.x

Post by nbanba »

Hello

@fth0:
Thanks for answer, that was what I thought.
After a few days, it's stable and working fine with Linux 6.2.1 kernel on the VM and guest tools from virtualbox 6.1.42

Only have some troubles with nested virtualisation (when installing virtualbox 7.0.6 inside the VM running on virtualbox 6.1.36 with guest tools in version 6.1.42 when trying to launch a copy of this running VM inside), but it may probably due to others factors.

Thanks
Kind regards
nbanba
Post Reply