Use Clear for a VM host

Are there any instruction on how to run Virtual machines on Clear? Need to run Windows in a VM for work I do.

Just switched to Clear from a couple other distributions and enjoying it. I usually use VirtualBox or VMware workstation. VMware is asking for the system service script directory and I’m not sure where this directory is on CL.

thanks,
Brian

Does it help? Or are you looking for the opposite?

1 Like

Looking for the opposite but thanks.

I need to run VMs on Clear Linux. For example, I have a Windows 10 host in a VirtualBox VM I need to port to my new Clear Linux install on a laptop to test dev work on.

1 Like

It was what I thought, but sent the link just in case. Anyway, this use case sounds interesting. Hope someone here could help you.

Hi Brian,

This is because CL is systemd-oriented and does not have the standard /etc/init.d scripts. Possibly this may help:

https://bbs.archlinux.org/viewtopic.php?id=146771

/Nikola

I’m not sure there’s an easy solution in Clear currently. You can likely use KVM & virt-manager (you’ll need to search for guides).

Note that Clear doesn’t currently provide something like Gnome Boxes (to help manage KVM/QEMU VMs), nor Virtualbox. I’m holding out hope for Virtualbox, however - see https://github.com/clearlinux/distribution/issues/390.

There is an open discussion to have VirtualBox added as a native bundle here: https://github.com/clearlinux/distribution/issues/390 +1 the discussion if it’s important to you.

My notes about getting VMware Workstation running on Clear Linux here will probably help: https://github.com/clearlinux/distribution/issues/625

KVM/QEMU is also available in Clear Linux as an option.

Short answer: Yes, you can have Windows VM in CL (I use one in my office).

Long answer: You will use the KVM hypervisor, the native hypervisor from linux.

To mange it will use libvirt as backend and virt-manager as front-end.

  1. install the virt-manager-gui and kvm-host bundles
  2. enable (to be ready every boot) libvirt service with sudo systemctl enable libvirtd.service
  3. start libvirt service with sudo systemctl start libvirtd.service
  4. run virt-manager

There you can select an ISO file to install your windows.

4 Likes

Thanks, KVM will work. Been a long time since I’ve used it but it will work.

I can confirm QEMU as well as that is my go-to. I have Win 7, Kali, and ClearLinux as well running just fine. Took a little work, I will post something in Q&A when I have time.

Hi and thanks for your instructions. I’m new to CL, have been ditching win recently and looking around for a good linux desktop env. I love CL look and philosophy. I was able to install win10 on virt-manager following your instructions but failed in setting the network for it, the guest does not see any network. Can anyone help please?

try with
https://wiki.libvirt.org/page/TaskNATSetupVirtManager

Also CL is adding Gnome-boxes which is an easy way to use VM.

1 Like

Thanks for your reply… Gnome-boxes was my first choice but it kept on telling me that virtualization was not enabled while I’m super sure it was… and it fails during creation. If there is a way to fix that I’d be more thank happy to use it and/or to support to fix it. My laptop is a Lenovo x1 carbon yoga.

I tried but it does not create any network, it ends with no msg but nothing gets added to the list. I also do not have any default network enabled on that screen.

I tried the following (after some investigation): “sudo virsh net-list --all” and I get an empty list back.

What am I doing wrong?

Thanks again for your patience

I get the same warning about virtualisation not being enabled when using the Flatpak build. I am unable to startup the standard build.

How did you get kvm modules to load? I’m on the latest native kernel (5.2.8.821) for x86_64 with kernel-native-dkms and kvm-host bundles installed but still no dice?

Just as a sanity check virtualization extensions are enabled in the bios & kernel modules look to be included (all be it x86?)

bjc@bjc-xps~ $ egrep -c '(vmx|svm)' /proc/cpuinfo
8
bjc@bjc-xps~ $ grep 'kvm' /lib/modules/5.2.8-821.native/modules.builtin
kernel/arch/x86/kvm/kvm.ko
kernel/arch/x86/kvm/kvm-intel.ko
kernel/drivers/gpu/drm/i915/gvt/kvmgt.ko
bjc@bjc-xps~ $ lsmod | grep kvm
bjc@bjc-xps~ $ 

And just in case the kvm modules are separate bundles

bjc@bjc-xps~ $ sudo swupd search kvm.ko
Search failed, no reasonable results found
bjc@bjc-xps~ $ sudo swupd search kvm_intel.ko
Search failed, no reasonable results found
bjc@bjc-xps~ $ 

I can’t help but think im missing something (or something has changed in the build that results in kvm modules not being available?)

They are built into the kernel, so you won’t find them by searching the .ko module names.

$ cat /usr/lib/kernel/config-5.2.8-821.native | grep CONFIG_KVM

CONFIG_KVM=y
CONFIG_KVM_INTEL=y

Thanks @puneetse, after your feedback I did a quick google to dive a bit deeper and it looks like my problem stems from flatpak, (specifically not being able to start the android emulator from within intellij application)

I checked running the emulator from the command line and everything works fine so now to work out how flatpak encapsulates groups so that my users kvm groups cascade through.

Thanks for your help!

Hot tip for anyone that hits this issue. For me it was because Intelllij IDEA with android plugin (not Android Studio) didn’t get passed in the appropriate flatpak permissions so I rectified this by editing the application’s .desktop file to contain the --device kvm within the Exec field:

bjc@bjc-xps~ $ cat .local/share/flatpak/exports/share/applications/com.jetbrains.IntelliJ-IDEA-Community.desktop 
[Desktop Entry]
Categories=Development;IDE;
Exec=/usr/bin/flatpak run --branch=stable --arch=x86_64 --device=kvm --command=idea com.jetbrains.IntelliJ-IDEA-Community
GenericName=Capable and Ergonomic Java IDE
Icon=com.jetbrains.IntelliJ-IDEA-Community
Keywords=development;idea;intellij;java;
Name=IntelliJ IDEA Community
StartupNotify=true
StartupWMClass=jetbrains-idea-ce
Terminal=false
Type=Application
X-Flatpak=com.jetbrains.IntelliJ-IDEA-Community```