VirtualBox 7 fails on installation process at Ubuntu Desktop 22.04

For Ubuntu Desktop 22.04 to install VirtualBox 7 was executed the following command:

sudo apt install ./virtualbox-7.0_7.0.14-161095~Ubuntu~jammy_amd64.deb

But it fails with the following error message

...
Unpacking manpages-dev (5.10-1ubuntu1) ...
Setting up manpages-dev (5.10-1ubuntu1) ...
Setting up libqt5x11extras5:amd64 (5.15.3-1) ...
Setting up binutils-common:amd64 (2.38-4ubuntu2.6) ...
Setting up linux-libc-dev:amd64 (5.15.0-101.111) ...
Setting up libctf-nobfd0:amd64 (2.38-4ubuntu2.6) ...
Setting up libasan6:amd64 (11.4.0-1ubuntu1~22.04) ...
Setting up libqt5sql5:amd64 (5.15.3+dfsg-2ubuntu0.2) ...
Setting up libqt5printsupport5:amd64 (5.15.3+dfsg-2ubuntu0.2) ...
Setting up libqt5xml5:amd64 (5.15.3+dfsg-2ubuntu0.2) ...
Setting up libtirpc-dev:amd64 (1.3.2-2ubuntu0.1) ...
Setting up rpcsvc-proto (1.4.2-0ubuntu6) ...
Setting up make (4.3-4.1build1) ...
Setting up libquadmath0:amd64 (12.3.0-1ubuntu1~22.04) ...
Setting up libsdl1.2debian:amd64 (1.2.15+dfsg2-6) ...
Setting up libubsan1:amd64 (12.3.0-1ubuntu1~22.04) ...
Setting up libqt5opengl5:amd64 (5.15.3+dfsg-2ubuntu0.2) ...
Setting up libnsl-dev:amd64 (1.3.0-2build2) ...
Setting up libcrypt-dev:amd64 (1:4.4.27-1) ...
Setting up libsdl-ttf2.0-0:amd64 (2.0.11-6) ...
Setting up libbinutils:amd64 (2.38-4ubuntu2.6) ...
Setting up libc-dev-bin (2.35-0ubuntu3.6) ...
Setting up libcc1-0:amd64 (12.3.0-1ubuntu1~22.04) ...
Setting up liblsan0:amd64 (12.3.0-1ubuntu1~22.04) ...
Setting up libitm1:amd64 (12.3.0-1ubuntu1~22.04) ...
Setting up libc-devtools (2.35-0ubuntu3.6) ...
Setting up libtsan0:amd64 (11.4.0-1ubuntu1~22.04) ...
Setting up libctf0:amd64 (2.38-4ubuntu2.6) ...
Setting up libqt5sql5-sqlite:amd64 (5.15.3+dfsg-2ubuntu0.2) ...
Setting up libqt5help5:amd64 (5.15.3-1) ...
Setting up libgcc-11-dev:amd64 (11.4.0-1ubuntu1~22.04) ...
Setting up virtualbox-7.0 (7.0.14-161095~Ubuntu~jammy) ...
Adding group `vboxusers' (GID 137) ...
Done.
vboxdrv.sh: failed: Look at /var/log/vbox-setup.log to find out what went wrong.

There were problems setting up VirtualBox.  To re-start the set-up process, run
  /sbin/vboxconfig
as root.  If your system is using EFI Secure Boot you may need to sign the
kernel modules (vboxdrv, vboxnetflt, vboxnetadp, vboxpci) before you can load
them. Please see your Linux system's documentation for more information.
Setting up libc6-dev:amd64 (2.35-0ubuntu3.6) ...
Setting up binutils-x86-64-linux-gnu (2.38-4ubuntu2.6) ...
Setting up binutils (2.38-4ubuntu2.6) ...
Setting up gcc-11 (11.4.0-1ubuntu1~22.04) ...
Setting up gcc (4:11.2.0-1ubuntu1) ...
Processing triggers for mailcap (3.70+nmu1ubuntu1) ...
Processing triggers for desktop-file-utils (0.26-1ubuntu3) ...
Processing triggers for hicolor-icon-theme (0.17-2) ...
Processing triggers for gnome-menus (3.36.0-1ubuntu3) ...
Processing triggers for libc-bin (2.35-0ubuntu3.6) ...
Processing triggers for man-db (2.10.2-1) ...
Processing triggers for shared-mime-info (2.1-2) ...
N: Download is performed unsandboxed as root as file '/home/manueljordan/deb/virtualbox-7.0_7.0.14-161095~Ubuntu~jammy_amd64.deb' couldn't be accessed by user '_apt'. - pkgAcquire::Run (13: Permission denied)

The content of the /var/log/vbox-setup.log file is:

Building the main VirtualBox module.
Error building the module:
make V=1 CONFIG_MODULE_SIG= CONFIG_MODULE_SIG_ALL= -C /lib/modules/6.5.0-26-generic/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/vboxdrv.mod
  printf '%s
'   linux/SUPDrv-linux.o SUPDrv.o SUPDrvGip.o SUPDrvSem.o SUPDrvTracer.o SUPLibAll.o common/string/strformatrt.o combined-agnostic1.o combined-agnostic2.o combined-os-specific.o | awk '!x[$0]++ { print("/tmp/vbox.0/"$0) }' > /tmp/vbox.0/vboxdrv.mod
# CC [M]  /tmp/vbox.0/linux/SUPDrv-linux.o
  gcc-12 -Wp,-MMD,/tmp/vbox.0/linux/.SUPDrv-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/SUPDrvMangling.h -fno-omit-frame-pointer -fno-pie -Wno-declaration-after-statement -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 -DRT_WITH_VBOX -DVBOX_WITH_HARDENING -DSUPDRV_WITH_RELEASE_LOGGER -DVBOX_WITHOUT_EFLAGS_AC_SET_IN_VBOXDRV -DIPRT_WITHOUT_EFLAGS_AC_PRESERVING -DVBOX_WITH_64_BITS_GUESTS -DCONFIG_VBOXDRV_AS_MISC -DRT_ARCH_AMD64  -fsanitize=bounds-strict -fsanitize=shift -fsanitize=bool -fsanitize=enum  -DMODULE  -DKBUILD_BASENAME='"SUPDrv_linux"' -DKBUILD_MODNAME='"vboxdrv"' -D__KBUILD_MODNAME=kmod_vboxdrv -c -o /tmp/vbox.0/linux/SUPDrv-linux.o /tmp/vbox.0/linux/SUPDrv-linux.c   ; ./tools/objtool/objtool --hacks=jump_label --hacks=noinstr --hacks=skylake --retpoline --rethunk --sls --stackval --static-call --uaccess --prefix=16   --module /tmp/vbox.0/linux/SUPDrv-linux.o
/bin/sh: 1: gcc-12: not found
make[2]: *** [scripts/Makefile.build:251: /tmp/vbox.0/linux/SUPDrv-linux.o] Error 127
make[1]: *** [Makefile:2039: /tmp/vbox.0] Error 2
make: *** [/tmp/vbox.0/Makefile-footer.gmk:133: vboxdrv] Error 2

How to fix this situation?

It is compiling kernel modules and it needs gcc-12
I dont know why gcc-12 is not there… it should be unless you chose some install option that excluded the build tools?

Check back over what you set during the install. That is the
only fix I can think of. It is unlikely the Ubuntu iso has a fault… they are checked before release.

2 Likes

I’ve gotten that error more than once when trying to install from a downloaded deb file. Mostly the application works anyway for me. I guess it didn’t in your case.

1 Like

Oh, I thought it was a full install from an iso. My mistake.
That explains it. Things are missing, probably the build-tools package.

1 Like

Thanks to all for the reply.

I’ve gotten that error more than once when trying to install from a downloaded deb file. Mostly the application works anyway for me. I guess it didn’t in your case.

I’ve installed few software through .deb files, such as MySQL, Opera, Chrome and even VirtualBox 6 but just first time in life I got this specific situation.

Now to be honest in other Ubuntu Desktop 22.04 instance was installed successfully, but it through a VirtualBox guest. I mean

macOS (Host) -> Ubuntu Desktop 22.04 (Guest) -> installed VirtualBox 7

But here was through a direct installation

Ubuntu Desktop 22.04 (Host) -> installed VirtualBox 7 (Error)

I dont know why gcc-12 is not there…
it should be unless you chose some install option that excluded the build tools?

Normal and same steps, as I did in other Guests and direct installations, about how was installed Ubuntu. I am wondered why appeared here this case too.

Things are missing, probably the build-tools package

With what command would be installed that package?

Thanks to all

probably “build-essential”

i.e.
sudo apt install build-essential

I usually install virtualbox from the provided Ubuntu repository source - not downloaded…

This is how I installed it on my Pop!_OS 22.04 (basically Ubuntu 22.04) :

sudo apt install virtualbox virtualbox-ext-pack virtualbox-guest-additions-iso

Unless you’re running an older Ubuntu release and wanted a newer version? It’s version 7.x in Ubuntu 22 / Pop! 22 :


OK - just noticed - you wrote you’re doing this on Ubuntu 22.04.

Why are you installing a downloaded DEB file when it’s in the default Ubuntu 22.04 repos?

1 Like

Good question. That is a recipe for disaster.

Thanks again for the reply

It’s version 7.x in Ubuntu 22 / Pop! 22 :

According with your Figure you have the version 7.0.10 and I want try to install the 7.0.14, so there is a clear difference and I am sure many bugs fixed and improvements added.

Why are you installing a downloaded DEB file when it’s in the default Ubuntu 22.04 repos?

Even if this Ubuntu is based on 22.04 not always is available on the repository the latest release. Quick example Remmina. Same for MySQL. So I work with .deb file

Furthermore I avoid use snap store because it is slow. For this reason, was uninstalled Opera and was re-installed through a .deb file.

Good question. That is a recipe for disaster.

To be honest many months ago the unique situation I had with a .deb file was about some missing dependencies, but resolved, if my memory does not fail me, through some f option it for dpkg/apt command to resolve the missing dependencies and continue with the installation process.

It seems the solution is the sudo apt install build-essential command. I am going to test it.

1 Like

That’s a minor release version…

I’m sure there were VERY few bugs fixed between those releases… it works perfectly fine for me with 7.0.10 I have ~20 VMs (I don’t run them all at the same time).

Windows XP
Windows 10
Windows 11
Windows server 2019
3 x Centos
6 x RHEL (7,8 and 9)
Ubuntu 23
Pop!
gentoo
amazon Linux
Kali Linux

If you’re shy of SNAPS - maybe you’re using the wrong OS? I’m not crazy about them myself, but it’s what you get with Ubuntu and downstream distros like Pop!_OS - so I grin and bear it. Neither Brave, or Chrome are snaps…

From what I can see 12 bug fixes between 7.0.10 and .14 - that’s not very many and a lot of them are “edge” cases - like are you going to emulate an ISA SCSI HBA? Unlikely. Are you going to use nested virtualization (e.g. run VMware ESX “server” as a VM in virtualbox)? Have a clash between HyperV and VirtualBox hypervisors? Unlikely if your host is Linux…

None of those bugs are reason enough for me to go outside the default repositories - I’ll always go with the default repos on Ubuntu and try and avoid at all costs installing PPA - it’s a recipe for breaking things… And this is why it’s asking you to install packages so that it can build kernel modules - if you install from the Ubuntu repo it shouldn’t need to do that (it didn’t for me on Pop!_OS).

1 Like

Try this if you cant stand snaps

2 Likes

I love that.
Leave package systems alone… they have enough of their own problems, without introducing outsiders.

2 Likes

Thanks again for your replies.

About snap I use it for other software, such as: draw.io … and well it works fine. But in general snap is slow. I read the same thought in other networks.

Just being curious, if the .deb is theoretically a bad practice why is so far available yet?

And well, if I can get the latest release of a tool, well I take it. Remember that practically I’ve never had before any serious problem to install a tool through .deb. And their respective upgrades through the apt commands always worked. So, so far for me it is a viable approach to install software in “peace”.

Executing the sudo apt install build-essential command as suggested happens

sudo apt install build-essential
Reading package lists... Done
Building dependency tree... Done
Reading state information... Done
The following additional packages will be installed:
  dpkg-dev fakeroot g++ g++-11 libalgorithm-diff-perl libalgorithm-diff-xs-perl libalgorithm-merge-perl libdpkg-perl libfakeroot
  libfile-fcntllock-perl libstdc++-11-dev lto-disabled-list
Suggested packages:
  debian-keyring g++-multilib g++-11-multilib gcc-11-doc bzr libstdc++-11-doc
The following NEW packages will be installed:
  build-essential dpkg-dev fakeroot g++ g++-11 libalgorithm-diff-perl libalgorithm-diff-xs-perl libalgorithm-merge-perl libdpkg-perl
  libfakeroot libfile-fcntllock-perl libstdc++-11-dev lto-disabled-list
0 upgraded, 13 newly installed, 0 to remove and 0 not upgraded.
Need to get 14.9 MB of archives.
After this operation, 54.6 MB of additional disk space will be used.
Do you want to continue? [Y/n] 
Do you want to continue? [Y/n] y
Get:1 http://pe.archive.ubuntu.com/ubuntu jammy-updates/main amd64 libstdc++-11-dev amd64 11.4.0-1ubuntu1~22.04 [2,101 kB]
Get:2 http://pe.archive.ubuntu.com/ubuntu jammy-updates/main amd64 g++-11 amd64 11.4.0-1ubuntu1~22.04 [11.4 MB]                                
Get:3 http://pe.archive.ubuntu.com/ubuntu jammy/main amd64 g++ amd64 4:11.2.0-1ubuntu1 [1,412 B]                                               
Get:4 http://pe.archive.ubuntu.com/ubuntu jammy-updates/main amd64 libdpkg-perl all 1.21.1ubuntu2.3 [237 kB]                                   
Get:5 http://pe.archive.ubuntu.com/ubuntu jammy/main amd64 lto-disabled-list all 24 [12.5 kB]                                                  
Get:6 http://pe.archive.ubuntu.com/ubuntu jammy-updates/main amd64 dpkg-dev all 1.21.1ubuntu2.3 [922 kB]                                       
Get:7 http://pe.archive.ubuntu.com/ubuntu jammy/main amd64 build-essential amd64 12.9ubuntu3 [4,744 B]                                         
Get:8 http://pe.archive.ubuntu.com/ubuntu jammy/main amd64 libfakeroot amd64 1.28-1ubuntu1 [31.5 kB]                                           
Get:9 http://pe.archive.ubuntu.com/ubuntu jammy/main amd64 fakeroot amd64 1.28-1ubuntu1 [60.4 kB]                                              
Get:10 http://pe.archive.ubuntu.com/ubuntu jammy/main amd64 libalgorithm-diff-perl all 1.201-1 [41.8 kB]                                       
Get:11 http://pe.archive.ubuntu.com/ubuntu jammy/main amd64 libalgorithm-diff-xs-perl amd64 0.04-6build3 [11.9 kB]                             
Get:12 http://pe.archive.ubuntu.com/ubuntu jammy/main amd64 libalgorithm-merge-perl all 0.08-3 [12.0 kB]                                       
Get:13 http://pe.archive.ubuntu.com/ubuntu jammy/main amd64 libfile-fcntllock-perl amd64 0.22-3build7 [33.9 kB]                                
Fetched 14.9 MB in 16s (943 kB/s)                                                                                                              
Selecting previously unselected package libstdc++-11-dev:amd64.
(Reading database ... 210782 files and directories currently installed.)
Preparing to unpack .../00-libstdc++-11-dev_11.4.0-1ubuntu1~22.04_amd64.deb ...
Unpacking libstdc++-11-dev:amd64 (11.4.0-1ubuntu1~22.04) ...
Selecting previously unselected package g++-11.
Preparing to unpack .../01-g++-11_11.4.0-1ubuntu1~22.04_amd64.deb ...
Unpacking g++-11 (11.4.0-1ubuntu1~22.04) ...
Selecting previously unselected package g++.
Preparing to unpack .../02-g++_4%3a11.2.0-1ubuntu1_amd64.deb ...
Unpacking g++ (4:11.2.0-1ubuntu1) ...
Selecting previously unselected package libdpkg-perl.
Preparing to unpack .../03-libdpkg-perl_1.21.1ubuntu2.3_all.deb ...
Unpacking libdpkg-perl (1.21.1ubuntu2.3) ...
Selecting previously unselected package lto-disabled-list.
Preparing to unpack .../04-lto-disabled-list_24_all.deb ...
Unpacking lto-disabled-list (24) ...
Selecting previously unselected package dpkg-dev.
Preparing to unpack .../05-dpkg-dev_1.21.1ubuntu2.3_all.deb ...
Unpacking dpkg-dev (1.21.1ubuntu2.3) ...
Selecting previously unselected package build-essential.
Preparing to unpack .../06-build-essential_12.9ubuntu3_amd64.deb ...
Unpacking build-essential (12.9ubuntu3) ...
Selecting previously unselected package libfakeroot:amd64.
Preparing to unpack .../07-libfakeroot_1.28-1ubuntu1_amd64.deb ...
Unpacking libfakeroot:amd64 (1.28-1ubuntu1) ...
Selecting previously unselected package fakeroot.
Preparing to unpack .../08-fakeroot_1.28-1ubuntu1_amd64.deb ...
Unpacking fakeroot (1.28-1ubuntu1) ...
Selecting previously unselected package libalgorithm-diff-perl.
Preparing to unpack .../09-libalgorithm-diff-perl_1.201-1_all.deb ...
Unpacking libalgorithm-diff-perl (1.201-1) ...
Selecting previously unselected package libalgorithm-diff-xs-perl.
Preparing to unpack .../10-libalgorithm-diff-xs-perl_0.04-6build3_amd64.deb ...
Unpacking libalgorithm-diff-xs-perl (0.04-6build3) ...
Selecting previously unselected package libalgorithm-merge-perl.
Preparing to unpack .../11-libalgorithm-merge-perl_0.08-3_all.deb ...
Unpacking libalgorithm-merge-perl (0.08-3) ...
Selecting previously unselected package libfile-fcntllock-perl.
Preparing to unpack .../12-libfile-fcntllock-perl_0.22-3build7_amd64.deb ...
Unpacking libfile-fcntllock-perl (0.22-3build7) ...
Setting up lto-disabled-list (24) ...
Setting up libfile-fcntllock-perl (0.22-3build7) ...
Setting up libalgorithm-diff-perl (1.201-1) ...
Setting up libfakeroot:amd64 (1.28-1ubuntu1) ...
Setting up fakeroot (1.28-1ubuntu1) ...
update-alternatives: using /usr/bin/fakeroot-sysv to provide /usr/bin/fakeroot (fakeroot) in auto mode
Setting up libdpkg-perl (1.21.1ubuntu2.3) ...
Setting up libstdc++-11-dev:amd64 (11.4.0-1ubuntu1~22.04) ...
Setting up libalgorithm-diff-xs-perl (0.04-6build3) ...
Setting up libalgorithm-merge-perl (0.08-3) ...
Setting up g++-11 (11.4.0-1ubuntu1~22.04) ...
Setting up dpkg-dev (1.21.1ubuntu2.3) ...
Setting up g++ (4:11.2.0-1ubuntu1) ...
update-alternatives: using /usr/bin/g++ to provide /usr/bin/c++ (c++) in auto mode
Setting up build-essential (12.9ubuntu3) ...
Processing triggers for man-db (2.10.2-1) ...
Processing triggers for libc-bin (2.35-0ubuntu3.6) ...

My concern that nothing about gcc-12 appears

Then the sudo /sbin/vboxconfig command is executed

sudo /sbin/vboxconfig
vboxdrv.sh: Stopping VirtualBox services.
vboxdrv.sh: Starting VirtualBox services.
vboxdrv.sh: Building VirtualBox kernel modules.
vboxdrv.sh: failed: Look at /var/log/vbox-setup.log to find out what went wrong.

There were problems setting up VirtualBox.  To re-start the set-up process, run
  /sbin/vboxconfig
as root.  If your system is using EFI Secure Boot you may need to sign the
kernel modules (vboxdrv, vboxnetflt, vboxnetadp, vboxpci) before you can load
them. Please see your Linux system's documentation for more information.

The content of the /var/log/vbox-setup.log file is as follows:

Building the main VirtualBox module.
Error building the module:
make V=1 CONFIG_MODULE_SIG= CONFIG_MODULE_SIG_ALL= -C /lib/modules/6.5.0-26-generic/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/vboxdrv.mod
  printf '%s
'   linux/SUPDrv-linux.o SUPDrv.o SUPDrvGip.o SUPDrvSem.o SUPDrvTracer.o SUPLibAll.o common/string/strformatrt.o combined-agnostic1.o combined-agnostic2.o combined-os-specific.o | awk '!x[$0]++ { print("/tmp/vbox.0/"$0) }' > /tmp/vbox.0/vboxdrv.mod
# CC [M]  /tmp/vbox.0/linux/SUPDrv-linux.o
  gcc-12 -Wp,-MMD,/tmp/vbox.0/linux/.SUPDrv-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/SUPDrvMangling.h -fno-omit-frame-pointer -fno-pie -Wno-declaration-after-statement -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 -DRT_WITH_VBOX -DVBOX_WITH_HARDENING -DSUPDRV_WITH_RELEASE_LOGGER -DVBOX_WITHOUT_EFLAGS_AC_SET_IN_VBOXDRV -DIPRT_WITHOUT_EFLAGS_AC_PRESERVING -DVBOX_WITH_64_BITS_GUESTS -DCONFIG_VBOXDRV_AS_MISC -DRT_ARCH_AMD64  -fsanitize=bounds-strict -fsanitize=shift -fsanitize=bool -fsanitize=enum  -DMODULE  -DKBUILD_BASENAME='"SUPDrv_linux"' -DKBUILD_MODNAME='"vboxdrv"' -D__KBUILD_MODNAME=kmod_vboxdrv -c -o /tmp/vbox.0/linux/SUPDrv-linux.o /tmp/vbox.0/linux/SUPDrv-linux.c   ; ./tools/objtool/objtool --hacks=jump_label --hacks=noinstr --hacks=skylake --retpoline --rethunk --sls --stackval --static-call --uaccess --prefix=16   --module /tmp/vbox.0/linux/SUPDrv-linux.o
/bin/sh: 1: gcc-12: not found
make[2]: *** [scripts/Makefile.build:251: /tmp/vbox.0/linux/SUPDrv-linux.o] Error 127
make[1]: *** [Makefile:2039: /tmp/vbox.0] Error 2
make: *** [/tmp/vbox.0/Makefile-footer.gmk:133: vboxdrv] Error 2

You may have to add the gcc-12 package separately
You may have to add or update other packages too
Because you are adding a .deb package that is newer than the OS release its dependencies may not be met by the package system… so you have to sort out the dependencies by hand.
I prefer to stay with the slightly older versions supported by the package system .
If I need something newer ( I sometimes do with R) then I install it from source code and keep it out of the package system by putting
it in /usr/local. Doing that does not solve the dependency problem, but at least it keeps
the filesystems in /usr and / clean.

3 Likes

Thanks for the suggestions - it is noted.

Just in case were executed the following commands:

sudo apt remove virtualbox*
sudo apt autoremove --purge

And re-executed all

 sudo apt install ./virtualbox-7.0_7.0.14-161095~Ubuntu~jammy_amd64.deb 
Reading package lists... Done
Building dependency tree... Done
Reading state information... Done
Note, selecting 'virtualbox-7.0' instead of './virtualbox-7.0_7.0.14-161095~Ubuntu~jammy_amd64.deb'
The following additional packages will be installed:
  libqt5help5 libqt5opengl5 libqt5printsupport5 libqt5sql5 libqt5sql5-sqlite libqt5x11extras5 libqt5xml5 libsdl-ttf2.0-0 libsdl1.2debian
The following NEW packages will be installed:
  libqt5help5 libqt5opengl5 libqt5printsupport5 libqt5sql5 libqt5sql5-sqlite libqt5x11extras5 libqt5xml5 libsdl-ttf2.0-0 libsdl1.2debian
  virtualbox-7.0
0 upgraded, 10 newly installed, 0 to remove and 0 not upgraded.
Need to get 1,033 kB/93.9 MB of archives.
After this operation, 224 MB of additional disk space will be used.
Do you want to continue? [Y/n] y
Get:1 http://pe.archive.ubuntu.com/ubuntu jammy-updates/universe amd64 libqt5sql5 amd64 5.15.3+dfsg-2ubuntu0.2 [123 kB]
Get:2 /home/manueljordan/deb/virtualbox-7.0_7.0.14-161095~Ubuntu~jammy_amd64.deb virtualbox-7.0 amd64 7.0.14-161095~Ubuntu~jammy [92.9 MB]
Get:3 http://pe.archive.ubuntu.com/ubuntu jammy/universe amd64 libqt5help5 amd64 5.15.3-1 [162 kB]
Get:4 http://pe.archive.ubuntu.com/ubuntu jammy-updates/universe amd64 libqt5opengl5 amd64 5.15.3+dfsg-2ubuntu0.2 [153 kB]
Get:5 http://pe.archive.ubuntu.com/ubuntu jammy-updates/universe amd64 libqt5printsupport5 amd64 5.15.3+dfsg-2ubuntu0.2 [214 kB]
Get:6 http://pe.archive.ubuntu.com/ubuntu jammy/universe amd64 libqt5x11extras5 amd64 5.15.3-1 [10.9 kB]                                       
Get:7 http://pe.archive.ubuntu.com/ubuntu jammy-updates/universe amd64 libqt5xml5 amd64 5.15.3+dfsg-2ubuntu0.2 [124 kB]                        
Get:8 http://pe.archive.ubuntu.com/ubuntu jammy-updates/universe amd64 libqt5sql5-sqlite amd64 5.15.3+dfsg-2ubuntu0.2 [53.0 kB]                
Get:9 http://pe.archive.ubuntu.com/ubuntu jammy/universe amd64 libsdl1.2debian amd64 1.2.15+dfsg2-6 [177 kB]                                   
Get:10 http://pe.archive.ubuntu.com/ubuntu jammy/universe amd64 libsdl-ttf2.0-0 amd64 2.0.11-6 [15.1 kB]                                       
Fetched 1,033 kB in 8s (132 kB/s)                                                                                                              
Preconfiguring packages ...
Selecting previously unselected package libqt5sql5:amd64.
(Reading database ... 211359 files and directories currently installed.)
Preparing to unpack .../0-libqt5sql5_5.15.3+dfsg-2ubuntu0.2_amd64.deb ...
Unpacking libqt5sql5:amd64 (5.15.3+dfsg-2ubuntu0.2) ...
Selecting previously unselected package libqt5help5:amd64.
Preparing to unpack .../1-libqt5help5_5.15.3-1_amd64.deb ...
Unpacking libqt5help5:amd64 (5.15.3-1) ...
Selecting previously unselected package libqt5opengl5:amd64.
Preparing to unpack .../2-libqt5opengl5_5.15.3+dfsg-2ubuntu0.2_amd64.deb ...
Unpacking libqt5opengl5:amd64 (5.15.3+dfsg-2ubuntu0.2) ...
Selecting previously unselected package libqt5printsupport5:amd64.
Preparing to unpack .../3-libqt5printsupport5_5.15.3+dfsg-2ubuntu0.2_amd64.deb ...
Unpacking libqt5printsupport5:amd64 (5.15.3+dfsg-2ubuntu0.2) ...
Selecting previously unselected package libqt5x11extras5:amd64.
Preparing to unpack .../4-libqt5x11extras5_5.15.3-1_amd64.deb ...
Unpacking libqt5x11extras5:amd64 (5.15.3-1) ...
Selecting previously unselected package libqt5xml5:amd64.
Preparing to unpack .../5-libqt5xml5_5.15.3+dfsg-2ubuntu0.2_amd64.deb ...
Unpacking libqt5xml5:amd64 (5.15.3+dfsg-2ubuntu0.2) ...
Selecting previously unselected package virtualbox-7.0.
Preparing to unpack .../6-virtualbox-7.0_7.0.14-161095~Ubuntu~jammy_amd64.deb ...
Unpacking virtualbox-7.0 (7.0.14-161095~Ubuntu~jammy) ...
Selecting previously unselected package libqt5sql5-sqlite:amd64.
Preparing to unpack .../7-libqt5sql5-sqlite_5.15.3+dfsg-2ubuntu0.2_amd64.deb ...
Unpacking libqt5sql5-sqlite:amd64 (5.15.3+dfsg-2ubuntu0.2) ...
Selecting previously unselected package libsdl1.2debian:amd64.
Preparing to unpack .../8-libsdl1.2debian_1.2.15+dfsg2-6_amd64.deb ...
Unpacking libsdl1.2debian:amd64 (1.2.15+dfsg2-6) ...
Selecting previously unselected package libsdl-ttf2.0-0:amd64.
Preparing to unpack .../9-libsdl-ttf2.0-0_2.0.11-6_amd64.deb ...
Unpacking libsdl-ttf2.0-0:amd64 (2.0.11-6) ...
Setting up libqt5x11extras5:amd64 (5.15.3-1) ...
Setting up libqt5sql5:amd64 (5.15.3+dfsg-2ubuntu0.2) ...
Setting up libqt5printsupport5:amd64 (5.15.3+dfsg-2ubuntu0.2) ...
Setting up libqt5xml5:amd64 (5.15.3+dfsg-2ubuntu0.2) ...
Setting up libsdl1.2debian:amd64 (1.2.15+dfsg2-6) ...
Setting up libqt5opengl5:amd64 (5.15.3+dfsg-2ubuntu0.2) ...
Setting up libsdl-ttf2.0-0:amd64 (2.0.11-6) ...
Setting up libqt5sql5-sqlite:amd64 (5.15.3+dfsg-2ubuntu0.2) ...
Setting up libqt5help5:amd64 (5.15.3-1) ...
Setting up virtualbox-7.0 (7.0.14-161095~Ubuntu~jammy) ...
addgroup: The group `vboxusers' already exists as a system group. Exiting.
vboxdrv.sh: failed: Look at /var/log/vbox-setup.log to find out what went wrong.

