How to install virtualbox guest additions on ubuntu?

How to install virtualbox guest additions on ubuntu?

This tutorial assumes that your host operating system is windows 10.

  • Open https://download.virtualbox.org/virtualbox/<virtualbox_version> in your browser by replacing <virtualbox_version> with the version of virtualbox.

  • Click on the .iso file for your virtualbox version (e.g. VBoxGuestAdditions_7.0.12.iso) to download it on windows host.

  • Open Virtualbox UI and press ctrl + D or navigate to File -> Tools -> Virtual Media Manager.

  • Click on Optical disks tab, right click in the window and select Add... option. Select the downloaded .iso file in one of the previous steps.

  • Make sure your virtual machine is turned off.

  • Select your virtual machine in virtualbox and click on Settings.

  • Select Storage in the left menu, click on + icon against Controller: IDE and select the iso file from virutal media manager.

  • Start ubuntu vm.

  • SSH to ubuntu vm, execute blkid command and select the device (e.g. /dev/sr0) from the list which has VBox_GAs in the value of LABEL key –

  • Start ubuntu vm.

  • SSH to ubuntu vm, execute blkid command and select the device (e.g. /dev/sr0) from the list which has VBox_GAs in the value of LABEL key -

/dev/sr0: BLOCK_SIZE="" UUID="" LABEL="VBox_GAs_7.0.12" TYPE="iso9660"
  • Mount this device to a folder under /mnt folder –
sudo mount /dev/sr0 /mnt/cdrom
  • Execute following commands to install guest additions –
sudo -i
apt install bzip2 tar gcc make perl
cd /mnt/cdrom
sh ./VBoxLinuxAdditions.run
  • Make sure the output of last command end with following lines (it may show different kernel version in your case) –
VirtualBox Guest Additions: Building the modules for kernel 5.15.0-91-generic.
update-initramfs: Generating /boot/initrd.img-5.15.0-91-generic
VirtualBox Guest Additions: Running kernel modules will not be replaced until
the system is restarted or 'rcvboxadd reload' triggered
VirtualBox Guest Additions: reloading kernel modules and services
VirtualBox Guest Additions: kernel modules and services 7.0.12 r159484 reloaded
VirtualBox Guest Additions: NOTE: you may still consider to re-login if some
user session specific services (Shared Clipboard, Drag and Drop, Seamless or
Guest Screen Resize) were not restarted automatically
  • Stop ubuntu vm.

  • Select ubuntu vm in the virtualbox UI, navigate to Settings -> Shared Folders and add a folder from your host here. Here are sample values for a folder c:\folder1

    • Folder path – c:\folder1

    • Folder name – folder1

    • Mount point – Leave it blank

    • Check all Read-Only, Auto-mount and Make Permanent checkbox.

  • Start ubuntu vm.

  • To find where ubuntu has mounted has host folder, you can execute following command –

sudo find / -name *folder1*

Did you find this article valuable?

Support MechCloud by becoming a sponsor. Any amount is appreciated!