This instruction explains how to deploy a pre-configured Clear Linux* OS image as a guest on the VirtualBox hypervisor .

Download VirtualBox

VirtualBox* is a type 2 hypervisor from Oracle. Download and use version 5.0 or greater from the official VirtualBox website.

Prerequisites

The instruction assumes that you have:

  1. Enabled virtualization technology in the host machine’s BIOS.

    Note

    For help, see: Intel® Virtualization Technology (Intel® VT).

  2. Installed VirtualBox on your host machine per the appropriate instructions for your platform.

If you have not completed the above steps, do so before continuing.

Create a virtual machine in VirtualBox

  1. Log in to your host and open a terminal emulator.

  2. Download the latest live version (clear-XXXX-live.img.xz) of Clear Linux OS. You can also use this command:

    curl -O https://download.clearlinux.org/image/$(curl https://download.clearlinux.org/image/latest-images | grep live)
    
  3. Decompress the downloaded image. Uncompressed image size is ~ 5GB.

    • On Linux

      xz -d clear-XXXX-live.img.xz
      
    • On Windows you can use 7zip.

      • Right-click the file to extract in the same directory.

        7zip extract here command
  4. To convert a raw image to VDI format, you can use one of the following commands:

    VBoxManage convertfromraw clear-XXXX-live.img clear-XXXX-live.vdi --format VDI
    

    or:

    vbox-img convert --srcfilename clear-XXXX-live.img --dstfilename clear-XXXX-live.vdi --srcformat raw --dstformat vdi
    

    Note

    Be sure you have VirtualBox directory in your PATH (i.e., on Windows C:\Program Files\Oracle\VirtualBox).

    • On windows: launch a Command Prompt program and type

      set PATH=%PATH%;"C:\Program Files\Oracle\VirtualBox"
      
      Convert image in Windows command propt
  5. Create a virtual machine using the VirtualBox assistant:

    1. Type: Linux

    2. Version: Linux 2.6 / 3.x / 4.x (64-bit)

      Create a new image in VirtualBox
    3. Select default memory size.

      ../../../../_images/vbox-memory-size.png
    4. Attach the virtual disk created in step number 3 as a virtual hard disk file. Click the folder icon (lower right) to browse to find the VDI file.

      ../../../../_images/vbox-hdisk.png
  6. After it is created, go to settings to enable EFI support

    • System -> Enable EFI (special OSes only)

      Enable EFI on VirtualBox

Run your new VM

Clear Linux OS supports VirtualBox kernel modules used by the Linux kernel 4.14 LTS (kernel-lts bundle).This kernel was selected because Clear Linux OS OS’s main kernel (kernel-native) bundle keeps up-to-date with the upstream Linux kernel, and sometimes VirtualBox kernel modules aren’t compatible with pre-kernel releases.

On the first boot, Clear Linux OS requests a user login.

  1. Type root.
  2. Enter a new password when prompted.

To install the VirtualBox kernel modules, here are the steps:

  1. Install the bundle that supports VirtualBox modules:

    swupd bundle-add kernel-lts
    
  2. Set a timeout in the bootmanager to shows a menu at boot time:

    clr-boot-manager set-timeout 10
    
  3. Update the bootloader entries with:

    clr-boot-manager update
    
  4. Reboot your system with:

    reboot
    

    and choose clear-linux-lts-4.14.XX-YYY kernel version.

  5. (Optional) Unset timeout to boot directly to LTS version:

    clr-boot-manager set-timeout 0
    
  6. (Mandatory) Update bootmanger to always use LTS version:

    clr-boot-manager update
    

Install Guest Additions

The kernel modules are shipped with the kernel-lts bundle. Insert Guest Additions CD image using Devices menu you’ll need to install the user Linux Guest Additions. To install the VirtualBox Guest Additions, follow these steps:

  1. Insert Guest Additions CD image using Devices menu

    VirtualBox CD
  2. Install Linux users Guest Additions:

    install-vbox-lga
    
  3. Reboot your system:

    reboot
    

Troubleshooting

On Windows OS, VirtualBox cannot do a Hardware Virtualization when Hyper-V is enabled.

VirtualBox hardware acceleration error

To disable Hyper-V you should execute:

bcdedit /set {current} hypervisorlaunchtype off

in an Administrator: Command Prompt, then reboot your system.

To enable Hyper-V again, you should execute:

bcdedit /set {current} hypervisorlaunchtype Auto