There were problems setting up VirtualBox.  To re-start the set-up process, run
  /sbin/vboxconfig
as root.  If your system is using EFI Secure Boot you may need to sign the
kernel modules (vboxdrv, vboxnetflt, vboxnetadp, vboxpci) before you can load
them. Please see your Linux system's documentation for more information.
Processing triggers for desktop-file-utils (0.26-1ubuntu3) ...
Processing triggers for hicolor-icon-theme (0.17-2) ...
Processing triggers for gnome-menus (3.36.0-1ubuntu3) ...
Processing triggers for libc-bin (2.35-0ubuntu3.6) ...
Processing triggers for shared-mime-info (2.1-2) ...
Processing triggers for mailcap (3.70+nmu1ubuntu1) ...
N: Download is performed unsandboxed as root as file '/home/manueljordan/deb/virtualbox-7.0_7.0.14-161095~Ubuntu~jammy_amd64.deb' couldn't be accessed by user '_apt'. - pkgAcquire::Run (13: Permission denied)

Practically nothing explicitly about gcc-12

The content of the /var/log/vbox-setup.log file is:

Building the main VirtualBox module.
Error building the module:
make V=1 CONFIG_MODULE_SIG= CONFIG_MODULE_SIG_ALL= -C /lib/modules/6.5.0-26-generic/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/vboxdrv.mod
  printf '%s
