This tutorial servers a guide to quickly install VirtualBox Guest Additions on Ubuntu 22.04 VM. VirtualBox Guest Additions are designed to be installed inside a virtual machine after the guest operating system has been installed. They consist of device drivers and system applications that optimize the guest operating system for better performance and usability.
Quickly Install VirtualBox Guest Additions on Ubuntu 22.04 VM
Assuming you just installed Ubuntu 22.04 as a virtual machine on VirtualBox and want to optimize it for better performance and usability through the use of Guest Additions, then follow this guide to quickly install VirtualBox Guest Additions on Ubuntu 22.04 VM.
Install Required Packages
To begin, run the command below to install required packages;
apt install dkms build-essential linux-headers-$(uname -r) -y
Once the installation completes, reboot the system;
systemctl reboot -i
Insert Guest Additions ISO File
The quickest way to insert the guest additions ISO file is to install from the default Ubuntu 22.04 repositories.
The packages usually provided the guest additions ISO for the currently installed version of VirtualBox on your host.
To confirm the same, run the command below on the host to check the currently installed version of VirtualBox;
The, on the Ubuntu 22.04 virtual machine, check the available version of Guest Additions iso;
apt-cache policy virtualbox-guest-additions-iso
virtualbox-guest-additions-iso: Installed: (none) Candidate: 6.1.30-1 Version table: 6.1.30-1 500 500 http://us.archive.ubuntu.com/ubuntu jammy/multiverse amd64 Packages 500 http://us.archive.ubuntu.com/ubuntu jammy/multiverse i386 Packages
Hence, install Guest Additions ISO by running the command below;
apt install virtualbox-guest-additions-iso -y
Install VirtualBox Guest Additions on Ubuntu 22.04 VM
Once the installation of Guest Additions ISO file is done, proceed to install VirtualBox Guest Additions on Ubuntu 22.04 VM.
Mount the ISO file;
mount -o loop /usr/share/virtualbox/VBoxGuestAdditions.iso /mnt
Install VirtualBox Guest Additions on Ubuntu 22.04 VM;
Sample installation output;
Verifying archive integrity... All good. Uncompressing VirtualBox 6.1.30 Guest Additions for Linux........ VirtualBox Guest Additions installer Copying additional installer modules ... Installing additional modules ... VirtualBox Guest Additions: Starting. VirtualBox Guest Additions: Building the VirtualBox Guest Additions kernel modules. This may take a while. VirtualBox Guest Additions: To build modules for other installed kernels, run VirtualBox Guest Additions: /sbin/rcvboxadd quicksetup VirtualBox Guest Additions: or VirtualBox Guest Additions: /sbin/rcvboxadd quicksetup all VirtualBox Guest Additions: Building the modules for kernel 5.13.0-19-generic. update-initramfs: Generating /boot/initrd.img-5.13.0-19-generic VirtualBox Guest Additions: Running kernel modules will not be replaced until the system is restarted
Next, reboot the system;
systemctl reboot -i
Upon login, the screen should at least auto-resize.
If it don’t auto-resize automatically, you need toggle Auto-resize Guest Display Off and On by navigating to the VM menu, click View > Auto-resize Guest Display.
And that is it on how to Quickly install VirtualBox Guest Additions on Ubuntu 22.04 VM.