How to install VirtualBox Guest Additions on Kubuntu 23.04

By | October 12, 2023

If you are running kubuntu inside virtualbox as a guest os, then you need to install the guest additions as well. Its an extra set of drivers that improves integration between the host and the guest and provides a bunch of features like shared clipboard, native screen resolution, better mouse pointer integration, shared folders etc.

Some distros like Fedora have guest additions pre-installed with them, but with Ubuntu variants we need to install them manually.

Update and Upgrade packages

The first step is to upgrade all packages and it is done with the following single command. On the first update it might download quite a few packages and take time to complete.

sudo apt-get update && sudo apt-get -y dist-upgrade

The "y" parameter will run the command without prompting for a yes/no confirmation from the user.

Setup compilation tools

Guest additions are actually compiled on the guest os, so you need to first installed various compilation and build tools like kernel header files and so on.

First prepare your system with the following commands:

sudo apt-get install build-essential module-assistant
sudo m-a prepare

Alternatively you can run this single command, which will do the same thing.

sudo apt install build-essential dkms linux-headers-$(uname -r)

Insert Guest Additions disk

Now the guest system is ready to compile guest additions. Click Devices > Insert Guest Additions CD Image.

By default, Kubuntu will show you a notification about the new CD image and you can click Mount and open it in Dolphin.

Press Ctrl+L to view the actual mount path of the cd image.

Now open a terminal and navigate to that directory where the guest additions disk is mounted.

On my system it was something like this

silver@silver-VirtualBox:~$ /media/silver/VBox_GAs_6.1.34/
bash: /media/silver/VBox_GAs_6.1.34/: Is a directory

Navigate to the directory, view the files and run the correct command

silver@silver-VirtualBox:~$ cd /media/silver/VBox_GAs_6.1.34/

silver@silver-VirtualBox:/media/silver/VBox_GAs_6.1.34$ ls -l
total 47310
-r--r--r-- 1 silver silver      763 Feb 20  2020 AUTORUN.INF
-r-xr-xr-x 1 silver silver     6384 Mar 23 05:18 autorun.sh
dr-xr-xr-x 2 silver silver      792 Mar 23 06:05 cert
dr-xr-xr-x 2 silver silver     1824 Mar 23 06:05 NT3x
dr-xr-xr-x 2 silver silver     2652 Mar 23 06:05 OS2
-r-xr-xr-x 1 silver silver     4821 Mar 23 05:18 runasroot.sh
-r--r--r-- 1 silver silver      592 Mar 23 06:05 TRANS.TBL
-r--r--r-- 1 silver silver  4033829 Mar 23 05:21 VBoxDarwinAdditions.pkg
-r-xr-xr-x 1 silver silver     3949 Mar 23 05:17 VBoxDarwinAdditionsUninstall.tool
-r-xr-xr-x 1 silver silver  7505330 Mar 23 05:18 VBoxLinuxAdditions.run
-r--r--r-- 1 silver silver  9445376 Mar 23 05:19 VBoxSolarisAdditions.pkg
-r-xr-xr-x 1 silver silver 17047696 Mar 23 06:05 VBoxWindowsAdditions-amd64.exe
-r-xr-xr-x 1 silver silver   270840 Mar 23 05:18 VBoxWindowsAdditions.exe
-r-xr-xr-x 1 silver silver 10116464 Mar 23 05:42 VBoxWindowsAdditions-x86.exe
-r--r--r-- 1 silver silver      259 Oct  4  2021 windows11-bypass.reg

On our system the correct script to run is VBoxLinuxAdditions.run which compiles and install the guest additions for linux.

Run it with sudo. It needs root privileges since it compiles a kernel module and installs it. The whole process could look something like this:

silver@silver-VirtualBox:/media/silver/VBox_GAs_6.1.34$ sudo ./VBoxLinuxAdditions.run
Verifying archive integrity... All good.
Uncompressing VirtualBox 6.1.34 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 <version>
VirtualBox Guest Additions: or
VirtualBox Guest Additions:   /sbin/rcvboxadd quicksetup all
VirtualBox Guest Additions: Building the modules for kernel 5.15.0-41-generic.
update-initramfs: Generating /boot/initrd.img-5.15.0-41-generic
VirtualBox Guest Additions: Running kernel modules will not be replaced until
the system is restarted
silver@silver-VirtualBox:/media/silver/VBox_GAs_6.1.34$

If you do not see any specific error message in the above output, it means that installation was successful.

Restart the system now.

Check the Installation

After the guest os reboots, its time to check if guest additions are working or not.

Firstly you can confirm this by resizing the guest os window and the resolution should change immediately to whatever window size you are setting.

Next you can verify the virtualbox guest additions modules to be installed and loaded:

silver@silver-VirtualBox:~$ lsmod | grep -io vboxguest
vboxguest
silver@silver-VirtualBox:~$

vboxguest is the name of the module that provides guest addition features.

We can chekc details of this module with modinfo.

silver@silver-VirtualBox:~$ modinfo vboxguest
filename:       /lib/modules/5.15.0-41-generic/misc/vboxguest.ko
version:        6.1.34 r150636
license:        GPL
description:    Oracle VM VirtualBox Guest Additions for Linux Module
author:         Oracle Corporation
srcversion:     FA5DE49C7F2CB39107D8436
alias:          pci:v000080EEd0000CAFEsv00000000sd00000000bc*sc*i*
depends:        
retpoline:      Y
name:           vboxguest
vermagic:       5.15.0-41-generic SMP mod_unload modversions 
silver@silver-VirtualBox:~$ 

silver@silver-VirtualBox:~$  lsmod | grep -io vboxguest | xargs modinfo | grep -iw version
version:        6.1.34 r150636
silver@silver-VirtualBox:~$

Other things

Now that you have guest additions installed you can setup a couple of more things.

1. Shared Clipboard: Click Devices > Shared Clipboard > Bidirectional. Now you can copy paste files across the guest and host easily.

2. Enable Devices > Drag and Drop > Bidirectional. This will allow you to drag files across guest and host make it even easier to move files.

3. Setup shared folders: Go to Devices > Shared Folders > Shared Folder Settings and configure shared folders. This will allow you to work on a folder in host os such that the contents will show up in the guest os in realtime. This will will make copy pasting even more efficient.

That's all about setting up guest additions, have fun.

About Silver Moon

A Tech Enthusiast, Blogger, Linux Fan and a Software Developer. Writes about Computer hardware, Linux and Open Source software and coding in Python, Php and Javascript. He can be reached at [email protected].

Leave a Reply

Your email address will not be published. Required fields are marked *