Jump to content

Windows client - Unraid host - Linux guest basics


Recommended Posts

Hi,

I think I'm doing something quite opposite of what many people are doing in the community.

 

And I think what I want to do is quite simple but unfortunately I am quite clueless when it comes to KVM. I still struggle to understand which tech does what in this KVM/QEMU/spice combination.

 

I have a windows PC that I use as desktop and I have a few linux virtual machines(mint, ubuntu and centos) on it that I run on Vmware for software development. I pretty much run the VM and open IntelliJ on it and start writing code, compile, test etc.

 

Now I have a brand new unraid server with quite a few cores that I don't utilise, I want to move these VMs there. This question is not about converting VMDK to KVM but very much about the basics. If I can get a linux machine up and running and connect to that machine from my desktop, I think I can pretty much handle the rest.

 

I've created a new Ubuntu 21.04 VM through unraid templates. Can someone give me a list of things I need to do/install on various machines?

 

- on windows (my desktop) I've installed VirtViewer v10.0-256 and I guess that is pretty much all I need here?

  and apparently I'm supposed to do something like

 

virt-viewer.exe --connect qemu://host:port alias
// or
virt-viewer.exe --connect sprice://host:port alias
// but what is host here? is it the ip of unraid or the virtual machine that is running?
// and where did I decide on this port?

  

- on unraid, I've pretty much done nothing special, this machine has no graphics card (not even an APU) and I have no intention of having a gaming VM on here (at least for the foreseeable future)

 

Spoiler