'   linux/SUPDrv-linux.o SUPDrv.o SUPDrvGip.o SUPDrvSem.o SUPDrvTracer.o SUPLibAll.o common/string/strformatrt.o combined-agnostic1.o combined-agnostic2.o combined-os-specific.o | awk '!x[$0]++ { print("/tmp/vbox.0/"$0) }' > /tmp/vbox.0/vboxdrv.mod
# CC [M]  /tmp/vbox.0/linux/SUPDrv-linux.o
  gcc-12 -Wp,-MMD,/tmp/vbox.0/linux/.SUPDrv-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/SUPDrvMangling.h -fno-omit-frame-pointer -fno-pie -Wno-declaration-after-statement -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 -DRT_WITH_VBOX -DVBOX_WITH_HARDENING -DSUPDRV_WITH_RELEASE_LOGGER -DVBOX_WITHOUT_EFLAGS_AC_SET_IN_VBOXDRV -DIPRT_WITHOUT_EFLAGS_AC_PRESERVING -DVBOX_WITH_64_BITS_GUESTS -DCONFIG_VBOXDRV_AS_MISC -DRT_ARCH_AMD64  -fsanitize=bounds-strict -fsanitize=shift -fsanitize=bool -fsanitize=enum  -DMODULE  -DKBUILD_BASENAME='"SUPDrv_linux"' -DKBUILD_MODNAME='"vboxdrv"' -D__KBUILD_MODNAME=kmod_vboxdrv -c -o /tmp/vbox.0/linux/SUPDrv-linux.o /tmp/vbox.0/linux/SUPDrv-linux.c   ; ./tools/objtool/objtool --hacks=jump_label --hacks=noinstr --hacks=skylake --retpoline --rethunk --sls --stackval --static-call --uaccess --prefix=16   --module /tmp/vbox.0/linux/SUPDrv-linux.o
/bin/sh: 1: gcc-12: not found
make[2]: *** [scripts/Makefile.build:251: /tmp/vbox.0/linux/SUPDrv-linux.o] Error 127
make[1]: *** [Makefile:2039: /tmp/vbox.0] Error 2
make: *** [/tmp/vbox.0/Makefile-footer.gmk:133: vboxdrv] Error 2

I am going to do a research about:

couldn't be accessed by user '_apt'. - pkgAcquire::Run (13: Permission denied)

Until this point I am learning this new experience about deb world

Thanks for your polite support.

It is there in the log.

1 Like

Something is weird I did do the same installation process in other laptop, for other Ubuntu Desktop 22.04 instance but running through VirtualBox.

Yes, Ubuntu running as guest and was installed VirtualBox 7 without any problems.