Skip to content
This repository was archived by the owner on Aug 7, 2025. It is now read-only.

Latest commit

 

History

History
220 lines (144 loc) · 7.29 KB

File metadata and controls

220 lines (144 loc) · 7.29 KB

|CL-ATTR| on KVM

This page explains how to run |CL-ATTR| in a virtualized environment using :abbr:`KVM (Kernel-based Virtual Machine)`.

  1. Enable the Intel® Virtualization Technology (Intel® VT) and the Intel® Virtualization Technology for Directed I/O (Intel® VT-d) in the host machine’s BIOS.

  2. Log in and open a terminal emulator.

  3. Install QEMU*-KVM on the host machine. Below are some examples using different distros:

    Host OS

    Installation command

    |CL|

    :command:`sudo swupd bundle-add kvm-host`

    Ubuntu* and Mint*

    :command:`sudo apt-get install qemu-kvm`

    Fedora

    :command:`dnf install qemu-kvm`

  1. Download the latest pre-built |CL| KVM image file from the image directory. Look for clear-<version>-kvm.img.xz. You can also use this command:

    curl -o clear.img.xz https://cdn.download.clearlinux.org/image/$(curl https://cdn.download.clearlinux.org/image/latest-images.json | grep -o clear-'[0-9]'*-kvm.img.xz | head -1)
  2. Uncompress the downloaded image:

    xz -dv clear.img.xz
  3. Download the 3 OVMF files (OVMF.fd, OVMF_CODE.fd, OVMF_VARS.fd) that provides UEFI support for virtual machines.

    curl -O https://cdn.download.clearlinux.org/image/OVMF.fd
    curl -O https://cdn.download.clearlinux.org/image/OVMF_CODE.fd
    curl -O https://cdn.download.clearlinux.org/image/OVMF_VARS.fd

    Note

    The default OVMF files from |CL| may not work for some non-|CL| distro version(s). You may get an ASSERT in the debug.log file when starting the VM. If you encounter this, use the distro-specific OVMF files instead.

  4. Download the start_qemu.sh script from the image directory. This script will launch the |CL| VM and provide console interaction within the same terminal emulator window.

    curl -O https://cdn.download.clearlinux.org/image/start_qemu.sh
  5. Start the |CL| KVM virtual machine:

    sudo bash ./start_qemu.sh clear.img
  6. Log in as root user and set a new password.

To interact with the |CL| VM remotely through SSH instead of the console it was launched from, follow these steps.

  1. Enable and configure SSH in the |CL| VM to allow root login as described in :ref:`openssh-server`.

  2. SSH into the |CL| VM using the port 10022. This port number is set in :file:`start_qemu.sh` and passed through to the SSH service running on port 22

    ssh -p 10022 root@<ip-addr-of-kvm-host>

To add :abbr:`GDM (GNOME Display Manager)` to the |CL| VM, follow these steps:

  1. Shutdown the active |CL| VM.

    poweroff
  2. Install the Spice viewer on the localhost or remote system. Below are some examples using different distros:

    Host OS

    Installation command

    |CL|

    :command:`sudo swupd bundle-add virt-viewer`

    Ubuntu* and Mint*

    :command:`sudo apt-get install virt-viewer`

    Fedora

    :command:`dnf install virt-viewer`

  3. Modify the :file:`start_qemu.sh` script to increase memory (-m), add graphics driver (-vga), and add Spice (-spice, -usb, and -device) support.

    qemu-system-x86_64 \
        -enable-kvm \
        ${UEFI_BIOS} \
        -smp sockets=1,cpus=4,cores=2 -cpu host \
        -m 4096 \
        -vga qxl \
        -nographic \
        -spice port=5924,disable-ticketing=on \
        -usb \
        -device usb-tablet,bus=usb-bus.0 \
        -drive file="$IMAGE",if=virtio,aio=threads,format=raw \
        -netdev user,id=mynet0,hostfwd=tcp::${VMN}0022-:22,hostfwd=tcp::${VMN}2375-:2375 \
        -device virtio-net-pci,netdev=mynet0 \
        -debugcon file:debug.log -global isa-debugcon.iobase=0x402 $@
  4. Due to changes in the :file:`start_qemu.sh` script from the previous step, having previously used OVMF files will result in the VM not booting properly and you returning to the UEFI shell. The easiest way to avoid this is to delete the 3 OVMF files and reobtain originals before relaunching the VM:

    rm -v OVMF*.fd
    curl -O https://cdn.download.clearlinux.org/image/OVMF.fd
    curl -O https://cdn.download.clearlinux.org/image/OVMF_CODE.fd
    curl -O https://cdn.download.clearlinux.org/image/OVMF_VARS.fd
  5. Increase the size of the VM by 10GB to accommodate the GDM installation:

    qemu-img resize -f raw clear-<version>-kvm.img +10G
  6. Relaunch the |CL| VM:

    sudo ./start_qemu.sh clear.img
  7. Determine the IP address of the host on which you will launch the VM. Substitute <ip-addr-of-kvm-host> in the next step with this information.

    ip a
  8. From the local host or remote system, open a new terminal emulator window and connect into the |CL| VM using the Spice viewer:

    remote-viewer spice://<ip-address-of-kvm-host>:5924
  9. Log in as root user into the |CL| VM.

  10. Follow these steps from :ref:`increase-virtual-disk-size` to resize the partition of the virtual disk of the VM.

  11. Add GDM to the |CL| VM:

    swupd bundle-add desktop-autostart
  12. Reboot the |CL| VM to start GDM:

    reboot
  13. Go through the GDM out-of-box experience (OOBE).

  14. The default aspect ratio of the GDM GUI for the |CL| VM is 4:3. To change it, use GDM's Devices > Displays setting tool (located at the top-right corner).

Intel and the Intel logo are trademarks of Intel Corporation or its subsidiaries.