Linux Format

VirtualBox

Enjoy a gentle introducti­on to the world of virtual boxes with the aptly named VirtualBox.

-

Making your first virtual machine is easy – the hardest part is deciding which platform to use. VMWare and VirtualBox provide free tools for all operating systems (including Linux). On Windows you can use Hyper-V which, with its new Quick Create feature, can spin up an Ubuntu instance faster than you can say “Microsoft’s patent practice evolving in lock-step with the company’s views on Linux and open source more generally”. We’re going to go with VirtualBox because it’s licenced under the GPL version 2 (except for the Extension Pack which provides features like USB passthroug­h and NVMe devices, not to be confused with the Guest Additions which are now GPL’d too) and because it looks the same on all OSes. Follow the stepby-step guide (below) to getting started, or if you already know the ropes then read on and delve into some of its lesser-known features.

Virtual tweaks

Let’s assume you’ve followed our guide, booted the install medium and installed Ubuntu into your Virtualbox. If not, perhaps you should – just as in the real world, live OSes are much slower than installed ones in the virtual world. When the VM starts you’ll see a message about mouse pointer integratio­n. This is a terribly helpful feature that enables seamless mouse movement between guest and host. When you use guest OSes that don’t support this feature, it’s necessary to use a keyboard shortcut (right-Ctrl) to free the pointer from its imprisonme­nt within the guest window.

The default Virtualbox settings work fine for installing most Linux guest OSes, but there’s always room for improvemen­t. The first thing you probably noticed is that the VM has a low resolution and that moving/resizing windows is painfully slow. This is because our virtual video card has a paltry 16MB of memory and no accelerati­on features. We’ll need to shut down the VM to address this. Once that’s done, select the VM from the list on the left and hit the Settings button in the toolbar and proceed to the Display section. Here you can define

the specificat­ions of the virtual video card. In order to display higher resolution­s at higher colour depths, it’ll need more video memory. With the default settings, this uses system RAM rather than video RAM, so you can probably spare at least 64MB here. It’s actually possible to set this higher than the slider allows using the

VboxManage command line tool. More on that later… Modern desktops, despite appearing on a twodimensi­onal surface, all use some kind of 3D accelerati­on (be it OpenGL, OpenGL ES, or latterly Vulkan) to move windows around and draw nice shadows beneath them. By clicking the Enable 3D accelerati­on box we let our VM pass these primitives more or less directly to the host’s video card, as well as access its video RAM directly. So if you’re using onboard graphics (or a very old and short of VRAM graphics card) make sure you don’t over-allocate here. It’s tempting to click the 2D accelerati­on box too, but that’s only for DirectDraw accelerati­on on Windows guests.

We can also accelerate the CPU side of things. The default settings allocate only a single thread to running the guest OS; this is pretty painful in a world that takes multitaski­ng for granted. So select the System section on the left and choose the Processor tab. You can allocate as many virtual CPUs to the guest as threads the host machine is capable of running (so twice the number of cores if your processor supports HyperThrea­ding or whatever AMD call it nowadays). Again, if you allocate too much CPU to the guest, then the host will suffer, which in turn will cause the guest to suffer. A reasonable rule of thumb is to not allocate more than half the available CPU resources. It’s also possible to set an execution cap, so that the VM can’t max out an entire core on the host, which can help for some misbehavin­g workloads.

Some operating systems require the Enable PAE/NX box, which would enable 32-bit VMs to access more than 4GB of memory. If you’re setting up an Ubuntu Server guest (and you admit as much in the Machine Type and Version boxes), this gets ticked automatica­lly. Moving to the Accelerati­on tab you should find that the the VT-x and Nested Paging boxes are both checked. It’s not officially recommende­d to tick Use Host I/O Cache for our virtual hard disk. This turns off the dedicated Virtualbox cache and uses the host OS one, but has been reported to speed up I/O intensive tasks, in particular OS installati­on and package updates. We won’t cover setting up a Windows VM here, but if you want to, you’ll probably have to experiment a little to get things running smoothly.

share out resourCes wisely “If you allocate too much CPU to the guest, then the host will suffer, which in turn will cause the guest to suffer”

 ??  ?? The shared clipboard option enables the luxury of copying and pasting between guest and host. Small caveat: this doesn’t share the X middle-click clipboard, just the desktop one.
The shared clipboard option enables the luxury of copying and pasting between guest and host. Small caveat: this doesn’t share the X middle-click clipboard, just the desktop one.
 ??  ??
 ??  ?? Many Linux distros now include the guest additions, which enable the helpful features described here. But occasional­ly you’ll need to install them in the guest manually.
Many Linux distros now include the guest additions, which enable the helpful features described here. But occasional­ly you’ll need to install them in the guest manually.

Newspapers in English

Newspapers from Australia