Recently my Ubuntu22.04 VM had problems so I decided to delete it and install a new one.
Before of this, I uninstalled Virtualbox and installed a newer version.
After uninstall, I have manually deleted all the files left in the folder C:/Programs/Oracle/Virtualbox
I have rebooted my PC after Virtualbox installation.
The I have installed Ubuntu 22.04 from a iso which worked fine for the previous VM.
Now, I do the following to install the guest additions (as indicated here. I have made this hundreds of time, it is correct):
sudo apt updateSudo apt upgradesudo apt install -y build-essential linux-headers-$(uname -r)sudo reboot
From the VirtualBox Device menu -> Click Insert guest additions CD
sudo mkdir -p /mnt/cdromsudo mount /dev/cdrom /mnt/cdromcd /mnt/cdromsudo ./VBoxLinuxAdditions.run
here I get struck as in the terminal the following warning message is raised
currently loaded virtualbox guest additions does not match installation version (7.0.8 R156879)
in /var/log/vboxadd-setup.log
:
Building the main Guest Additions 7.0.8 module for kernel 6.5.0-14-generic.Error building the module. Build output follows.make V=1 CONFIG_MODULE_SIG= CONFIG_MODULE_SIG_ALL= -C /lib/modules/6.5.0-14-generic/build M=/tmp/vbox.0 SRCROOT=/tmp/vbox.0 -j4 modulesmake[1]: warning: -j4 forced in submake: resetting jobserver mode.warning: the compiler differs from the one used to build the kernel The kernel was built by: x86_64-linux-gnu-gcc-12 (Ubuntu 12.3.0-1ubuntu1~22.04) 12.3.0 You are using: make -f ./scripts/Makefile.build obj=/tmp/vbox.0 need-builtin=1 need-modorder=1 # cmd_mod /tmp/vbox.0/vboxguest.mod printf '%s' VBoxGuest-linux.o VBoxGuest-common.o common/string/strformatrt.o combined-agnostic.o combined-os-specific.o | awk '!x[$0]++ { print("/tmp/vbox.0/"$0) }'> /tmp/vbox.0/vboxguest.mod# CC [M] /tmp/vbox.0/VBoxGuest-linux.o gcc-12 -Wp,-MMD,/tmp/vbox.0/.VBoxGuest-linux.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 -I./ubuntu/include -include ./include/linux/compiler_types.h -D__KERNEL__ -std=gnu11 -fshort-wchar -funsigned-char -fno-common -fno-PIE -fno-strict-aliasing -Wall -Wundef -Werror=implicit-function-declaration -Werror=implicit-int -Werror=return-type -Werror=strict-prototypes -Wno-format-security -Wno-trigraphs -mno-sse -mno-mmx -mno-sse2 -mno-3dnow -mno-avx -m64 -mno-80387 -mtune=generic -mno-red-zone -mcmodel=kernel -Wno-sign-compare -fno-asynchronous-unwind-tables -mfunction-return=thunk-extern -fno-jump-tables -mharden-sls=all -fpatchable-function-entry=16,16 -fno-delete-null-pointer-checks -O2 -Wframe-larger-than=1024 -fstack-protector-strong -Wno-main -fno-omit-frame-pointer -fno-optimize-sibling-calls -ftrivial-auto-var-init=zero -fzero-call-used-regs=used-gpr -pg -mrecord-mcount -falign-functions=16 -Wvla -Wno-pointer-sign -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 -g -gdwarf-5 -include /tmp/vbox.0/include/VBox/VBoxGuestMangling.h -I./include -I/tmp/vbox.0/ -I/tmpp/vbox.0/include -I/tmp/vbox.0/r0drv/linux -D__KERNEL__ -DMODULE -DRT_WITHOUT_PRAGMA_ONCE -DVBOX -DRT_OS_LINUX -DIN_RING0 -DIN_RT_R0 -DIN_GUEST -DIN_GUEST_R0 -DIN_MODULE -DRT_WITH_VBOX -DVBGL_VBOXGUEST -DVBOX_WITH_HGCM -DVBOX_WITH_64_BITS_GUESTS -DRT_ARCH_AMD64 -fsanitize=bounds-strict -fsanitize=shift -fsanitize=bool -fsanitize=enum -DMODULE -DKBUILD_BASENAME='"VBoxGuest_common"' -DKBUILD_MODNAME='"vboxguest"' -D__KBUILD_MODNAME=kmod_vboxguest -c -o /tmp/vbox.0/VBoxGuest-common.o /tmp/vbox.0/VBoxGuest-common.c ; ./tools/objtool/objtool --hacks=jump_label --hacks=noinstr --hacks=skylake --retpoline --rethunk --sls --stackval --static-call --uaccess --prefix=16 --module /tmp/vbox.0/VBoxGuest-common.o/bin/sh: 1: gcc-12: not foundmake[2]: *** [scripts/Makefile.build:251: /tmp/vbox.0/VBoxGuest-common.o] Error 127make[1]: *** [Makefile:2037: /tmp/vbox.0] Error 2make: *** [/tmp/vbox.0/Makefile-footer.gmk:133: vboxguest] Error 2
What did I do wrong and how to fix it?