How to install VirtualBox guest additions on Ubuntu 22.04 VM command line?

VirtualBox install guest additions ubuntu command line guide

CodeTryout provides version specific articles to install VirtualBox guest additions installation steps. vbox guest additions Ubuntu 22.04 and vbox guest additions Ubuntu 20.04. Please choose the article according to your Ubuntu version.

This is a quick installation guide for installing VirtualBox Guest Addition ( Oracle VirtualBox extension pack ) on Ubuntu 22.04 VirtualBox VM.

What are VirtualBox Guest addition packages?

VirtualBox guest additions are software tools installed in the guest VM after installing the OS. They consist of device drivers and system applications that improve the guest VM performance and usability. They enable features such as drag and drop, shared folders, changing screen resolutions, copy-paste clipboards, automated logins, etc. Please refer to the complete guide here:

Step #1: Preparing your Ubuntu VM with the required packages

Firstly, you would need to install some dependency packages:

  • gcc
  • make
  • perl

Install all those pre-requisites using the single command below,

sudo apt install gcc make perl

Enter your user password and give y when prompted for confirmation to continue.

Step #2: Insert the guest addition CD image

You can do this virtually from your VirtualBox VM window. Go to Devices Menu and Click on Insert the guest addition CD image (.iso). This will mount the VirtualBox guest addition Virtual CD Disk to your Ubuntu Guest OS.

Step #3 Running the installer

  1. Open a command-line terminal
  2. Run the command: sudo bash /media/$USER/VBox_*/ (given below),
  3. Enter the password if prompted,
  4. After installation, reboot the system.
sudo bash /media/$USER/VBox_*/

If you are unsure of the path mentioned above, try the command: df -kh | grep VBox

In this case, your script path would be:

bash /media/devops/VBox_*/

Reboot your Ubuntu to make these changes in effect.

Step #4 Verifying whether the VBox addition is installed successfully.

As a final step or to troubleshoot, you can verify whether your VBox addition steps were successful by running the following command

lsmod | grep vbox

A successful installation would display the output of the command as shown here:

checking whether VBox additions are installed in Ubuntu Linux

VirtualBox Guest Addition features

You have successfully installed the guest addition software. With this, you will have some handy features like:

  • Enabling Shared-Clipboard – copy-paste between guest and host ( Detailed guide to enable copy paste )
  • Enable Drag and Drop – you would be able to drag and drop files between guest and host
  • Set custom screen resolution for the Ubuntu Guest (shown in the below image)

This guide has covered the steps to install VirtualBox Guest Addition on your guest machine. These steps have been tested on Ubuntu 22.04 and should also work for previous Ubuntu distributions.


This guide covered installing guest additions in a VirtualBox Virtual Machine running Ubuntu 22.04. Once you have installed the guest addition packages, you will have all the additional features VirtualBox provides.


FAQ: Installing guest addition on VirtualBox Ubuntu Desktop

All these steps will work on the Ubuntu command line, tested using Ubuntu-22.04-desktop-amd64

FAQ: Installing guest addition on VirtualBox Ubuntu Server

VirtualBox Ubuntu server installation may not require guest additions; if you need them for any specific reason, the steps given above should work.

FAQ: Installing guest additions in older versions of Ubuntu, such as Ubuntu 20.04?

Codetryout has another page explaining the steps required for VirtualBox guest additions on Ubuntu 20.04 VM

FAQ: How to enable Clipboard copy-pastes between Virtualbox Host and guests?

We have an experiment explaining this, please refer to How to enable copy-pastes in Virtualbox Ubuntu VM

FAQ: How do enable files or folders copy-pastes between Virtualbox Host and guests?

Yet again, we have another experiment explaining this. Please refer to the guide: How to enable files to drag and drop in a VirtualBox running Ubuntu Linux?

FAQ: What are the latest changes and features added to VBox Guest addition packages?

You can check this page for the detailed changelog: VirtualBox User Manuel – ChangeLog

Related: How to install Ubuntu 22.04 VM using the VirtualBox 7 unattended method