Automatic load Guest Additions at boot Ubuntu (based) guests

Discussions about using Linux guests in VirtualBox.
Post Reply
antonwas
Posts: 2
Joined: 14. Feb 2024, 23:20

Automatic load Guest Additions at boot Ubuntu (based) guests

Post by antonwas »

Hello,

This is my first question on VirtualBox forum. Hopefully someone is able to help me with it. I am relative new to Linux and has no deep knowledge about the system. Most of the issues I run into become solved by searching the internet. However, for the situation below I did not find any solution yet.

It is about the Devices -> Upgrade Guest Additions function which is available in VirtualBox since version 7.0. When I run an Ubuntu based Linux (e.g. Ubuntu or Mint) I get the following error after a few minutes.

Name: C:\Program Files\Oracle\VirtualBox/VBoxGuestAdditions.iso

Automatic update of Guest Additions has failed: files were installed, but kernel modules were not reloaded automatically. Please consider rebooting the guest.
Result Code:
VBOX_E_GSTCTL_GUEST_ERROR (0X80BB000F)
Component:
GuestSessionWrap
Interface:
IGuestSession {234f0627-866d-48c2-91a5-4c9d50f04928}

Long time I thought this was probably a bug in VirtualBox, but it looks like this is not the case.
I found out that when I run the following command the Upgrade Guest Additions function does not give an error anymore:

Code: Select all

sudo rcvboxadd reload
However, this only works as long as the VM is not restarted. As soon as I restart the VM I need to execute the above command again. So I assume something regarding the sudo rcvboxadd reload command is not executed automatically during boot, which causes the error.
I could not find a solution for this on the internet. Hence my question here.

The following thins I already checked:

Check if GCC is installed in VM

Code: Select all

$ gcc --version
output:

Code: Select all

gcc (Ubuntu 13.2.0-4ubuntu3) 13.2.0
Copyright (C) 2023 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.  There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
Check if Make is installed

Code: Select all

make --version
output:

Code: Select all

GNU Make 4.3
Dit programma is gecompileerd voor x86_64-pc-linux-gnu.
Copyright (C) 1988-2020 Free Software Foundation, Inc.
Licentie GPLv3+: GNU GPL versie 3 of nieuwer <URL/licenses/gpl.html>
Dit is vrije software: u mag het vrijelijk wijzigen en verder verspreiden.
Er is GEEN GARANTIE, voor zover de wet dit toestaat.
Check kernel header files

Code: Select all

$ uname -r output:
6.5.0-17-generic

Code: Select all

$ apt search linux-headers-$(uname -r)
output:

Code: Select all

linux-headers-6.5.0-17-generic/mantic-updates,mantic-security,now 6.5.0-17.17 amd64 [geïnstalleerd,automatisch]
  Linux kernel headers for version 6.5.0 on 64 bit x86 SMP

Code: Select all

$ ls -l /usr/src/linux-headers-$(uname -r)
output:

Code: Select all

drwxr-xr-x 3 root root    4096 feb  8 23:11 arch
lrwxrwxrwx 1 root root      31 jan 11 13:47 block -> ../linux-headers-6.5.0-17/block
lrwxrwxrwx 1 root root      31 jan 11 13:47 certs -> ../linux-headers-6.5.0-17/certs
lrwxrwxrwx 1 root root      32 jan 11 13:47 crypto -> ../linux-headers-6.5.0-17/crypto
lrwxrwxrwx 1 root root      39 jan 11 13:47 Documentation -> ../linux-headers-6.5.0-17/Documentation
lrwxrwxrwx 1 root root      33 jan 11 13:47 drivers -> ../linux-headers-6.5.0-17/drivers
lrwxrwxrwx 1 root root      28 jan 11 13:47 fs -> ../linux-headers-6.5.0-17/fs
drwxr-xr-x 4 root root    4096 feb  8 23:11 include
lrwxrwxrwx 1 root root      30 jan 11 13:47 init -> ../linux-headers-6.5.0-17/init
lrwxrwxrwx 1 root root      34 jan 11 13:47 io_uring -> ../linux-headers-6.5.0-17/io_uring
lrwxrwxrwx 1 root root      29 jan 11 13:47 ipc -> ../linux-headers-6.5.0-17/ipc
lrwxrwxrwx 1 root root      32 jan 11 13:47 Kbuild -> ../linux-headers-6.5.0-17/Kbuild
lrwxrwxrwx 1 root root      33 jan 11 13:47 Kconfig -> ../linux-headers-6.5.0-17/Kconfig
drwxr-xr-x 2 root root    4096 feb  8 23:11 kernel
lrwxrwxrwx 1 root root      29 jan 11 13:47 lib -> ../linux-headers-6.5.0-17/lib
-rw-r--r-- 1 root root   71937 jan 11 13:47 Makefile
lrwxrwxrwx 1 root root      28 jan 11 13:47 mm -> ../linux-headers-6.5.0-17/mm
-rw-r--r-- 1 root root 2120271 jan 11 13:47 Module.symvers
lrwxrwxrwx 1 root root      29 jan 11 13:47 net -> ../linux-headers-6.5.0-17/net
lrwxrwxrwx 1 root root      39 jan 11 13:47 rust -> ../linux-lib-rust-6.5.0-17-generic/rust
lrwxrwxrwx 1 root root      33 jan 11 13:47 samples -> ../linux-headers-6.5.0-17/samples
drwxr-xr-x 7 root root   12288 feb  8 23:11 scripts
lrwxrwxrwx 1 root root      34 jan 11 13:47 security -> ../linux-headers-6.5.0-17/security
lrwxrwxrwx 1 root root      31 jan 11 13:47 sound -> ../linux-headers-6.5.0-17/sound
drwxr-xr-x 4 root root    4096 feb  8 23:11 tools
lrwxrwxrwx 1 root root      32 jan 11 13:47 ubuntu -> ../linux-headers-6.5.0-17/ubuntu
lrwxrwxrwx 1 root root      29 jan 11 13:47 usr -> ../linux-headers-6.5.0-17/usr
lrwxrwxrwx 1 root root      30 jan 11 13:47 virt -> ../linux-headers-6.5.0-17/virt
In above outputs I do not see anything strange.

