1. Home
  2. VPS
  3. [HowTo] VirtualBox - Installation, USB, Shared folders ...

[HowTo] VirtualBox - Installation, USB, Shared folders ...

Rsdaa 05/11/2021 122

VirtualBox - Installation, USB, Shared folders

Topics Covered

Host Packages and InstallationBasic Host ConfigurationBasic VM ConfigurationOracle VirtualBox ExtensionsAdvanced VM ConfigurationManjaro Guest InstallationOther Linux Guest InstallationManjaro Guest ConfigurationLinux Shared FoldersTroubleshooting Screen IssuesWindows Guest ConfigurationDisplay issues

1. Host Packages and Installation

Packages to be installed

VirtualBoxVirtualBox Host ModulesVirtualBox Guest Additions ISOOracle VirtualBox Extension Pack

System Firmware

Before you install - reboot to your system and ensure you have enabled virtual extensions in your systems firmware.

systemctl reboot --firmware-setup

Installation

Your current active kernel is found using the mhwd-kernel command (@sueridgepipe note)

$ mhwd -lilinux57

Install virtualbox with the required kernel matching the output from your system.

$ pamac install virtualbox linux57-virtualbox-host-modules virtualbox-guest-iso

You need remember to install kernel modules for every kernel installed on which you intend to use VirtualBox.

Load kernel modules

Prior to using VirtualBox kernel modules must be loaded. Either restart your system or load it manually.

$ sudo vboxreload

2. Basic Host configuration

Your host user must be member of the group vboxusers. The variable $USER below translates to your current logged in username.

$ sudo gpasswd -a $USER vboxusers

Log off to register the change.

3. Basic VM configuration

General

AdvancedShared Clipboard (handy)Drag'n'Drop (don't work)

System

MotherboardBase Memory 2 to 4 GBUntick FloppyTick Enable EFIHardware Clock UTCLinux guest - tickedWindows guest - untickedProcessor

Display

The chosen default display type for any Linux is VMSVGA and this will be good for most distributions.

Use either

Or

Using VBoxSVGA or VMSVGA is a choice. VBoxSVGA will make VirtualBox complain on invalid settings but using VMSVGA your VM will not resize to adapt to changes in window size.

If you want to be sure Manjaro guest will resize correct you must choose the VBoxSVGA display type and ignore the warning.

Selecting VBoxSVGA and 3D will reset your graphics to VMSVGA and 3D.

You can cheat VBox to use VboxSVGA and 3D

Initially create the VM using VMSVGA and 3DSelect the VM in VBoxManagerIn the Display section click VMSVGA and change it to VBoxSVGAStart the VM

4. VirtualBox extensions

The extension pack is a proprietary set of extensions providing useful functionality to VirtualBox like USB2 and USB3 passthrough. The extension pack's PKGBUILD is provided from AUR so we use Pamac to build and install it.

$ pamac build virtualbox-ext-oracle

5. Advanced Guest Configuration

Advanced configuration requires the extension pack to be installed. You can configure USB passthrough for USB-2 and USB-3. You need to configure your guest system to use USB-3 if you have such controller. This is done in the USB Settings menu item. Do not attach any devices on this tab unless you are doing something advanced.

Attach a device

Access the Devices → USB menu in VirtualBox Machine Window or USB menu item in the status bar. Select the USB device to mount in the virtual machine. USB devices

To prevent data corruption on USB devices always sync and unmount USB devices safely.Do not transfer your mouse or keyboard.Do not add filters for your USB devices.

6. MANJARO GUEST installation

Before installation ensure you are using VBoxSVGA graphics.

Graphic drivers are included are included in the kernel and Manjaro installer will use mhwd to install the kernel modules.

Install the guest utilities

$ sudo pacman -Syu virtualbox-guest-utils

7. OTHER LINUX GUEST installation

For best results, Linux as well as Windows guests needs the guest utilities installed. Prefer to use the ISO image provided as other Linux distributions might not have the most recent version of the utilities.

When you have installed the packages continue with Linux Guest Configuration or Windows Guest Configuration.

From the Devices menu of the VirtualBox Guest Window choose Insert Guest Additions CD Image...

On some Linux systems it is required to open a terminal and execute the installer from CLI. Open a file manager, browse to the mounted ISO, use the file manager to launch a terminal then start the installer.

$ ./runasroot.sh

8. MANJARO GUEST Configuration

In the running guest - add the user to vboxsf group. The environment variable $USER translates to the current logged in user.

$ sudo gpasswd -a $USER vboxsf

Enable the vboxservice. The service loads the required modules when run.

$ sudo systemctl enable --now vboxservice

9. LINUX Shared folders

Shared folders requires extra configuration of host and guest. What needs to be done in the guest is a little different depending on the guest operation system. The following works for Manjaro.

Host Configuration

On the host locate the Settings section in VirtualBox GUIShared Folders tabAdd a shared folderSelect the Automount option

Set the folders to Read-only if you plan to use Windows and want to browse insecure websites and other insecure activities. Doing so will prevent an eventual malware/ransomware from spreading to your host.

Guest mounting

After reboot you will need to mount the folders

$ sudo VBoxControl sharedfolders list --automount

The folders can be accessed using /media/sf_sharename

10. Trouble shooting screen issues

If you get issues setting the guest screen resolution, pay attention to the graphics driver selected for the virtual machine as noted by @Teek here and @sueridgepipe here.

Opaque windows

Open Kvantum Manager, select Configure Active Theme and navigate to Compositing & General Look.

Either activate the Disable composite effects or activate Translucent windows. Chosing the latter option please ensure VirtualBox and VirtualBoxVM is included in the list of Opaque apps.

Fullscreen

Changing to fullscreen using the hotkeys - default Right Ctrlf depends on

graphics driver - VBoxSVGAManjaro guest needs vboxservice enabled and runningThe resize of the screen sometimes takes 5-10 seconds to adapt but if it don't adapt - use the hotkey to switch back and forth one (1) time.

Blurred - Distorted - Unreadable dialogs on Windows

If you use Windows and you have unreadable/blank dialogs - disable 3D/2D in the virtual machine graphics section.

If your virtual machine display does not resize correct

Your guest is ManjaroEnsure your graphics driver is VBoxSVGA before installing ManjaroEnsure you have enabled the vboxserviceYour guest is UbuntuEnsure you have the latest available drivers installed in the guest.Your guest is WindowsTry reinstalling the guest utils using the ISO image provided.

The following is not consistent but may depend on your graphics driver.

If you click on the vm window's maximize button or drag using the lower right corner, the vm may not recieve notification on the change in window size. You can expand the window by dragging a border in either direction to have the vm resize correct. Your window size will remembered so you don't have to do it every time.

11. WINDOWS GUEST Configuration

From the Devices menu of the VirtualBox Guest Window choose Insert Guest Additions CD Image...

Insert the guest additions and run the installer in your Windows system.

Restart the guest to make the shared folders available using the Windows Explorer.

12. VirtualBox display issues

Get PDF


PREV: What is Client-Server? Definition and FAQs | OmniSci

NEXT: What is the Client-Server Model? - Definition from WhatIs.com

Popular Articles

Hot Articles

Navigation Lists

Back to Top