How to connect to remote windows VM

Hello,

I am trying to launch a windows VM on a debian remote host.
I have done all the steps ( prepared windows iso file and created the VM)
I can’t connect to the remote VGA console to access the Windows install wizard.
could anyone help me to connect the VM from my local windows machine?

I am using the incus version 6.2

Thank you

Hi!

When you run incus start mywin11vm --console=vga, you get this process list (output of pstree). Incus launches remote-viewer with some parameters not shown yet.

What are these parameters? It’s a Unix socket, that is placed on the host. By default, you can easily access a Unix socket from the same host.

$ ps ax | grep remote-viewer
 129488 pts/0    Sl+    0:00 /usr/bin/remote-viewer spice+unix:///home/myusername/.config/incus/sockets/690641109.spice

Is there something that you can do if the Windows VM is on a remote Incus host? There are several things you can do and I am not sure what’s the best option.

@bmullan, do you have a suggestion for this case?

Thanks for your message @simos

let me detail my current scenario. when I try to get the console access, I am having the following

 #incus console windows2019std --type=vga
The client automatically uses either spicy or remote-viewer when present.
As neither could be found, the raw SPICE socket can be found at:
  spice+unix:///root/.config/incus/sockets/3419451436.spice

I also try to access the console after install spice-client-gtk, then I am getting the below error

# incus console windows2019std --type=vga

(process:899839): Gtk-WARNING **: 08:06:02.241: Locale not supported by C library.
	Using the fallback 'C' locale.

(spicy:899839): Gtk-WARNING **: 08:06:02.242: cannot open display:

I can see a # there. You are running these as root. For CLI commands this is OK but for UI apps, it gets tricky.

Use a non-root account to run incus commands.
Your non-root account should be a member of the incus-admin group, and by doing so, you can run all incus commands.

If myusername is your non-root account, then add it to the incus-admin group with

usermod -a -G incus-admin myusername

Then logout and login again.
You will be able now to run incus console without being root.

Thanks for the faster response @simos

I haven’t encountered any issues while running the incus commands as root.
However, I’m currently unable to connect to the VGA console remotely.
Is there any way to use the VGA console remotely (over ssh ?) or with VNC on my computer?

Thanks

Just run the incus command on your local computer.

hello @stgraber

I am using a windows PC to connect the remote host, also I haven’t installed incus on my local PC.

Is there any way to connect to remote windows VM from my local windows PC?

Install the Incus client for Windows and install remote-viewer for Windows.
Then you can connect to your remote Incus server directly from your Windows machine including accessing the VGA console.

Thanks @stgraber

Hello @stgraber
I have created a new profile for windows VM and its configuration is

# incus profile show windows
config:
  limits.cpu: "4"
  limits.memory: 6GiB
  raw.qemu: -device intel-hda -device hda-duplex -audio spice
description: Windows profile 4CPU, 6GB RAM, 55GB space
devices:
  network:
    nictype: bridged
    parent: incusbr0
    type: nic
  root:
    path: /
    pool: default
    size: 55GB
    type: disk
  vtpm:
    path: /dev/tpm0
    type: tpm
name: windows
used_by:
- /1.0/instances/win-from-vol-profile
project: default

and I have created a new windows VM by using this profile and successfully created the VM and its running.

# incus init win-from-vol-profile --empty --vm --profile windows
# incus config device add win-from-vol-profile install disk pool=default source=windows2019std-iso boot.priority=3

But the incus config command doesn’t shows the profile configuration

# incus config show win-from-vol-profile
architecture: x86_64
config:
  volatile.cloud-init.instance-id: 1ae7a2aa-5676-4aa9-b0a9-3b87722114d8
  volatile.last_state.power: RUNNING
  volatile.last_state.ready: "false"
  volatile.network.host_name: tapb6fedda0
  volatile.network.hwaddr: 00:16:3e:86:56:9a
  volatile.uuid: bdc9938b-01d1-459a-9d98-7a648bc12e38
  volatile.uuid.generation: bdc9938b-01d1-459a-9d98-7a648bc12e38
  volatile.vsock_id: "2664359131"
devices:
  install:
    boot.priority: "3"
    pool: default
    source: windows2019std-iso
    type: disk
ephemeral: false
profiles:
- windows
stateful: false
description: ""

Is that normal?

Yep, if you want to see the content of the profiles too, you need to pass --expanded to incus config show

1 Like

Thanks @stgraber

Hello @stgraber

Is it possible to run windows powershell commands on windows VM from the host machine?

I have tried configure openssh server on windows and able to execute commands
but I need something like as did for CTs incus exec test -- mkdir new_dir

any help?

Thank you

When you run commands like incus exec to a virtual machine (compared to a container), the virtual machine needs to have inside a special Incus auxiliary program (the agent) that responds to those incus exec, etc commands.

When the Incus VM runs a version of a Linux distribution, then Incus manages to add that Incus auxiliary program (the agent) automatically for you.

Currently, there is no such agent yet for Incus VMs that run Windows.

You would need something else now to get access to the Windows VM, such as installing an SSH server in there.

1 Like

Right, we’re actually hoping to eventually have the agent run on Windows.
It’s been designed in a way to make this possible, but there are still some missing device drivers on Windows to make this possible.

Our agent basically relies on 9p/virtiofs (which is supported on Windows), virtio-serial (which I believe is supported too) and virtio-vsock (which has a driver but not shipped in the signed virtio drivers yet).

So we’re mostly blocked on vsock and then will need to make sure that we can actually get all 3 of them working together correctly.

1 Like

Thank you for the information @stgraber @simos

Hello @stgraber Is there any way to assign static ip to a windows VM directly from the debian host machine? currently I am doing this by logged into the VM using remote viewer

Not a truly static address as there’s no cloud-init or similar for our Windows VMs.
But you can always use DHCP and set a static lease using ipv4.address on the nic device.