To get the Upgrade Guest Additions available you need to have installed Guest Additions before. Otherwise the option is greyed out in the menu. I installed the Guest Additions via the Device -> Insert Guest Additions CD image... option. I did this the following way:
  • Inset CD image
  • Open the CD image by clicking the disc icon on the left side of the screen
  • Right click -> Open in terminal
  • type

    Code: Select all

    sudo ./sh VBoxLinuxAdditions.run
    No errors after running
The part of the error message which states: Please consider rebooting the guest does not work unfortunately.

Host:
Windows 10 Home
Intel(R) Core(TM) i7-4700MQ CPU @ 2.40GHz
8GB RAM

Guest
Ubuntu 23.10
4GB RAM
GNOME: 45.2

Hopefully someone is able to help me further. It is just a curious question. I saw someone else already asked about this. See:
viewtopic.php?t=109543
scottgus1
Site Moderator
Posts: 20945
Joined: 30. Dec 2009, 20:14
Primary OS: MS Windows 10
VBox Version: PUEL
Guest OSses: Windows, Linux

Re: Automatic load Guest Additions at boot Ubuntu (based) guests

Post by scottgus1 »

I think that 7.0 Guest Additions might need to be installed in the OS already for the Upgrade Guest Additions command to work. Linux distros usually have 6.0.0 Guest additions (or at least the headers therefore) preinstalled. (maybe?)
antonwas
Posts: 2
Joined: 14. Feb 2024, 23:20

Re: Automatic load Guest Additions at boot Ubuntu (based) guests

Post by antonwas »

You are right. The Guest Additions version 7.0.x must be installed before you can use the Device -> Upgrade Guest Additions feature.
If Guest Additions version 7.0.x is previously is not installed the Upgrade Guest Additions feature is greyed out.
In my case Guest Additions version 7.0.12 is installed.

In the meanwhile I did some more testing and found out the following.

If Guest Additions version 7.0.12 is installed the Upgrade Guest Additions feature is working like a charm.
If I run the code below after the Upgrade Guest Additions is finished, I will get the output mentioned.

Code

Code: Select all

$ sudo rcvboxadd status-kernel
Output

Code: Select all

VirtualBox Guest Additions: kernel modules 7.0.14 r161095 are loaded
However as described in my OP, when I reboot the VM and try to run the Upgrade Guest Additions feature I will get the error message:

Name: C:\Program Files\Oracle\VirtualBox/VBoxGuestAdditions.iso

Automatic update of Guest Additions has failed: files were installed, but kernel modules were not reloaded automatically. Please consider rebooting the guest.

Result Code: VBOX_E_GSTCTL_GUEST_ERROR (0X80BB000F)
Component: GuestSessionWrap
Interface: IGuestSession {234f0627-866d-48c2-91a5-4c9d50f04928}

Same command, but after the reboot:

Code

Code: Select all

$ sudo rcvboxadd status-kernel
Output

Code: Select all

VirtualBox Guest Additions: module vboxsf is not loaded
VirtualBox Guest Additions: kernel modules 7.0.14 r161095 were not loaded
Then

Code
$ sudo rcvboxadd reload

Output

Code: Select all

VirtualBox Guest Additions: reloading kernel modules and services
VirtualBox Guest Additions: kernel modules and services 7.0.14 r161095 reloaded
VirtualBox Guest Additions: NOTE: you may still consider to re-login if some 
user session specific services (Shared Clipboard, Drag and Drop, Seamless or Guest Screen Resize) were not restarted automatically
Then

Do the Update Guest Additions action again and works like a charm. Here you see the loop.

Of course, in real life it is not necessary to update the already up to date Guest Additions (7.0.14 to 7.0.14) But as I wrote, I am just curious what this is causing this error and how to solve. VirtualBox should never give this error in my opinion unless there is something seriously wrong.
Post Reply