How to install virtualbox guest additions on linux

How do I install Guest Additions in a VirtualBox VM?

I’ve recently installed Ubuntu on Oracle’s Virtualbox. Now I want to install the guest additions. I started up my Ubuntu guest OS, clicked «Devices» and chose «Install Guest Additions». Nothing happened, and I don’t see the CD icon on my desktop. How can I make this work?

13 Answers 13

If you have trouble installing Ubuntu in a VirtualBox VM, because the installer window does not fit the low resolution screen size, you can move the window with Alt + F7 .

Installing Guest additions from the repositories

In case we have installed the OSE edition of Virtual Box from the repositories we can add the guest additions from the repositories in the guest. This will install guest additions matching the Virtual Box version as obtained from the repositories. It is not recommended to install these in newer releases of Virtual Box as obtained from the Oracle repository (see below).

Alternatively we can install the package virtualbox-guest-additions-iso in the host Ubuntu.

sudo apt-get install virtualbox-guest-additions-iso 

The .iso file with an image of the OSE edition of the guest additions CD will install in the host directory /usr/share/virtualbox/VBoxGuestAdditions.iso . Mount this .iso file as a CD in your virtual machine’s settings. In the guest you will then have access to a CD-ROM with the installer.

Installing Guest Additions from Virtual Box Manager

Install build-essential

In case the Guest Additions fail to build we may have to install the Linux kernel headers (see How do I install kernel header files?) or build-essential tools in addition. It is also recommended to have dkms installed (see below — Note 4). You can run this command in a terminal to install both:

sudo apt install build-essential dkms 

Selecting Devices -> Install Guest Additions (or press Host + D from the Virtual Box Manager) the Guest Additions CD .iso will be loaded but not installed in your guest OS. To install we need to run the installer script VBoxLinuxAdditions.run as root or from the Autorun Prompt (see below).

GNOME Shell

To install the Guest Additions we will have a CD icon on our desktop as soon as the virtual drive is mounted:

Читайте также:  Does file exist linux

enter image description here

Next step is to run the autorun.sh script (as root) on this mounted CD by opening the drive and clicking on the «Run Software» button. This will build and install the vbox kernel modules needed.

Unity

The guest additions is mounted as a virtual CD visible on the launcher:

enter image description here

In case the system is set up to autorun a CD it should just open the following autorun dialogue (if not select the CD symbol, choose open, then choose Open Autorun Prompt)

enter image description here

After having entered your credentials for root access the guest additions will build as seen from the terminal output:

enter image description here

Press Return to close the terminal.

Note 1
Guest Additions need a reboot of your guest OS to take effect.

Note 2
In some systems the Virtual Box Guest Additions CD icon may not be shown on the desktop, but will be accessible from the Places menu. If the CD still was not there you may have to manually add the VBoxGuestAdditions.iso as a CD-ROM in the Virtual Box Manager Storage menu. In an Ubuntu host the disk image is in /usr/share/virtualbox/VBoxGuestAdditions.iso .

Install gcc

Note 3
In some systems (e.g. when running Xubuntu guests) we may not have an Autorun Prompt for the mounted CD. Then we can install the guest additions by opening a terminal on the mounted guest additions .iso to run sudo ./VBoxLinuxAdditions.run . In Lubuntu or Ubuntu Server guests we additionally need to install the GNU C compiler (gcc ) and the make utility in the guest system to be able to compile the guest additions.

Note 4
Running DKMS in the guest OS will keep Guest Additions installed after a guest kernel update. It is not a prerequisite for Guest Additions but if used it should be installed before we install the Guest Additions.

Installing Guest Additions from a Terminal##

In case Guest Additions are not installed properly we may not be able to boot to the GUI. In this case we need to boot holding the Shift key to access the Grub menu where we access a root shell as depicted in the following question (we do need to mount the filesystem read/write to proceed):

The Guest Additions .iso file needs to be installed on /dev/cdrom from the Virtual Box Manager (see above). We then may install Guest Additions by typing the following commands:

mount /dev/cdrom /mnt # or any other mountpoint cd /mnt ./VBoxLinuxAdditions.run reboot 

Remove Guest Additions

In case something went wrong with installing the guest additions, or the guest OS can not boot after installing we may have to remove the additions. This can also be done from a root shell by running an uninstallation script located in the guest /opt directory.

Replace x.x.xx with your current version of guest additions.

Источник

How to Install VirtualBox Guest Additions for Linux

VirtualBox is virtualization software which can run different operating systems on a single host machine. With the help of VirtualBox, you can create virtual machines (VMs) and install different operating systems, such as Windows, Linux, and macOS.

Читайте также:  Ноутбука для linux mint

However, running a guest operating system on a virtual machine without Guest Additions can be a challenging experience. That’s where VirtualBox Guest Additions come in. In this article, we will guide you on how to install VirtualBox Guest Additions for Linux.

