2

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 update
Sudo apt upgrade
sudo 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/cdrom
sudo mount /dev/cdrom /mnt/cdrom
cd /mnt/cdrom
sudo ./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-gen
eric/build M=/tmp/vbox.0 SRCROOT=/tmp/vbox.0 -j4 modules
make[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/inclu
de -I./arch/x86/include/generated  -I./include -I./arch/x86/include/uapi -I./ar
ch/x86/include/generated/uapi -I./include/uapi -I./include/generated/uapi -incl
ude ./include/linux/compiler-version.h -include ./include/linux/kconfig.h -I./u
buntu/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=retu
rn-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/tmp
p/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 found
make[2]: *** [scripts/Makefile.build:251: /tmp/vbox.0/VBoxGuest-common.o] Error 127
make[1]: *** [Makefile:2037: /tmp/vbox.0] Error 2
make: *** [/tmp/vbox.0/Makefile-footer.gmk:133: vboxguest] Error 2

What did I do wrong and how to fix it?

Tms91
  • 365

2 Answers2

1
apt install gcc-12

this should solve the issue, by default 22.04 has gcc-11 and Vbox tools need gcc-12 to compile.

sail ho
  • 11
0

Update the guest additions and extension pack:

Start the VirtualBox Manager application.

Alternative 01: Install guest additions and extension pack:

Update extension pack: From the munubar of the VirtualBox Manager app, select: File > Check for Updates... .

Update guest additions: Start a virtual machine, and from the menubar select, Devices > Upgrade Guest Additions... and your guest additions will be upgraded, then you can mount the ISO image and proceed with installation.

(Alternative 02: If updating from GUI does not work, you can try with CLI. On command line use: sudo apt-get install virtualbox-guest-additions-iso and sudo apt-get install virtualbox-ext-pack .)

To install guest additions, click on "Devices" > "Insert Guest Additions CD Image..." . Then start a file browser e.g. Nautilus (in Ubuntu), Thunar (in Xubuntu). Here, in the side pane, you will see a new CD image been mounted. Click to go into the folder. Now right click and select to open a terminal in this directory. Then you should run the VBoxLinuxAdditions.run script with sudo privilege, as: sudo ./VBoxLinuxAdditions.run . This will install the guest additions.

Next you'll have to log out and back in. Then you can start VirtualBox machines.

UPDATE 01: Alternative 03: Source: 4.2.1.2. Updating the Windows Guest Additions

Windows Guest Additions can be updated by running the installation program again. This replaces the previous Additions drivers with updated versions.

rusty
  • 16,327