How to automate Guest Additions upgrades to always match Host version?

Discussions about using Linux guests in VirtualBox.
Post Reply
Lionel Holt
Posts: 7
Joined: 29. Jul 2022, 21:31

How to automate Guest Additions upgrades to always match Host version?

Post by Lionel Holt »

Today I upgraded VirtualBox (Linux host) from 6.1.34 to 6.1.36.

Attempting to upgrade the Guest Additions in the Windows guest, I found no VBoxGuestAdditions_6.1.36.iso anywhere on my hard drive.

In ~/.config/VirtualBox are only these .iso files:

VBoxGuestAdditions_6.1.6.iso
VBoxGuestAdditions_6.1.18.iso
VBoxGuestAdditions_6.1.34.iso

I don't remember how those got there, but my goal is to automated the download and upgrade of Guest Additions with each host upgrade.

I tried this:

sudo apt-get install virtualbox-guest-additions-iso

But that only downloaded the .iso for 6.1.34.

Is there any way to automate so that the Guest Additions version always matches the Host version?
multiOS
Volunteer
Posts: 800
Joined: 14. Sep 2019, 16:51
Primary OS: Mac OS X other
VBox Version: PUEL
Guest OSses: WIN11,10, 7, Linux (various)
Location: United Kingdom

Re: How to automate Guest Additions upgrades to always match Host version?

Post by multiOS »

If you are downloading Virtualbox directly from the Oracle downloads page - https://www.virtualbox.org/wiki/Downloads - the the matching Guest Additions are already provided in the download, so there is no need to download them separately. Simply use Devices > Insert Guest Additions CD image... from the VirtualBox Menu and follow the installation process in the VirtualBox User Guide - Choose Help > Contents from the VirtualBox Menu, section 4; or online https://download.virtualbox.org/virtual ... Manual.pdf

However, if you are using a 'version of VirtaulBox' available through your Linux distribution's repositories, then that is a 'forked' version, which is not supported on these forums and you should get advice from their documentation and/or their own user forum, as the process is likely to be different.
Lionel Holt
Posts: 7
Joined: 29. Jul 2022, 21:31

Re: How to automate Guest Additions upgrades to always match Host version?

Post by Lionel Holt »

And what if it was installed via Oracle's official repo as instructed in the Debian-based Linux distributions section of the Download VirtualBox for Linux Hosts page?
multiOS
Volunteer
Posts: 800
Joined: 14. Sep 2019, 16:51
Primary OS: Mac OS X other
VBox Version: PUEL
Guest OSses: WIN11,10, 7, Linux (various)
Location: United Kingdom

Re: How to automate Guest Additions upgrades to always match Host version?

Post by multiOS »

You didn't provide any link to the guide you 'quoted' from, so purely on the basis that you mean https://www.virtualbox.org/wiki/Linux_Downloads , that obviously relates to the first paragraph of my response, i.e. it's clearly identified as an Oracle web page.
Lionel Holt
Posts: 7
Joined: 29. Jul 2022, 21:31

Re: How to automate Guest Additions upgrades to always match Host version?

Post by Lionel Holt »

I am not able to share links yet because I'm a new forum member.

Please scroll down that page to the Debian-based Linux distributions section.

There you will see the third option for how to install VirtualBox.

And it is official from Oracle, so it should be supported by this forum.

So, my question again but more specific this time:

Is there any way -- when installed via Oracle's official apt repo -- to automate so that the Guest Additions version always matches the Host version?
scottgus1
Site Moderator
Posts: 20965
Joined: 30. Dec 2009, 20:14
Primary OS: MS Windows 10
VBox Version: PUEL
Guest OSses: Windows, Linux

Re: How to automate Guest Additions upgrades to always match Host version?

Post by scottgus1 »

The Oracle repository's Virtualbox is official Virtualbox, and supported by this forum.

Look through section 4 in the manual to see the capabilities of the Guest Additions (GAs).

I don't see an automatic update function in my quick perusal of section 4, but such a thing could possibly be self-rolled. One of the biggest issues in Linux guests is that there are prerequisites for installing GAs, same as for installing Virtualbox on a Linux host, see section 2. These prerequisites most often settle around installing up-to-date kernel headers before installing the GAs. And you'd have to uninstall the 'helpfully' pre-installed fork of the GAs provided by the Linux distro, too, if I remember correctly.

Vboxmanage -version can report the host Virtualbox version to a script. Vboxmanage guestproperty get "VM name" "/VirtualBox/GuestAdd/Version" can report the installed GAs version. Vboxmanage can also force-load the bundled GAs ISO into the VM's CD drive, then vboxmanage guestcontrol can be used to start the kernel header install if needed and the GAs install inside the VM OS.
Lionel Holt
Posts: 7
Joined: 29. Jul 2022, 21:31

Re: How to automate Guest Additions upgrades to always match Host version?

Post by Lionel Holt »

@scottgus1, you're talking about Linux guests, but my topic is about a Windows guest.

And it's not the guest that needs to detect an upgrade.

It's only the apt upgrade script that needs to include downloading the .iso file, for example:

VBoxGuestAdditions_6.1.36.iso

And placing it where it needs to be (~/.config/VirtualBox?) and configuring for it to be loaded when Devices > Insert Guest Additions CD image is selected in the Windows guest, or even better would be if the Linux host upgrade could include inserting the .iso into the guest's optical drive.

Since I just today uninstalled the Ubuntu version and fresh installed from the Oracle repo, I don't know how the latter handles upgrading the Guest Additions .iso.

Anyone know?
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: How to automate Guest Additions upgrades to always match Host version?

Post by fth0 »

The Oracle-provided VirtualBox package named virtualbox-6.1 automatically places the ISO file at a location from where Devices > Insert Guest Additions CD image automatically takes it. It's just that there is no automation for that menu item (or the corresponding background actions).

On your Linux host, you can automate that like scottgus1 described it in the last paragraph of his post.
scottgus1
Site Moderator
Posts: 20965
Joined: 30. Dec 2009, 20:14
Primary OS: MS Windows 10
VBox Version: PUEL
Guest OSses: Windows, Linux

Re: How to automate Guest Additions upgrades to always match Host version?

Post by scottgus1 »

Lionel Holt wrote:my topic is about a Windows guest.
I missed that, my mistake.

My process above would remain the same, since vboxmanage runs only on the host.
Lionel Holt
Posts: 7
Joined: 29. Jul 2022, 21:31

Re: How to automate Guest Additions upgrades to always match Host version?

Post by Lionel Holt »

fth0 wrote:The Oracle-provided VirtualBox package named virtualbox-6.1 automatically places the ISO file at a location from where Devices > Insert Guest Additions CD image automatically takes it.
Excellent.
scottgus1 wrote:My process above would remain the same, since vboxmanage runs only on the host.
Thank you for going above and beyond what I requested!
Post Reply