VirtualBox is a virtualizer for x86 and amd64/intel64 hardware, that is, it allows one to run a guest operating system under a host operating system. On this page the focus is on Debian GNU/Linux as the guest operating system.
If you have problems getting VirtualBox to work, an open-source alternative is QEMU, which I haven’t tried. Another alternative for Linux is KVM. Another alternative is VMWare Workstation Player, which is a commercial product that is free of charge for personal non-commercial use. It is available for MS Windows and for Linux; VMWare Fusion is available for the Mac but is not free of charge.
Windows Subsystem for Linux is another possibility for running Linux applications under MS Windows. It is available under Windows 10. It is intended mainly for developers, and apparently there are (or were) stability problems when using graphics.
VirtualBox is not included in Debian 9 (Stretch) but
can be installed from stretch-backports
or directly from virtualbox.org
.
This page mostly assumes that the guest operating system is Linux.
Installation of VirtualBox is straighforward.
One stumbling block
is that you may see a message like the one on the right, about
‘Missing Dependencies’ related to Python.
The message doesn’t make it clear whether or when
the Python bindings are necessary.
Apparently you only need them
if you want to write Python programmes for handling VirtualBox
virtual machines
(ref).
If you’re not going to be doing that, click on
to proceed with the installation.
In the VirtualBox Manager, do Debian-11-64
, or whatever you like).
In the next windows:
If you immediately get a Killed
or
Segmentation fault
error message
when you try to run a programme in a guest operating system,
you may need to
increase the amount of memory
allocated to the virtual machine. The amount of memory
can be changed by shutting down the virtual machine and doing
.
.vdi
file
with a default location under
a directory called VirtualBox VMs
in your home directory.
The virtual disk doesn’t normally have to be very big because your data files and other non-system files can be (and usually should be) stored directly in the file system of the host operating system (see Sharing below), so in most cases you can accept the default size of 8 GB, or perhaps set it to 10 GB for extra leeway. However, if you need to install a lot of software or big software (e.g., finite-element software) on the virtual disk, you should create a larger disk. If you have lots of free disk space, you may want to create a somewhat larger virtual disk just so it doesn’t gradually fill up over time.
It is non-trivial but possible to later increase the size of the virtual disk (see Resizing below).
Files can be extracted from a .vdi
file using
7-Zip.
Display
, for the graphics controller there
is a choice between VBoxVGA and
newer VBoxSVGA (for Windows guests) or VMSVGA (for Linux guests).
As of 2019 Apr, the default VMSVGA for Linux guests was buggy (or at least
my software didn’t work properly with it) so VBoxVGA needed to
be selected.
As of 2020 Jun 15, my software seems to work with VMSVGA.
As of 2020 Aug 29, the use of VMSVGA causes an error message sayingFailed to send host log message
When a new virtual machine is started the first time, you will be prompted
for the location of a virtual or physical optical drive from which to
boot or install the guest operating system. For example,
browse to where you’ve downloaded and stored a
CD .iso
image file
on your host computer.
Follow the usual installation procedure for the guest operating system. If you plan to use AudiLab software, follow this installation procedure. Then install the VirtualBox Guest Additions.
Guest Additions are additions to the operating system that has been installed as a VirtualBox guest. The additions provide important features such as access to directories and files on the host from within the guest operating system; mouse pointer integration; shared clipboard and drag-and-drop between host and guest; automatic resizing of the guest desktop when its host window is resized; and ‘seamless’ mode ( in the guest). Guest Additions may be necessary for proper functioning of the mouse and keyboard when the host operating system is macOS.
To make sure you have the required packages for adding the Guest Additions,
open a terminal window
in the virtual (guest) machine
by doing
Give the command
sudo apt install make gcc dkms build-essential perl
linux-headers-amd64
Enter your password when requested, to enable sudo
,
then type Y and Enter when asked
whether to continue or not.
(These packages may not be available to you if you have not
specified a download mirror
in your /etc/apt/sources.list
file.)
The architecture specification amd64
in the package name linux-headers-amd64
may not be appropriate for you.
The output of the command uname -r
can be used
in place of amd64
in the package name.
Once you’ve installed these packages, it may be necessary to restart the virtual machine before doing the next step.
A procedure (the best one?) for installing Guest Additions in a Linux
guest:
If a virtual CD called something like
VBox_GAs_n.n.n
doesn’t already appear on the desktop
of the the Linux guest, then
in the VirtualBox window of the running guest machine do
; if you see a message
saying ,
click on .
To ensure that no disk is present in the virtual optical drive,
you can shut down the virtual machine by doing
in the
VirtualBox menu, or
in the Linux menu.
Then in the VirtualBox Manager window,
under ensure that it says
;
if it doesn't, click on
and use ,
then restart the guest machine.
Then do
.
A virtual CD should appear
in the menu
(e.g., VBox_GAs_n.n.n
)
and possibly on the desktop.
If that doesn't work, try
.
You should see
as ‘Attached’; select it and
click on .
If necessary, click on
If a window pops up saying
You have just inserted a medium … Choose what
application to launch.
, you can just select
and
click on .
In a terminal window
(e.g., )
do
cd /media/cdrom
(If you already had a terminal window open, you may need to open a new one
to be able to see the contents of the CD.)
If that doesn’t work, you can determine the correct directory for
the guest additions by double-clicking on the CD icon on your desktop.
For example, you may need to do something like
cd /media/username/VBox_GAs_n.n.n
Once you’re in the correct directory, do
sudo sh ./VBoxLinuxAdditions.run
and wait while it works. Check the output carefully to determine whether
the process was successful or not.
After successful completion of VBoxLinuxAdditions.run
,
restart the guest machine. One method is to give the command
sudo shutdown -r now
.
Alternatively, do
then
restart the guest machine.
The Guest Additions must have been installed.
To add a shared folder:
Powered Off
, select it in the
column at the left in the VirtualBox Manager
window.
Folder Path
of the
drive or folder that you want to share and select it.
Folder Name
(i.e., a ‘share name’) or specify a new one.C:\
as the Folder Path
and keep
the default Folder Name
of C_DRIVE
.Users/
directory
and use Host
as the name.
mkdir
command to create an empty directory that will
be used as the ‘mount point’. For example, in your
home directory:
mkdir HostC
mkdir Host
mount
command (with sudo
because it requires root privileges)
to manually mount the shared drive at the mount point.
For example,
sudo mount -t vboxsf C_DRIVE HostC
under MS Windowssudo mount -t vboxsf Users Host
under Mac OSbin/
in your Linux
home directory and edited to match your setup.
vboxsf
group. This can be done with the commandsudo usermod -a -G vboxsf username
username
is replaced by the user name you’ve
defined for yourself. You need to logout
of the guest machine and log back in
for this to take effect.
You can use the groups
command to check that
vboxsf
is listed among your groups.
If it is not, waiting for 20 seconds or so
may help, or you may need to shut down the guest machine
and start it up again
(ref).
/media
as something like
/media/sf_C_DRIVE
. For convenience, you can define
a ‘symbolic link’ in your home directory
with a command something likeln -s /media/sf_C_DRIVE HostC
HostC
in your home directory.
HostC
, so when browsing for files
in that software
it will be necessary to use the path
/media/sf_C_DRIVE
explicitly.
The Guest Additions must have been installed.
To enable the sharing of clipboards between guest and host, do
. Under select or one of the other options. You can also enable between guest and host here.CD’s and DVD’s are made available to the guest operating system
using Oracle VM VirtualBox Manager
window and using
in the
Oracle VM VirtualBox
window of a running guest operating system.
Real disks can be used in the host’s physical CD/DVD drive,
and .iso files can be used as virtual disks.
Under Windows 7, VirtualBox makes a network connection that appears,
at least in my case, as an Unidentified network
that is
shown as having no network access but which works fine. In one case,
after upgrading VirtualBox the network connection did not work. I
fixed it by disconnecting and reconnecting the network using
.
See this overview of networking in VirtualBox. There are more details in virtual-networking chapter of the VirtualBox manual.
The guest machine can be powered off using
. The three options are provided:It is possible to increase (but not decrease) the size of an existing virtual disk (e.g., refs 1, 2, 3). The following instructions are for VirtualBox 6.1. They make a lot of assumptions and ignore a lot of alternatives.
.iso
CD image file to download.
.iso
file that you downloaded
(e.g., gparted-live-1.1.0-5-amd64.iso
.
Click
and then .
VBoxGuestAdditions.iso
),
then click on the CD icon (at the right in the
section)
and select the GParted .iso
that is listed
in the pop-up menu. The name of that .iso
file
should now appear under .
Click on .
sda1
) and a 2-GB swap partition
(sda5
nested inside sda2
),
which was enlarged to 20 GB in an earlier step.
We could create a separate new partition to use the newly available
space. However, since the swap partition doesn’t contain
anything valuable, it’s easy to work around it and
extend the sda1
partition:
sda5
first and then sda2
) and then recreated after
sda1
has been extended.
sda2
to the end of the disk;
(2) moving sda5
to the
end of sda2
; and then
(3) resizing sda2
by moving its start up against the start of sda5
.
sda1
can then be extended.
The newly created partitions will get temporary names
until you actually apply your changes, at which point
they’ll get names of the form
/dev/sdan
.
To avoid small 1- and 2-MB bits of unused space, and also avoid
certain error messages, the partition alignment can be changed
to sda1
except to
extend it.
As you specify changes, they’ll be listed at the bottom of the GParted window, and they can be undone. Once everything looks right, click on the green checkmark icon to apply the changes. Before you do that, convince yourself that you’ve backed up anything on the virtual disk that you don’t want to lose, in case something goes wrong.
A start job is running for /dev/disk/by-uuid/…
sudo swapon -s
(or sudo swapon --show
)sudo blkid | grep swap
more /etc/fstab|grep swap
/etc/fstab
.
First make a backup copy using the commandsudo cp -p /etc/fstab /etc/fstab_old
nano
editor:sudo nano /etc/fstab
nano
,
saving the modified file.
Hopefully the delay when rebooting will no longer happen.
As of 2015 Mar 29 I have a problem with my Windows 7 running out of
memory and requiring me to shut down applications.
It’s probably related to this
Wacom forum posting (dated 2014 Nov 19) about a memory leak in
the Wacom Bamboo driver when VirtualBox is running, even if the
device isn’t being used. At this moment, for example, Pen_Tablet.exe
has a Working Set size of ~1.8 GB and growing.
The problem seems to have arisen for me only in the past few weeks.
With the Task Manager I cannot directly kill
the process Pen_Tablet.exe, nor stop the service TabletServicePen directly
by right-clicking, but I could stop it by using the Services
button, at which point the memory was released.