From Mageia wiki
Jump to: navigation, search


Drakconf multiflag.png
Other languages
Deutsch ; English ;
Synopsis:
VirtualBox.png VirtualBox is one of a number of hypervisors that allow you to run virtual machines on a Mageia system.
It is probably the easiest to start with, and is often chosen for desktop use.
For alternatives, see Virtualisation.

What to install

On the host

On your host, install the virtualbox package, and it will by dependency also pull in dkms-minimal and the virtualbox-kernel (The VirtualBox kernel module​) matching the kernels you have installed, and virtualbox-kernel-latest so it gets updated automatically in the future.

If you use a kernel flavour other then desktop or server (desktop586 or linus) that does not have a pre-built kernel module, or you are testing kernel updates for the QA team, which do not always have the pre-built kernel modules, then you should install dkms-virtualbox - which builds the kernel module locally, and for that you also need kernel-*-devel matching the kernel versions and flavours you have installed.

Oracle extension pack (optional)

In VirtualBox version 7, in current Mageia, you do not need the Oracle extension pack to get USB2, USB3, EHCI or XHCI support, as all of the USB support is integrated in the free version. For VirtualBox 7, you only need it for: VirtualBox RDP, disk encryption, NVMe and PXE boot for Intel cards.

VirtualBox extension pack from Oracle is required if you need support for i.e USB2 & USB3 (before VirtualBox 7), PXE, multiple vCPUs, and a number of other features. However, this pack comes with a license agreement and is not shipped as part of Mageia.

You must find an extension pack with the same version number as VirtualBox. On the download page you will find latest versions, plus older, and also read the info there.

Installing the Oracle extension pack

After downloading the oracle extension pack, install the pack from the VirtualBox Manager, in menu File -> Settings -> Addons.

Don't forget to add yourself (user running VirtualBox Manager on host) to user group vboxusers in order to get access to USB2 etc. Applying this rights may require a restart of your host.

On guests

On the guest, if it is Mageia, make sure virtualbox-guest-additions is installed. Mageia installer normally detects if it is run inside VirtualBox and installs it automatically, but check! This provides the guest with the ability to share files and sync time with the host. Also, you need to add the guest system user to group vboxsf if you want folder sharing with host to work (or else only root can access them).

For Microsoft Windows guests, after install, in the running guest virtual screen window: menu Devices -> Insert CD image of guest additions, and have the guest install it. (VirtualBox may download it automatically from Oracle if needed.)

Reaching Documentation

The VirtualBox home web page

The online user manual is really good. You should browse the Table of Contents.

The VirtualBox forum have some tutorials.

Tips

Physical Main Board BIOS setting

Don't forget to check your main board BIOS have the setting (if any) for virtualisation enabled.

In the Host system

Add your user to the group vboxusers (for USB2/3 and more - requires extension pack)

In VirtualBox Manager

Creating the virtual machine

Most is self-explanatory, just select a name, go to defaults.

The virtual drive

Hint: Dynamically allocated drive = the size of it on your disk only grows as necessary up to the given limit, so you can create a "200 GB" drive as seen by the guest, but it only consumes a few GB after installing the guest. If you delete a lot of files in the guest it will not shrink much, however, but there is a trick to do that: in guest clear unused space, and then let VirtualBox compress it.

Settings on the virtual machine

Look around at the settings... I like this:

  • clipboard:bidirectional
  • drag'ndrop:bidirectional
  • Shared folders: share /home, auto-mount, permanent
  • for installing the guest system, attach the installer ISO file (install DVD / Live DVD / network install boot.iso) to a virtual CD drive

Everything else is probably good as is by default and all can be changed later *except* some CPU related, depending on the guest system. You may want to increase graphics memory to max (128MB) and enable 3D acceleration. Maybe 2 or more CPU if you have more than that in host.. Maybe more RAM. Most modern OS like more than one CPU, I/O APIC, PAE/NX, VT-x/AMD-V, Nested Paging.

Starting with Mageia 9, for Plasma systems the 3D acceleration must be enabled.

IMPORTANT: Some installers will install different kernels depending on ACPI, APIC, number of CPU, so it cannot be changed after the guest is installed!

(Example: WinXP installer will install different kernels depending on 1 or 2 CPUs are found at install.)

Better read: System settings

