VirtualBox/Guest Additions/Ubuntu

Here we install the Guest Additions on an Ubuntu guest system running inside Virtualbox.

This chapter assumes you already have Ubuntu installed in a VirtualBox virtual machine, perhaps using the process described in VirtualBox/Setting up a Virtual Machine/Ubuntu.

(This was tested on Ubuntu Desktop 20.04 LTS as a guest in VirtualBox-6.1 on a Windows 10 host. Other versions and other hosts should work similarly.)


 * 1) Go back to the host operating system. At the top of the "testUbuntu20 [Running] - Oracle VM VirtualBox" window, choose Devices >> "Insert Guest Additions CD image..."
 * 2) (VirtualBox simulates inserting a CD into the simulated optical drive of the VM, and Ubuntu auto-mounts that CD under "/media/a/").
 * 3) When Ubuntu gives the "VBox... Would you like to run it?..." pop-up window, hit "run".
 * 4) Hey, remember that password we wrote on a sticky note earlier? Type it in and hit the Authenticate button.
 * 5) Ubuntu pops up a new terminal window and takes a minute to install and start up "VirtualBox Guest Additions".
 * 6) At this point, with a fresh Ubuntu 20.04 LTS install, it typically says "This system is currently not set up to build kernel modules. Please install the gcc make perl packages from your distribution." If that happens,
 * 7) Inside the Ubuntu 20 VM, open up a terminal with Ctrl+Alt+T . Inside that terminal run:   (What is build-essential? see https://superuser.com/questions/151557/what-are-build-essential-build-dep )
 * 8) (Earlier advice also recommended installing "dkms" and perl, but apparently that is no longer necessary).
 * 9) (Earlier advice also recommended installing gcc and make, but apparently they are already included with build-essential).
 * 10) When the VM starts up again, right-click the CD image on the desktop (if you don't see it, look in the left bar, at the bottom), and Eject.
 * 11) Install the Guest Additions again from the beginning.
 * 12) When there are no errors and the last line of that terminal window says "Press Return to close this window...", click inside that window and press Return.
 * 13) Go back to the host operating system. At the top of the "testUbuntu20 [Running] - Oracle VM VirtualBox" window, most people find it convenient to enable Devices >> Shared Clipboard >> Bidirectional.
 * 14) Shut down the virtual machine from the tiny triangle icon in the upper right corner, the power icon, "Power Off" >> Power Off >> Power Off.
 * 15) Open up the Oracle VM VirtualBox manager. The "testUbuntu20" VM currently has the "Powered Off" icon, right? Select the VM, and hit the green arrow "start" icon.
 * 16) (Now when you look under "/media/a/", the "Guest Additions CD image" is still there -- do I need to do something to "take it out of the (virtual) drive"? If so, how?)
 * 17) (optional) To automagically resize the size of the virtual monitor to fill the "testUbuntu20 [Running] - Oracle VM VirtualBox" window whenever you stretch or shrink that window,
 * 18) At the top of the "testUbuntu20 [Running] - Oracle VM VirtualBox" window, choose View >> Auto-resize Guest Display.
 * 19) When you installed the Guest Additions (as described above), that option should have been enabled. There is apparently two separate bugs that can keep it greyed out even after installing the Guest Additions and rebooting:
 * 20) Some people suggest editing a " " file, but that file apparently no longer exists in Ubuntu14.
 * 21) Some people suggest using apt-get to (re)install guest additions, uninstalling that version, and then re-install the guest additions again from the VirtualBox ISO:
 * 22) Inside the virtual machine, open a terminal window and run " ". Hit "y" to continue.
 * 23) Next, uninstall the guest additions: " ". (We only installed it to pick up a bunch of dependencies; it's probably the wrong version for whatever version of VirtualBox you have running on your host).
 * 24) At the top of the "testUbuntu14 [Running] - Oracle VM VirtualBox" window, choose Devices >> "Insert Guest Additions CD image..." and re-install it, as described above.
 * 25) Reboot
 * 26) wait a minute until the GUI desktop comes up
 * 27) At the top of the "testUbuntu20 [Running] - Oracle VM VirtualBox" window, choose View >> Auto-resize Guest Display.