Install VirtualBox Guest Additions on Ubuntu 21.04

|
Last Updated:
|
|

If you have installed Ubuntu 21.04 on VirtualBox, you realize that it is not in fullscreen. In this guide, you will learn how to install VirtualBox guest additions on Ubuntu 21.04. Apart from enabling the virtual machine to have a full screen view, guest additions offers many other features;

  • Mouse pointer integration
  • Shared folders for easy sharing of files between the host and the guest
  • Ensures better and accelerated video performance.
  • Seamless windows integration
  • Generic host/guest communication channels that enables you to control and manage guest execution.
  • Provides Host-Guest time synchronization.
  • Shared clipboard between host and guest vm.
  • Automated logins.

You can read more about these features on the VirtualBox User Manual.

Follow the link below to learn how to install Ubuntu 21.04 on VirtualBox.

Install Ubuntu 21.04 Desktop on VirtualBox

Installing VirtualBox Guest Additions on Ubuntu 21.04

Install Required Build tools and Kernel Headers

Before you can proceed to install VirtualBox Guest Additions, you first need to install required build tools, the Linux kernel headers and the support modules, if not already installed.

Run the command below to verify if these requirements have already been installed.

sudo dpkg -l | grep -E "dkms|linux-headers-$(uname -r)|build-essential"
ii  linux-headers-5.11.0-11-generic   5.11.0-11.12      amd64      Linux kernel headers for version 5.11.0 on 64 bit x86 SMP

The ii means that the package is installed. As you can see from the output, dkms and build-essential are not installed.

You can then install the missing tools by running the command;

apt update
apt install dkms build-essential

If none if these packages is installed, you can simply use the APT package manager to install them.

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

Install VirtualBox Guest Additions

In order to install VirtualBox Guest Additions, you need to have the Guest Additions ISO file. Guest Addition ISO file can be inserted into the VM in two ways;

  1. Insert Guest Additions ISO File Manually
  2. Install Guest Additions ISO Automatically from Ubuntu Repositories using APT package manager.
Insert Guest Additions ISO File Manually

To manually insert the VirtualBox Guest Additions ISO file on your Ubuntu 21.04 VM, navigate to Menu bar on your VM and click Devices > Insert Guest Additions CD image. Note that before you can insert the ISO file, you need to have at least one empty IDE controller.

Install VirtualBox Guest Additions from UI

When inserted, a dialog box which prompts you to run or cancel the Guest Additions installer is launched.

guest additions insert

Click Run to launch the installation of Guest additions on Ubuntu 21.04. You will be prompted to enter your password to authenticate the installation.

Upon successful authentication, the Guest Addition installation will now run.

Once the Guest Additions are installed, Press Enter to close the installation wizard.

Reboot your system to reload the Kernel modules.

If upon reboot the screen do not auto adjust upon login, click on the VM menu View > Auto-resize Guest Display and toggle the option to put the vm on full screen.

Install VirtualBox Guest Additions from Terminal

You can also install the Guest Additions from the terminal. Therefore press cancel when the installer dialog box opens up and the iso image will be mounted on the system.

When the Guest Addition ISO file is inserted, it is mounted on /media/$USER/VBox_GAs_6.x.x. Where x is the build version of VirtualBox.

guest additions image mounted

To install guest additions from the terminal, navigate to the mount point of the guest additions and run the command below;

cd /media/$USER/VBox_GAs_6.1.18
sudo ./VBoxLinuxAdditions.run

or simply run;

sudo /media/$USER/VBox_GAs_6.1.18/VBoxLinuxAdditions.run

Reboot your system to reload the Kernel modules.

Installing Guest Additions ISO from Ubuntu Repositories

It is also possible to install the Guest Additions ISO file from Ubuntu repos.

Guest Additions ISO file is provided by the virtualbox-guest-additions-iso package.

sudo apt-cache policy virtualbox-guest-additions-iso
virtualbox-guest-additions-iso:
  Installed: (none)
  Candidate: 6.1.18-1
  Version table:
     6.1.18-1 500
        500 http://ke.archive.ubuntu.com/ubuntu hirsute/multiverse amd64 Packages
        500 http://ke.archive.ubuntu.com/ubuntu hirsute/multiverse i386 Packages

If it is available, simply run the command below to install it.

sudo apt install virtualbox-guest-additions-iso

When installed, the VirtualBox Guest Additions ISO is now available as /usr/share/virtualbox/VBoxGuestAdditions.iso.

To install it, you need to mount it.

sudo mount -o loop /usr/share/virtualbox/VBoxGuestAdditions.iso /media/

Next, run the installation.

sudo /media/VBoxLinuxAdditions.run

Once the installation is done, restart your system to reload kernel modules.

You should now be on full screen and can be able to enable shared clipboard, shared folders, drag and drop…

ubuntu21.04 fullscreen

NOTE: If upon system reboot the screen doesn’t auto-resize automatically, be sure to toggle (off/on, so to say)  View -> Auto-resize Guest Display on the VM menu bar to set right VM resolution.

Other Tutorials

Install VirtualBox Guest Additions on Kali Linux 2020.3

Install VirtualBox Guest Additions on Fedora 31/32

Install VirtualBox Guest Additions on Ubuntu 20.04

SUPPORT US VIA A VIRTUAL CUP OF COFFEE

We're passionate about sharing our knowledge and experiences with you through our blog. If you appreciate our efforts, consider buying us a virtual coffee. Your support keeps us motivated and enables us to continually improve, ensuring that we can provide you with the best content possible. Thank you for being a coffee-fueled champion of our work!

Photo of author
koromicha
I am the Co-founder of Kifarunix.com, Linux and the whole FOSS enthusiast, Linux System Admin and a Blue Teamer who loves to share technological tips and hacks with others as a way of sharing knowledge as: "In vain have you acquired knowledge if you have not imparted it to others".

Leave a Comment