<?xml version='1.0' encoding='UTF-8'?>
<domain type='kvm'>
  <name>Ubuntu Desktop Dev</name>
  <uuid>e4fd0395-a8b0-2023-8e98-714b731e7d16</uuid>
  <metadata>
    <vmtemplate xmlns="unraid" name="Ubuntu" icon="ubuntu.png" os="ubuntu"/>
  </metadata>
  <memory unit='KiB'>8388608</memory>
  <currentMemory unit='KiB'>8388608</currentMemory>
  <memoryBacking>
    <nosharepages/>
  </memoryBacking>
  <vcpu placement='static'>8</vcpu>
  <cputune>
    <vcpupin vcpu='0' cpuset='1'/>
    <vcpupin vcpu='1' cpuset='9'/>
    <vcpupin vcpu='2' cpuset='3'/>
    <vcpupin vcpu='3' cpuset='11'/>
    <vcpupin vcpu='4' cpuset='5'/>
    <vcpupin vcpu='5' cpuset='13'/>
    <vcpupin vcpu='6' cpuset='7'/>
    <vcpupin vcpu='7' cpuset='15'/>
  </cputune>
  <os>
    <type arch='x86_64' machine='pc-q35-5.1'>hvm</type>
    <loader readonly='yes' type='pflash'>/usr/share/qemu/ovmf-x64/OVMF_CODE-pure-efi.fd</loader>
    <nvram>/etc/libvirt/qemu/nvram/e4fd0395-a8b0-2023-8e98-714b731e7d16_VARS-pure-efi.fd</nvram>
  </os>
  <features>
    <acpi/>
    <apic/>
  </features>
  <cpu mode='host-passthrough' check='none' migratable='on'>
    <topology sockets='1' dies='1' cores='4' threads='2'/>
    <cache mode='passthrough'/>
    <feature policy='require' name='topoext'/>
  </cpu>
  <clock offset='utc'>
    <timer name='rtc' tickpolicy='catchup'/>
    <timer name='pit' tickpolicy='delay'/>
    <timer name='hpet' present='no'/>
  </clock>
  <on_poweroff>destroy</on_poweroff>
  <on_reboot>restart</on_reboot>
  <on_crash>restart</on_crash>
  <devices>
    <emulator>/usr/local/sbin/qemu</emulator>
    <disk type='file' device='disk'>
      <driver name='qemu' type='qcow2' cache='writeback'/>
      <source file='/mnt/user/domains/Ubuntu Desktop Dev/vdisk1.img'/>
      <target dev='hdc' bus='virtio'/>
      <boot order='1'/>
      <address type='pci' domain='0x0000' bus='0x04' slot='0x00' function='0x0'/>
    </disk>
    <disk type='file' device='cdrom'>
      <driver name='qemu' type='raw'/>
      <source file='/mnt/user/isos/linux/ubuntu-21.04-desktop-amd64.iso'/>
      <target dev='hda' bus='sata'/>
      <readonly/>
      <boot order='2'/>
      <address type='drive' controller='0' bus='0' target='0' unit='0'/>
    </disk>
    <controller type='usb' index='0' model='ich9-ehci1'>
      <address type='pci' domain='0x0000' bus='0x00' slot='0x07' function='0x7'/>
    </controller>
    <controller type='usb' index='0' model='ich9-uhci1'>
      <master startport='0'/>
      <address type='pci' domain='0x0000' bus='0x00' slot='0x07' function='0x0' multifunction='on'/>
    </controller>
    <controller type='usb' index='0' model='ich9-uhci2'>
      <master startport='2'/>
      <address type='pci' domain='0x0000' bus='0x00' slot='0x07' function='0x1'/>
    </controller>
    <controller type='usb' index='0' model='ich9-uhci3'>
      <master startport='4'/>
      <address type='pci' domain='0x0000' bus='0x00' slot='0x07' function='0x2'/>
    </controller>
    <controller type='sata' index='0'>
      <address type='pci' domain='0x0000' bus='0x00' slot='0x1f' function='0x2'/>
    </controller>
    <controller type='pci' index='0' model='pcie-root'/>
    <controller type='pci' index='1' model='pcie-root-port'>
      <model name='pcie-root-port'/>
      <target chassis='1' port='0x10'/>
      <address type='pci' domain='0x0000' bus='0x00' slot='0x02' function='0x0' multifunction='on'/>
    </controller>
    <controller type='pci' index='2' model='pcie-root-port'>
      <model name='pcie-root-port'/>
      <target chassis='2' port='0x11'/>
      <address type='pci' domain='0x0000' bus='0x00' slot='0x02' function='0x1'/>
    </controller>
    <controller type='pci' index='3' model='pcie-root-port'>
      <model name='pcie-root-port'/>
      <target chassis='3' port='0x12'/>
      <address type='pci' domain='0x0000' bus='0x00' slot='0x02' function='0x2'/>
    </controller>
    <controller type='pci' index='4' model='pcie-root-port'>
      <model name='pcie-root-port'/>
      <target chassis='4' port='0x13'/>
      <address type='pci' domain='0x0000' bus='0x00' slot='0x02' function='0x3'/>
    </controller>
    <controller type='pci' index='5' model='pcie-root-port'>
      <model name='pcie-root-port'/>
      <target chassis='5' port='0x14'/>
      <address type='pci' domain='0x0000' bus='0x00' slot='0x02' function='0x4'/>
    </controller>
    <controller type='pci' index='6' model='pcie-root-port'>
      <model name='pcie-root-port'/>
      <target chassis='6' port='0x15'/>
      <address type='pci' domain='0x0000' bus='0x00' slot='0x02' function='0x5'/>
    </controller>
    <controller type='virtio-serial' index='0'>
      <address type='pci' domain='0x0000' bus='0x03' slot='0x00' function='0x0'/>
    </controller>
    <filesystem type='mount' accessmode='passthrough'>
      <source dir='/mnt/user/'/>
      <target dir='unraid'/>
      <address type='pci' domain='0x0000' bus='0x01' slot='0x00' function='0x0'/>
    </filesystem>
    <interface type='bridge'>
      <mac address='52:54:00:29:46:ff'/>
      <source bridge='br0'/>
      <model type='virtio-net'/>
      <address type='pci' domain='0x0000' bus='0x02' slot='0x00' function='0x0'/>
    </interface>
    <serial type='pty'>
      <target type='isa-serial' port='0'>
        <model name='isa-serial'/>
      </target>
    </serial>
    <console type='pty'>
      <target type='serial' port='0'/>
    </console>
    <channel type='unix'>
      <target type='virtio' name='org.qemu.guest_agent.0'/>
      <address type='virtio-serial' controller='0' bus='0' port='1'/>
    </channel>
    <input type='tablet' bus='usb'>
      <address type='usb' bus='0' port='1'/>
    </input>
    <input type='mouse' bus='ps2'/>
    <input type='keyboard' bus='ps2'/>
    <graphics type='vnc' port='-1' autoport='yes' websocket='-1' listen='0.0.0.0' keymap='tr'>
      <listen type='address' address='0.0.0.0'/>
    </graphics>
    <video>
      <model type='qxl' ram='65536' vram='65536' vgamem='16384' heads='1' primary='yes'/>
      <address type='pci' domain='0x0000' bus='0x00' slot='0x01' function='0x0'/>
    </video>
    <memballoon model='virtio'>
      <address type='pci' domain='0x0000' bus='0x05' slot='0x00' function='0x0'/>
    </memballoon>
  </devices>
