LXD windows VM Console

As VNC is no option anymore, is it possible having spice on a port, rather unix socket in /home/user/snap/lxd/common/config/sockets/x.spice ? (They BTW persist after container deleted)
For instance this as raw.qemu?
<graphics type='spice' port='5901' autoport='no' listen='10.0.4.1' passwd='password'>

This would make it much easier for installations on headless servers, where the home brew solution of ubuntu graphical on my Laptop with trusted lxd and remote console to server is not really an option.

Another question is, what exactly does distrobuilder to windows iso image, beside adding the virtio drivers?
Because the result of processed image cant be used as boot image for libvirt qemu directly.

Not sure if you aware but LXD exposes the spice socket over the API

Sure. I saw how you did that by passing the lxd api socket to spice html5. It is smart.
Yet, a dedicated VNC/Spice port would be easier to process with third party remote viewers , can be passed through websockify / novnc …

We don’t have a plan to do that as LXD in general wants to keep open ports down to just one (the secure LXD API) and carry everything over that.

You may be able to work around that by using raw.qemu to pass additional arguments to QEMU, setting up a second SPICE listener.

I understand the concerns regard open ports.
Would you mind elaborating? An example perhaps?

You may be able to work around that by using raw.qemu to pass additional arguments to QEMU, setting up a second SPICE listener.

raw.qemu lets you pass additional arguments directly to the QEMU process, so you can look up whatever option you want in man qemu and pass them there.

Exactly what I did, yet it hasnt started a listening port.

echo -n ‘-device virtio-vga -spice port=5901 drive file=/data/virt/iso/WindowsServer2019/17763.737.190906-2324.rs5_release_svc_refresh_SERVERESSENTIALS_OEM_x64FRE_en-us_1.iso,index=0,media=cdrom,if=ide’ | lxc config set wintest raw.qemu -

and similar.

stgraber@dakara:~$ netstat -lnp | grep 1234
(Not all processes could be identified, non-owned process info
 will not be shown, you would have to be root to see it all.)
tcp        0      0 127.0.0.1:1234          0.0.0.0:*               LISTEN      -                   
stgraber@dakara:~$ lxc config get v1 raw.qemu
-spice port=1234,addr=127.0.0.1,ipv4=on
1 Like

Great. Thanks.
Will try that syntax.

About distrobuilder and the processed windows iso, is there beside adding the virtio drives, any other steps which makes the image unbootable for libvirt qemu?
Perhaps another pre-boot menu?

All distrobuilder does is inject the virtio drivers into both boot.wim and install.wim, both adding the actual files and updating the registry keys to have them loaded.

Excellent.
It has worked perfectly. Thanks very much.
Is there a way around the hitting Esc after container start and Console?
Because remote viewer otherwise shows non bootable situation.

But it also can be helped with.
I brought up the installation to an interesting level, where root device filled with windows files and stopped the container at a point where personal information requested.
This way i can detach the CD and clone the container as basic (template) win10, 2016/2019 etc.
It saves the time of installation and starts immediately, user can than provide his credentials, his own product key …