VirtualBox and Bodhi as Host
Revision for “VirtualBox and Bodhi as Host” created on May 1, 2023 @ 18:59:37
Title | VirtualBox and Bodhi as Host |
---|---|
Content | This page contains information about installing and configuring VirtualBox in Bodhi Linux [library term="version"] It is <em><strong>not</strong></em> a tutorial on how to use VirtualBox, as VirtualBox is a rather complex piece of software.
<h2 id="installation">Installing VirtualBox</h2>
Open your terminal of choice, select one of the two methods below and run the commands stated, typing your password as prompted:
Once complete, unless you have altered your menu, VirtualBox can be run from the menu <strong>Applications→Accessories→VirtualBox</strong>. Note, a kernel module is started when Bodhi is booted, but nothing happens until you manually start a virtual machine.
<strong>Method 1</strong>: Using official Bodhi Linux Repositories
This method will install Virtualbox 5.2.x from the Bodhi Linux Repo. This is the Bodhi community-supported approach.
<pre class="code">sudo apt-get update
sudo apt-get install virtualbox
</pre>
<strong>Method 2</strong>: Using Virtualbox Repositories
This method will install the latest stable version of Virtualbox.
<em>NOTE</em> At the time of writing, the latest version was 6.1.16. Only use this method if you need the latest stable features and/or you need to mitigate issue(s) that are addressed in more recent versions.
<em>Step 1</em>
Create a new repo source list file. Using an editor of your choice (here I'll use Vi Improved), with elevated (sudo) permissions.
<pre>sudo vi /etc/apt/sources.list.d/virtualbox.list</pre>
Then add the following text and save the file.
<pre>deb [arch=amd64] https://download.virtualbox.org/virtualbox/debian [library term="ubuntu-name"] contrib</pre>
<em>Step 2.</em>
Download and add the public keys for the new repo:
<pre>wget -q https://www.virtualbox.org/download/oracle_vbox_2016.asc -O- | sudo apt-key add -
wget -q https://www.virtualbox.org/download/oracle_vbox.asc -O- | sudo apt-key add -</pre>
<em>Step 3.</em>
Install VirtualBox 6.1 (latest version at the time of writing).
<pre>sudo apt-get update
sudo apt-get install virtualbox-6.1</pre>
<!--more-->
<h2 id="mouse">Mouse and Keyboard Integration</h2>
Once one has installed a guest Operating System in VirtualBox, mouse and keyboard events should be communicated to the guest <acronym title="Operating System">OS</acronym> when the focus is on the virtual machine window. However, in some cases particularly with older Operating Systems, the virtual machine can capture the mouse and or keyboard making them unavailable to the Host Operating System and other applications running on the Host. The virtual operating system in this case does not <em>know</em> that it is not running inside another <acronym title="Operating System">OS</acronym> and expects to have complete control over your keyboard and mouse when the virtual machine window is clicked.
As a result upon clicking the <acronym title="Virtual Machine">VM</acronym>, the Host Operating Systems loses control of the mouse and or keyboard, and VirtualBox by default will display the pop-up dialog below. Pressing capture in the dialog below will capture the mouse and keyboard and the Host Operating System will no longer have access to them. It should be noted that not only can this occur with older virtualized Operating Systems but it also can occur when newer Operating Systems are booting up and have not fully loaded, such as for example at <a href="https://en.wikipedia.org/wiki/GNU_GRUB" target="_blank" rel="noopener">grub screens</a>.
<img class=" aligncenter" src="https://www.bodhilinux.com/trial/wp-content/uploads/2015/02/Virtualbox_capture_dialog.png" alt="Mouse and keyboard Virtual Box Dialog" />
In cases like this where the Host Operating Systems has lost control of the mouse and or keyboard, VirtualBox reserves a special key on your keyboard to un-grab the mouse and keyboard and return control to the Host: the <em><strong>Host Key</strong></em>. By default, the Host Key is the right Control key and VirtualBox displays the Host Key in the bottom right-hand corner of the virtual machine window to remind you:
<img class=" aligncenter" src="https://www.bodhilinux.com/trial/wp-content/uploads/2015/02/Virtualbox_host_key.png" alt="VirtualBox Host Key" />
You can change the default settings for the Host key in the VirtualBox Global Settings. Open VirtualBox, click on <strong><span style="text-decoration: underline;">F</span>ile→<span style="text-decoration: underline;">P</span>references</strong>. In the left panel of the Preferences window select <strong>Input</strong>. On the right side of the Preferences dialog click the <strong>Virtual <span style="text-decoration: underline;">M</span>achine</strong> Tab, and listed in that tab is the <em><strong>Host Key Combination</strong></em>. Clicking the <strong>Shortcut</strong> for that combination will allow you to change it.
<img class=" aligncenter" src="https://www.bodhilinux.com/trial/wp-content/uploads/2015/02/Virtualbox_host_key_prefs.png" alt="Changing VirtualBox's Host Key Preferences" />
<h2 id="usb">USB Support</h2>
<h3 id="enable_usb">Enabling Host USB Support</h3>
Using USB devices such as USB drives, SD card readers, Web Cams, printers and other devices in VirtualBox improves the usability of your virtual experience. To enable host USB support, one must download the virtual box extensions pack, add yourself to the user group <em>vboxusers</em> and then install it in VirtualBox. To download this extension pack and add your user account to the user group <em>vboxusers</em>, open a terminal and run the command below. Substitute the version number from the exact version of VirtualBox you're using (from VirtualBox select Help>About to get version number [5.2.10] & build number [93012]
<pre class="code">wget https://download.virtualbox.org/virtualbox/5.2.10/Oracle_VM_VirtualBox_Extension_Pack-5.2.10-93012.vbox-extpack
sudo usermod -G vboxusers -a $USER</pre>
Now save whatever work you need to and close all windows. Log out and log back in to ensure the system reloads your user accounts.
Once you are logged back in open VirtualBox, click on <strong><span style="text-decoration: underline;">F</span>ile→<span style="text-decoration: underline;">P</span>references</strong>. In the left panel of the Preferences window select<strong> Extensions</strong>. Under the <strong>Extension Packages</strong> panel right-click a blank spot on the screen and select <strong>Add Package</strong>.
<img class=" aligncenter" src="https://www.bodhilinux.com/trial/wp-content/uploads/2015/02/VirtualBox_addpackage0.png" alt="Virtual Box Add Package " />
In the File Selection dialog navigate to the location you downloaded the virtual box extensions pack and select it.
<img class=" aligncenter" src="https://www.bodhilinux.com/trial/wp-content/uploads/2015/02/VirtualBox_addpackage1.png" alt="VirtualBox File Selection" />
A dialog will now open confirming you wish to install this VirtualBox extension. Select <strong>Install</strong>.
<img class=" aligncenter" src="https://www.bodhilinux.com/trial/wp-content/uploads/2015/02/VirtualBox_dialog0.png" alt="VirtualBox dialog" />
Since this extension pack is a non-free component of VirtualBox, you need to accept a license before you can install it. In the License dialog which opens, scroll to the bottom and press <strong>I <span style="text-decoration: underline;">A</span>gree</strong>.
<img class=" aligncenter" src="https://www.bodhilinux.com/trial/wp-content/uploads/2015/02/VirtualBox_license0.png" alt="VirtualBox Personal Use and Evaluation License" />
<p style="text-align: center;"><strong><em>I would advise actually reading the License and only accepting if you are comfortable with its terms.</em></strong></p>
Bodhi will now prompt you for your <em>sudo</em> password. Enter it and let VirtualBox install the extension pack. Finally, VirtualBox is now able to utilize the Host USB system.
<h3 id="utilizing_usb">Utilizing Host USB Support</h3>
In order to utilize host USB support in VirtualBox, one must configure your virtual machine(s) to access the USB devices on your host. Here we are assuming you have some guest <acronym title="Operating System">OSs </acronym>installed in VirtualBox, if not create or download one ( see VirtualBox and Bodhi as Guest <strong><span style="color: #ff0000;">TO DO</span></strong> to learn how to create a Bodhi virtual machine in VirtualBox). For this example, we will be using Slitaz as the guest Operating System.
The first step is to enable USB support in the guest virtual machine. Click on <strong>Settings</strong> for your virtual machine, select the USB tab. Check the two boxes and click <strong><span style="text-decoration: underline;">O</span>K</strong>.
<img class=" aligncenter" src="https://www.bodhilinux.com/trial/wp-content/uploads/2015/02/Virtualbox_usb_settings.png" alt="Virtual Machine USB Settings" />
At this point, one may think that is all there is to it, but booting our virtual machine shows no USB devices found. To verify this move your mouse over the USB icon at the bottom of the virtual Machine window as shown:
<img class=" aligncenter" src="https://www.bodhilinux.com/trial/wp-content/uploads/2015/02/Virtualbox_nousb.png" alt="No Usb Devices Found" />
That is because one has to first choose what USB devices are available to your virtual machine in the machines Device settings. Click on <strong>Devices</strong> in your virtual machine's menu and select <strong>USB Devices</strong>. Choose the device you wish to connect to, in this example a Western Digital external Hard Drive.
<img class=" aligncenter" src="https://www.bodhilinux.com/trial/wp-content/uploads/2015/02/Virtualbox_usbdevices.png" alt="Choosing USB Devices" />
Once you have done this, the USB device will be available to your guest virtual machine.
<img class=" aligncenter" src="https://www.bodhilinux.com/trial/wp-content/uploads/2015/02/Virtualbox_mybook.png" alt="Virtual Box My Book" />
<div style="margin-left: 0.5in; margin-right: 0.5in;">
<h3><span style="color: #ff6600;">Note:</span></h3>
<em><strong>Be careful with USB devices like an external hard drive that are in use on the host! You may suffer data loss if your USB hard drive is mounted on your host machine when you try to access it on your guest virtual machine. This can cause the external hard drive to be disconnected from the host without a proper shutdown.</strong></em>
<h3>ProTip:</h3>
You can use VirtualBox's command-line interface VBoxManage to list all the USB devices that are accessible.
<pre class="code">VBoxManage list usbhost</pre>
</div>
<h3 id="usb_device_filters">USB Device Filters</h3>
It is sometimes convenient to configure your virtual machine to automatically connect to a USB device, instead of having to manually add it after the virtual machine has booted. This can be achieved by the use of USB Device Filters.
Again highlight your virtual machine, click on <strong>Settings,</strong> and select the USB tab. On the right side of the <strong>USB Device, Filters</strong> panel click the USB icon that has a <strong>plus</strong> symbol. Select and click the USB device you want your virtual machine to automatically connect to at boot. In this example, the same Western Digital external Hard Drive considered previously will be selected:
<img class=" aligncenter" src="https://www.bodhilinux.com/trial/wp-content/uploads/2015/02/Virtualbox_usb_filter00.png" alt="USB Device Filter" />
After the device has been selected it will be listed and checked under <strong>USB Device Filters</strong> as shown below:
<img class=" aligncenter" src="https://www.bodhilinux.com/trial/wp-content/uploads/2015/02/Virtualbox_usb_filter01.png" alt="USB Device Filter Selected" />
Click<strong> <span style="text-decoration: underline;">O</span>k</strong> to confirm the changes and dismiss the Settings Window. To test simply boot your virtual machine and verify that the <acronym title="Operating System">OS</acronym> has found the USB Device. Depending on the Operating System and the USB device some additional steps may be required before you can use the device. The Windows Operating System, for example, may have a <em><strong>Found New Hardware</strong></em> dialog one has to go through and some Operating Systems may not automatically detect an external hard drive as in this example. If this is the case for you consult the Operating System documentation for your virtual machine.
Fortunately for this example, the virtual <acronym title="Operating System">OS</acronym> does detect the external Hard drive as shown below:
<img class=" aligncenter" src="https://www.bodhilinux.com/trial/wp-content/uploads/2015/02/slitaz_automount.png" alt="Slitaz Automounting My Book" />
<h2 id="guest_additions">Guest Additions</h2>
VirtualBox Guest Additions provide better performance and additional functionality to a guest virtual machine. These improvements include the following and more:
<ul>
<li>Improved Mouse integration</li>
<li>Shared folders</li>
<li>Shared clipboard</li>
<li>Full-screen capacity</li>
<li>Better video support</li>
</ul>
VirtualBox Guest Additions are available for virtual machines running Windows, Linux, Solaris, or OS/2. The Guest Additions are designed to be installed inside a virtual machine <strong><em>after</em></strong> the guest operating system has been installed and are provided as a CD-ROM ISO file which is called <em>VBoxGuestAdditions.iso</em>. As the VirtualBox package in Bodhi's repos does not include the Guest Additions they must be downloaded separately to be made available to your virtual machines. There are several ways of doing this but it is advised to install the guest additions on the Host system (Bodhi) using the repos. Open a terminal on the Host and execute:
<pre class="code">sudo apt-get update
sudo apt-get install virtualbox-guest-additions-iso
</pre>
In Bodhi, the <em>VBoxGuestAdditions.iso</em> will be downloaded to /usr/share/virtualbox/VBoxGuestAdditions.iso
To install the Guest Additions for a particular virtual machine, you mount the ISO file in your virtual machine as a virtual CD-ROM and install it from there. The particular details of how you install the VirtualBox Guest Additions depends upon the Operating System installed in your virtual machine. Consult the documentation of this Operating System for the details.
<h2 id="issues">Common Issues</h2>
There are no known common issues.
<h2 id="info">For More Information</h2>
<ul>
<li><a href="https://manpages.ubuntu.com/manpages/trusty/man1/virtualbox.1.html" target="_blank" rel="noopener">VirtualBox Man Page</a></li>
<li><a href="https://manpages.ubuntu.com/manpages/trusty/man1/VBoxManage.1.html" target="_blank" rel="noopener">VboxManage Man Page</a></li>
<li><a href="https://help.ubuntu.com/community/VirtualBox" target="_blank" rel="noopener">VirtualBox: Ubuntu Documentation</a></li>
<li><a href="https://www.virtualbox.org/manual/" target="_blank" rel="noopener"> The VirtualBox manual</a></li>
<li><a class="http" href="https://www.virtualbox.org/wiki/Community" target="_blank" rel="noopener">VirtualBox Community Page</a></li>
</ul>
<a href="https://www.bodhilinux.com/">Bodhi Linux Home</a>
<a href="https://www.bodhilinux.com/w/wiki/">Bodhi Linux – Wiki Home Page</a>
<a href="https://www.bodhilinux.com/w/bodhi-linux-how-to/">Bodhi Linux – Wiki Table of Contents</a> |
Excerpt |