</domain>

 

 

- on ubuntu (guest)

 I have "xserver-xorg-video-qxl" and "spice-vdagent-0.20.0-2" already installed.

I also have QXL graphics card as:

#> lscpci | grep VGA
00:01.0 VGA compatible controller: Red Hat, Inc. QXL paravirtual graphic card (rev 05) 

 

Do I need to install some kind of "guest tools" or "spice client" on this ubuntu?

 

All I want to do is pretty much "remote" into this Virtual Machine and write code (clipboard sharing feels mandatory) Can someone help me out? or may be if this is a trivial task can you point me to correct resources and or tutorials?

 

 

 

 

Edited by xaq
typos
Link to comment
4 hours ago, xaq said:

// but what is host here? is it the ip of unraid or the virtual machine that is running?

// and where did I decide on this port?

It's the ip of the virtual machine unraid: you can bridge the vm/unraid connection and set the vm to have an ip in the same lan of unraid.

Spice/vnc default port is 5900 (for the first client).

 

    <graphics type='vnc' port='-1' autoport='yes' websocket='-1' listen='0.0.0.0' keymap='tr'>
      <listen type='address' address='0.0.0.0'/>
    </graphics>

 

This means that the vm is accepting connections on all available interfaces (inside the vm) with no password and it will auto allocate the listening port: first client will connect to port 5900, a second client to port 5901, a third one to 5903, et.

Edited by ghost82
Link to comment
6 minutes ago, xaq said:

I am looking at this page, and feels like I am missing quite a few steps. But I am unsure which ones unraid already did for me. 

I never use virtViewer, so I'm not sure about your commands.

Can you try the vnc viewer in windows, for example this?

https://www.realvnc.com/en/connect/download/viewer/windows/

 

If you already connect to the vm with the builtin vnc viewer in unraid you can try port 5901 from windows.

If it doesn't work, I would close the vnc builtin viewer in unraid and try to connect to port 5900 from windows.

Edited by ghost82
Link to comment
31 minutes ago, xaq said:

Do you mean just download and use vnc viewer on 192.168.0.26 without touching the guest?

 

or do you mean install vnc server on guest?

I'd rather avoid VNC or nomachine if I can, but for the sake of testing I can.

The guest is already set up with vnc, you set up it in libvirt, so no need to install any server inside the guest.

I was suggesting to try the realvnc server which I used and I'm sure that it works and not the other app you are using.

Edited by ghost82
Link to comment
3 minutes ago, ghost82 said:

The guest already has the vnc server, you set up it in libvirt, so no need to install any server inside the guest.

 

 

I tried connecting to it using vncviewer at 192.168.0.26:5900 did not work.

Pretty much the only thing that worked to connect to this machine up until now is "VNC Remote" menu item from unraid menu on VM.

 

now I've changed the XML to spice, that does not work either.. it almost feels like something hidden is blocking the connection..

 

    <graphics type='spice' port='5900' autoport='no' listen='0.0.0.0' passwd='password'>
      <listen type='address' address='0.0.0.0'/>
    </graphics>

 

 

 

Link to comment
3 minutes ago, ghost82 said:

Sorry sorry sorry, you need to input the ip of unraid, not that of the guest: I checked the history of the connections in the vnc viewer. Not sure how it works with multiple vms running on vnc, so shutdown any additional vm before truing.

 

Holy chimp!

I can't believe I did not try this. The spice client connected and it is as fast as I am running the software locally virtually with no lag at all! Now all that is needed to do is figure out clipboard sharing!

  • Like 2
Link to comment

if anyone else is interested in this in the future, I had to remove following lines for qemu guest agent (added by unraid by default i guess)

    <channel type='unix'>
      <target type='virtio' name='org.qemu.guest_agent.0'/>
      <address type='virtio-serial' controller='0' bus='0' port='1'/>
    </channel>

 

and add a virtio port for spice guest agent

 

    <channel type='spicevmc'>
      <target type='virtio' name='com.redhat.spice.0'/>
      <address type='virtio-serial' controller='0' bus='0' port='2'/>
    </channel>

 

copy paste and auto screen resolution match will work after this.

  • Thanks 1
Link to comment

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...