In the guest system

USB devices, CD, Network, and other devices

Use the dropdown "Devices" menu in VirtualBox window frame for the guest.

I.e connect your USB device, and after a couple seconds you can connect it to the guest by Devices->USB... and select it.

Auto shared folders

Shared folders with the host need guest additions, *and* that your user is in the group vboxsf. See automatic mounting of shared folders

Special keystrokes

§ Ctrl-Alt-{F1, F2... Del, Backspace} is sent to guest by holding down host key (by default right Ctrl) instead of Ctrl-Alt.

§ Power button (ACPI off) is found in the menu of the virtual machine window.

Using a guest Mageia VDI

It is more and more frequent to use virtual disks (vdi) in order to directly access and use a new operating system. For example, in most Universities, students can download virtual disks for some operating systems, like Linux distributions. For Mageia, there is a site named Osboxes from which you can download the latest Mageia 64bit virtual images. Download, and uncompress the file. Then in VirtualBox:

  • Start VirtualBox on your host and create a new guest: Select Linux and Mageia 64bit and name it for example MageiaOSBox.
  • Click next, and you can increase RAM memory if you like. This setting can later be changed.
  • Click next and select "Use an existing virtual hard disk file", click the button next to the dropdown, this will open a dialogue with the disk files known to VirtualBox.
  • Click the button add, and browse to and select the .vdi file to use. At this point VirtualBox have already created a subfolder under the folder you have told Virtualbox to store the virtual machines, to host this machine, and it is a good idea to put the vdi file in that folder, (i.e continuing the example name ~/VirtualBox VMs/MageiaOSBox/) then select it. Back in hard disk selector dialogue, select the file you added, and press button "Choose". Back in the create virtual machine guide, select Create.
  • Now in the main VirtualBox window you see this new machine listed. You can right-click it and change settings if you like, but for now just browse and see what is possible to adjust later...
  • Select the machine and start it. After a few seconds, you will have a running Mageia guest installation.
  • Login Credentials: As stated on the download page, user name is osboxes, and both user and root password by default is osboxes.org (be careful with the dot of your keyboard which might differ from the native English default keyboard).
    • If it boots to black screen in graphics mode, use host key (normally right Ctrl) plus F2 to simulate Ctrl-Alt-F2, and log in as root per above and issue "mcc" to start text mode Mageia Control Center. Or at the Mageia boot menu select the line with "advanced options", then the one with "maintenance mode". This is single user mode, graphics not started. After logging in you can use the drak tools. (except drakconf, also called mcc.) Try drak <tab> for a list. After changes issue reboot to reboot.
  • Change the keyboard by using drakconf (Mageia Control Center), hardware, select keyboard layout.
  • If your first network is a NAT, it can be useful to set the second network as a bridge: within the Virtual Box of your host, select Settings, Network, Second, Bridge. Reboot and see if your network works.
  • Add yourself as a new user in Mageia Control Center (keep osboxes until it is created) and go to the last boot section in order to setup autologin to yourself.
  • In order to download packages, go to Software Management and select Configure media sources for install and once it is done unselect the first two items related to CD.
  • Install vboxadditions. Set a shared folder giving a path of your real machine to a shared folder (myhostdir) which will be "mounted" (api) on your Mageia guest. If you reboot, you will have an automounted (udisks2) media on /run/media/myloginame/VBOXADDITIONS_4.3.28_100309/VBoxLinuxAdditions.run but in order to run this binary as root you need to download the kernel devel rpm, for example: urpmi kernel-devel-3.19.8-desktop-3.mga5
Also, you need to add the group vboxsf to your username usermod -a -G vboxsf myloginame.
After rebooting you should see your host directory on /media/sf_myhostdir on the Mageia guest.

Special cases

Using LVM based disks

VirtualBox by default stores virtual disk images as files. If you have been using KVM, you may well have been storing your disk images as LVM volumes. To use LVM volumes with VirtualBox, you can create a vmdk file that points to the disk image, using a command like:

VBoxManage internalcommands createrawvmdk -filename /vbox/www.vmdk -rawdisk /dev/images/www

See: https://www.soljerome.com/blog/2010/09/07/using-lvm-volumes-with-virtualbox/ for details.

Also see

Using Vagrant, for VirtualBox: VagrantImageBox.