Content for this article includes:

What are VirtualBox Guest Additions

VirtualBox Guest Additions are a set of drivers and applications that improve the performance and functionality of a virtual machine. Guest Additions are designed to optimize mouse integration, display resolution, shared clipboard, and other essential features that are required to run a guest operating system smoothly.

How to Install VirtualBox Guest Additions on Linux

To install VirtualBox Guest Additions for Linux, follow these steps:

1: On Ubuntu and Debian

Installing Guest Additions on Ubuntu and Debian in VirtualBox is a simple process that involves mounting the Guest Additions ISO image, running the installation script, and restarting the virtual machine.

Mount VirtualBox Guest Additions ISO Image

To install VirtualBox Guest Additions on Linux, you first need to download the ISO image containing the software. Open VirtualBox and start the virtual machine with the guest operating system you want to install VirtualBox Guest Additions on.

In the VirtualBox menu, go to Devices > Insert Guest Additions CD Image. By doing this step we can mount Guest Additions ISO image as a CD/DVD drive inside the guest operating system.

How to Install VirtualBox Guest Additions for Linux

After you have mounted the VirtualBox Guest Additions ISO image, you can proceed with the installation of the software. Follow the steps below to install VirtualBox Guest Additions on Linux:

Open a terminal window and update the existing packages first.

Now install the prerequisite packages for virtual box using the command:

Now the Guest Addition Iso file is loaded in the system but not installed. Now this can be installed using the GUI or terminal.

To install it from GUI desktop, open the CD mount directory and select the autorun.sh file. Select and run this file as a program. This will install Virtual box guest addition in the system.

Second method is using the terminal window.

Navigate to the directory where the VirtualBox Guest Additions ISO image is mounted using the command:

After opening the directory list all files present there using ls command:

Use the below command to run the auto installer file:

This will begin installation of Guest Additions in the new Terminal window:

Or run below mentioned command to start the installation:

After you have installed VirtualBox Guest Additions on Linux, you should test if it was installed correctly. Run the following command:

2: On Arch-Based Distros

Compared to other Linux distributions, the process of installing VirtualBox Guest Additions on Arch and Manjaro is simple. This is because these two distributions offer the convenience of installing the VirtualBox-guest-utils package directly from the official Arch repository, eliminating the need for a manual installation using a disk.

Читайте также:  Настройка wifi linux manjaro

The Arch-based Linux distributions come pre-installed with the Guest Additions package for virtual machines. However, if your distribution does not have this support, you can begin by updating the package sources on your system using the command:

Now install VirtualBox-guest-utils package using the command:

Finish the setup by rebooting the system.

3: On Fedora, CentOS, and RHEL

The VirtualBox Guest Additions is by default present on the Fedora system. Using this we can adjust the resolution and size of the VirtualBox window. It also enables the clipboard synchronizing between both host and virtual machine.

Fedora on VirtualBox has Guest Additions preinstalled, enabling you to scale VM resolution, share clipboard with the host, and share files via drag-and-drop.

But in case of other RPM-based distributions, mount and install the Guest Additions CD image manually as we did with the Ubuntu and Debian based system.

Or, open the folder and click “Run Software”. Enter the administrator password to complete installation. Once installed press Enter to exit.

How to Uninstall VirtualBox Guest Additions on Linux

Removing VirtualBox Guest Additions is easy and harmless, but if you’re unsure if they’re gone, resize the VM window and try copying text to see if it works. If it doesn’t, Guest Additions have been removed.

1: Uninstall VirtualBox on Ubuntu and Debian

On Ubuntu and Debian systems first change the directory to /opt/VBoxGuestAdditions-[version]. In case you have no idea of version then write command till “Additions” and press tab it will automatically get completed:

Then uninstall using the following script:

Restart system to save changes.

2: Uninstall VirtualBox on Arch Linux and Manjaro

To uninstall VirtualBox Guest Additions on Arch Linux systems like Manjaro use the Pacman command to remove the virtualbox-guest-utils:

3: Uninstall VirtualBox on Fedora and Other RPM-Based Distros

To uninstall Guest Additions on Fedora run following command:

In case of manual installation of Guest Additions, open its directory and run uninstallation script. Remember to change the directory by typing cd command:

Hit Tab key on keyboard if you have no idea about the version of Guest Addition.

After that run following script:

At last restart the system to verify and save changes.

Conclusion

Installing VirtualBox Guest Additions for Linux involves mounting the Guest Additions ISO file and running the installation script. This will provide additional functionality and performance improvements to the virtual machine. This article covers all steps needed to mount and install the VirtualBox Guest Addition in all main Linux systems.

About the author

Kashif

I am an Electrical Engineer. I love to write about electronics. I am passionate about writing and sharing new ideas related to emerging technologies in the field of electronics.

Источник

Оцените статью
Adblock
detector