Clear Linux Guest Virt Manager

Introduction

  • download, convert, and resize the provided kvm-legacy image
  • create a virtual machine and launch it from virt-manager

The Clear Linux website has instructions for installing as a guest in kvm.

But it’s not immediately clear from the instructions if you can use virt-manager, because they recommend their script which runs qemu-system-x86_64 directly. Which is fine, but maybe you find it easier to customize the options using the virt-manager gui interface.

How To

Assuming you have libvirt and kvm set up with virt-manager, you can:

  • download the clear-*-legacy-kvm.img.xz
  • verify the checksum
  • extract it unxz clear-*-legacy-kvm.img.xz
  • mv clear-*-legacy-kvm.img.xz /var/lib/libvirt/images/
  • create a virtual machine in virt-manager using the image

There is not an os template for Clear Linux, but Fedora29 works fine for me. As a bonus, virsh console is configured and ready to go.

Convert Raw -> Qcow2 and Resize

The image has a gpt partition table. I am not sure if that is the reason why, but fdisk does not seem to work for resizing the partition. However, parted works fine.

The image download is an 8gb sparse raw image. You may wish to convert that to qcow2 and and resize before creating the virtual machine. Here is how to do that.

  1. convert the sparse raw image to qcow2
  2. resize the image to taste
  3. create the virtual machine
  4. boot the virtual machine
  5. log in
  6. install a bundle which contains parted
  7. expand “/” partition and file system with parted and resize2fs
  1. qemu-img convert -f raw -O qcow2 clear*.img clear.qcow2
  2. qemu-img resize clear.qcow2 20G
  3. create the virtual machine in virt-manager gui
  4. virsh start clearvm
  5. virsh console clearvm
  6. swupd bundle-add clr-installer
  7. parted /dev/vda resizepart
    • Fix/Ignore? Fix
    • Partition number? 1
    • End? [8590MB]? 100%
    • resize2fs /dev/vda1