How to run a Windows virtual machine on LXD on Linux (2024)

How to get LXD containers obtain IP from the LAN with ipvlan networking

How to compile lxd-p2c to migrate physical servers to LXD containers

Feb 27 2021

  • By Simos Xenitellis in Linux, open-source, Planet Ubuntu, security, ubuntu, Ubuntu-gr
  • February 27, 2021

UPDATE 2024-02-01: This post is deprecated. Please read instead the fresh new tutorial, at

How to run a Windows virtual machine on Incus on Linux

How to run a Windows virtual machine on LXD on Linux (1)

Simos Xenitellis

Related

  • distribuilder, lxc, lxd, snap, vga, virtual machine, vm, windows

Permanent link to this article: https://blog.simos.info/how-to-run-a-windows-virtual-machine-on-lxd-on-linux/

46 comments

Skip to comment form

    • How to run a Windows virtual machine on LXD on Linux (2)
    • Muslu on March 1, 2021 at 14:49
    • #
    • Reply

    Hi Simos;

    Thanks for everyting about LXC/LXD. I wrote samething on container discuss. If anyone want to use only copy/paste…

    snap install distrobuilder --classic --edge
    apt install -y libguestfs-tools wimtools
    distrobuilder repack-windows /home/muslu/win10.iso /home/muslu/win10_distrobuilder.iso
    lxc init win10 --empty --vm -c security.secureboot=false
    lxc config device override win10 root size=50GiB
    lxc config device add win10 iso disk source=/home/muslu/win10_distrobuilder.iso boot.priority=10
    lxc start win10 --console=vga

    Note: remmina (for slice) or virt-viewer can connect vga.

    apt install -yqq remmina-plugin-spice virt-viewer

    Loading...

      • How to run a Windows virtual machine on LXD on Linux (3)
      • Simos Xenitellis on March 1, 2021 at 20:32
        Author
      • #
      • Reply

      Thanks Muslu!

      I notice that you install distrobuilder from the edge channel. However, since recently, the stable channel has been updated and there is no need any more to use the edge channel. Have a look.

      $ snap info distrobuildername: distrobuildersummary: Image builder for LXC and LXDpublisher: Stéphane Graber (stgraber)store-url: https://snapcraft.io/distrobuildercontact: https://github.com/lxc/distrobuilder/issueslicense: Apache-2.0description: | Distrobuilder is a tool which lets you create container images for LXC and LXD.commands: - distrobuildersnap-id: pAkHI18sZCL3Pfd0r904v29gh2j9OX2ktracking: latest/stablerefresh-date: 2 days ago, at 19:49 GMTchannels: latest/stable: 1.1 2021-01-20 (257) 12MB classic latest/candidate: 1.1 2020-10-16 (257) 12MB classic latest/beta: ↑ latest/edge: git-2b6b394 2021-02-23 (408) 8MB classicinstalled: 1.1 (257) 12MB classic

      I notice that you install libguestfs-tools wimtools. What is the significance of these tools?

      How do you connect to the Windows VM through SPICE (with remmina)?

      Loading...

    • How to run a Windows virtual machine on LXD on Linux (4)
    • Mihail Igoshin on March 3, 2021 at 17:09
    • #
    • Reply

    For me distrobuilder does not recognize command repack-windows. I’ve installed it via snap as is show in this tutorial.

    “Error: unknown command “repack-windows” for “distrobuilder”

    “$ distrobuilder –version
    1.1”

    Loading...

      • How to run a Windows virtual machine on LXD on Linux (5)
      • Simos Xenitellis on March 3, 2021 at 19:16
        Author
      • #
      • Reply

      The Windows support in distrobuilder has been added recently, which means that the package should be recent enough.

      Here is the version I have installed,

      $ snap info distrobuildername: distrobuildersummary: Image builder for LXC and LXDpublisher: Stéphane Graber (stgraber)store-url: https://snapcraft.io/distrobuildercontact: https://github.com/lxc/distrobuilder/issueslicense: Apache-2.0description: | Distrobuilder is a tool which lets you create container images for LXC and LXD.commands: - distrobuildersnap-id: pAkHI18sZCL3Pfd0r904v29gh2j9OX2ktracking: latest/stablerefresh-date: 4 days ago, at 19:49 EETchannels: latest/stable: 1.1 2021-01-20 (257) 12MB classic latest/candidate: 1.1 2020-10-16 (257) 12MB classic latest/beta: ↑ latest/edge: git-2b6b394 2021-02-23 (408) 8MB classicinstalled: 1.1 (257) 12MB classic

      I tried to repack the ISO, and I got as well

      Error: unknown command "repack-windows" for "distrobuilder"Run 'distrobuilder --help' for usage.

      Ok, this is embarrassing and thanks for reporting. Above it show that I have installed distrobuilder from the stable, published on the 20th of January 2021. But that is not recent enough. We need to refresh our distrobuilder so that it comes from the edge channel for now. Once the version from the stable channel gets updated, we can switch back to the stable channel.

      Here is how to switch from the stable channel to the edge channel.

      sudo snap refresh distrobuilder --edge

      I am updating the post as well on this.
      Thanks for reporting!

      Loading...

        • How to run a Windows virtual machine on LXD on Linux (6)
        • Mihail Igoshin on March 3, 2021 at 19:27
        • #
        • Reply

        Thanks. 🙂

        Loading...

    • How to run a Windows virtual machine on LXD on Linux (7)
    • Mihail Igoshin on March 3, 2021 at 20:25
    • #
    • Reply

    I’ve got error:

    “Error: Required tool “hivexregedit” is missing”

    After fast google solution seems to be:

    sudo apt-get install libguestfs-tools

    Loading...

      • How to run a Windows virtual machine on LXD on Linux (8)
      • Simos Xenitellis on March 4, 2021 at 08:34
        Author
      • #
      • Reply

      Thanks for this. Apparently, my test system is not vanilla any more 🙁 and I have to reinstall.
      I’ll update accordingly.

      Loading...

    • How to run a Windows virtual machine on LXD on Linux (9)
    • Tett on April 26, 2021 at 11:17
    • #
    • Reply

    root@lxd1:/# sudo distrobuilder repack-windows –windows-version=w10 path/to/iso/windows.iso path/to/iso/windows_distrobuilder.iso
    INFO Mounting Windows ISO
    INFO Mounting driver ISO
    INFO Modifying WIM file {“file”: “boot.wim”, “index”: 2}
    Error: Failed to retrieve wim file information: Failed to run: wimlib-imagex info /var/cache/distrobuilder.271484116/overlay/sources/install.wim: [ERROR] Can’t open “/var/cache/distrobuilder.271484116/overlay/sources/install.wim” read-only: No such file or directory
    ERROR: Exiting with error code 47:
    Failed to open a file

    Loading...

      • How to run a Windows virtual machine on LXD on Linux (10)
      • Simos Xenitellis on April 26, 2021 at 20:27
        Author
      • #
      • Reply

      Hi!

      Most likely you have a corrupted virtio-win.iso file.

      When you run distrobuilder to repack the Windows ISO, it downloads the virtio-win.iso from https://fedorapeople.org/groups/virt/virtio-win/direct-downloads/latest-virtio/virtio-win.iso and puts it into /tmp/distrobuilder/.

      This download is about 500MB and if you interrupt it, distrobuilder keeps that incomplete cached version and does not erase it.

      Then, if you run again distrobuilder to repack the Windows ISO, distrobuilder will not check whether the virtio-win.iso is intact, and will try to use it. Obviously it will fail.

      The workaround is to remove the incomplete file so that `distrobuilder downloads it again.

      sudo rm /tmp/distrobuilder/virtio-win.iso

      If you run a slow internet connection (like mobile internet), then you can also do the following. The -c flag will Continue the download from where it was interrupted.

      cd /tmp/distrobuilder/sudo wget -c https://fedorapeople.org/groups/virt/virtio-win/direct-downloads/latest-virtio/virtio-win.iso

      Loading...

    • How to run a Windows virtual machine on LXD on Linux (11)
    • aamcatamney on April 26, 2021 at 16:30
    • #
    • Reply
      • How to run a Windows virtual machine on LXD on Linux (12)
      • Simos Xenitellis on April 26, 2021 at 20:41
        Author
      • #
      • Reply

      Hi!

      See above reply.

      Loading...

    • How to run a Windows virtual machine on LXD on Linux (13)
    • aamcatamney on April 27, 2021 at 00:46
    • #
    • Reply

    Hey Simos,
    Thanks for your replay. I have tried your steps and I am still getting the same error.
    I have also tried chaning the cache dir and running in debug mode to try and get more info:

    2021-04-26T23:44:32Z DEBUG distrobuilder/main_repack-windows.go:566 Updating Windows registry {“hivefile”: “DRIVERS”}
    2021-04-26T23:44:33Z DEBUG distrobuilder/main_repack-windows.go:573 Updating Windows registry {“hivefile”: “SYSTEM”}
    2021-04-26T23:44:33Z DEBUG distrobuilder/main_repack-windows.go:580 Updating Windows registry {“hivefile”: “SOFTWARE”}
    Error: Failed to retrieve wim file information: Failed to run: wimlib-imagex info /home/anthony/cache/overlay/sources/install.wim: [ERROR] Can’t open “/home/anthony/cache/overlay/sources/install.wim” read-only: No such file or directory
    ERROR: Exiting with error code 47:
    Failed to open a file.

    I have also tried manually downloading the files.
    Do you think there has been a breaking change with virtio-win.iso or distrobuilder?

    Loading...

      • How to run a Windows virtual machine on LXD on Linux (14)
      • Simos Xenitellis on April 27, 2021 at 18:29
        Author
      • #
      • Reply

      I get the same errors and cannot figure out what configuration remains on the system that causes the errors. I even purged distrobuilder before installing again. Still, the same error.

      So I decided to start from a clean system, and launched a VPS with Ubuntu 20.04. I downloaded the Windows ISO through that VPS and run the command. It worked fine, and finally I downloaded the generated .iso.

      See my comment below for the full list of commands. In addition, I updated this post.

      Loading...

    • How to run a Windows virtual machine on LXD on Linux (15)
    • Tett on April 27, 2021 at 05:36
    • #
    • Reply

    Could u provide a fresh command list ? coz I dont know after puts virtio-win.iso file into tmp location then what will the command procedure . Plz give us a command list

    Loading...

      • How to run a Windows virtual machine on LXD on Linux (16)
      • Simos Xenitellis on April 27, 2021 at 18:32
        Author
      • #
      • Reply

      See my comment below that shows how to use a VPS to do the distrobuilder work there. By doing so, you are guaranteed to have a clean system.

      Can you tell me which version of Ubuntu you have? The distrowatch snap, having the classic confinement, depends on the host’s packages. Therefore, it might be an issue relating to particular host packages.

      Loading...

    • How to run a Windows virtual machine on LXD on Linux (17)
    • Simos Xenitellis on April 27, 2021 at 18:22
      Author
    • #
    • Reply

    I have tried the whole process from scratch and have updated the whole post accordingly.
    To make sure I have a clean Ubuntu 20.04 LTS system, I created a $5 VPS (Linode, in my case) and run the following exact commands.

    Note the Windows ISO URL. I attempted a download from my desktop just to let it download a bit and then click on the Firefox download manager to Copy Download Link. Then, I pasted that command in the wget command below. It got downloaded at 35MB/s :-). Therefore, replace with your download link from Firefox, and cancel the download from your desktop. The next command to the wget is to rename (mv) the file so that the filename is cleaned up.

    snap install distrobuilder --classicwget 'https://software-download.microsoft.com/pr/Win10_20H2_v2_EnglishInternational_x64.iso?t=...'mv Win10_20H2_v2_EnglishInternational_x64.iso\?t\=... Win10_20H2_v2_EnglishInternational_x64.isosudo apt install -y libguestfs-tools wimtoolsdistrobuilder repack-windows Win10_20H2_v2_EnglishInternational_x64.iso Win10_20H2_v2_EnglishInternational_x64-distrobuilder.iso

    Here is the generated file,

    root@localhost:~# ls -ltotal 12392636-rw-r--r-- 1 root root 6475390976 Apr 27 16:55 Win10_20H2_v2_EnglishInternational_x64-distrobuilder.iso-rw-r--r-- 1 root root 6214653952 Nov 20 08:19 Win10_20H2_v2_EnglishInternational_x64.isodrwxr-xr-x 4 root root 4096 Apr 27 16:35 snaproot@localhost:~# 

    You can use either SSH to download the ISO, or install a Web server like nginx, and place the ISO there. Normally, you would use SSH for integrity purposes. We show how to use nginx here.

    root@localhost:~# sudo apt install -y nginxroot@localhost:~# sudo mv Win10_20H2_v2_EnglishInternational_x64-distrobuilder.iso /var/www/html/root@localhost:~# 

    And finally, from your desktop computer, download the ISO. Use the -c flag to continue the download in case it gets interrupted.

    wget -c _IPADDRESS_OF_MY_VPS_/Win10_20H2_v2_EnglishInternational_x64-distrobuilder.iso

    And that’s it! Do not forget to destroy the VPS once you are done.

    I do not know what went wrong with the previous instructions. I do too get those errors when I run the repack-windows command on my desktop. I have tested the above instructions with distrobuilder from the edge channel and it still worked.

    Loading...

    • How to run a Windows virtual machine on LXD on Linux (18)
    • Tett on May 2, 2021 at 09:05
    • #
    • Reply
    root@lxd1:/path/to/iso# sudo snap install distrobuilder --classicsnap "distrobuilder" is already installed, see 'snap help refresh'root@lxd1:/path/to/iso# sudo apt install -y libguestfs-tools wimtoolsReading package lists... DoneBuilding dependency treeReading state information... Donelibguestfs-tools is already the newest version (1:1.40.2-7ubuntu5).wimtools is already the newest version (1.13.1-1).0 upgraded, 0 newly installed, 0 to remove and 52 not upgraded.root@lxd1:/path/to/iso# sudo distrobuilder repack-windows Win10_20H2_English_x64.iso Win10_20H2_English_x64_distrobuilder.isoINFO Mounting Windows ISOINFO Mounting driver ISOINFO Modifying WIM file {"file": "boot.wim", "index": 2}INFO Modifying WIM file {"file": "install.wim", "index": 1}INFO Modifying WIM file {"file": "install.wim", "index": 2}INFO Modifying WIM file {"file": "install.wim", "index": 3}INFO Modifying WIM file {"file": "install.wim", "index": 4}INFO Modifying WIM file {"file": "install.wim", "index": 5}INFO Modifying WIM file {"file": "install.wim", "index": 6}INFO Modifying WIM file {"file": "install.wim", "index": 7}INFO Modifying WIM file {"file": "install.wim", "index": 8}INFO Modifying WIM file {"file": "install.wim", "index": 9}INFO Modifying WIM file {"file": "install.wim", "index": 10}INFO Modifying WIM file {"file": "install.wim", "index": 11}INFO Generating new ISOroot@lxd1:/path/to/iso# lxc init win10 --empty --vm -c security.secureboot=falseCreating win10root@lxd1:/path/to/iso# lxc config device override win10 root size=30GiBDevice root overridden for win10root@lxd1:/path/to/iso# lxc config device add win10 iso disk source=/path/to/iso/windows.iso boot.priority=10 windows.isoroot@lxd1:/path/to/iso# lxc config device add win10 iso disk source=/path/to/iso/Win10_20H2_English_x64_distrobuilder.iso boot.priority=10 Device iso added to win10root@lxd1:/path/to/iso# lxc start win10 --console=vgaX11 connection rejected because of wrong authentication.Unable to init server: Could not connect: Connection refused(remote-viewer:4176671): Gtk-WARNING **: 08:02:40.776: cannot open display: localhost:10.0

    stack in this state. I have ubuntu 20.04 and lxd 4.13. Where is fault?

    Loading...

      • How to run a Windows virtual machine on LXD on Linux (19)
      • Simos Xenitellis on May 2, 2021 at 20:04
        Author
      • #
      • Reply

      Hi!

      You are running the LXD commands as root and I suppose that you are connected to your host as a non-root user.
      You should log out from root and go back to your non-root user account (such as user or ubuntu).
      To verify that you can run X11 apps from within an account from the terminal, try to run xclock. If it works, you are good to go.

      Also, the message says localhost:10.0. Normally, if you run echo $DISPLAY, it should say something like :0 or :1.
      You typically get localhost:10.0 when you connect to the system through SSH. If that is the case, you should use ssh -X (i.e. add the -X parameter) in order to enable X11 forwarding. If it still does not work, use -Y instead (trusted X11 forwarding). If it still fails, describe your setup so that I cat try to replicate.

      Loading...

    • How to run a Windows virtual machine on LXD on Linux (20)
    • Tett on May 5, 2021 at 10:54
    • #
    • Reply

    I am trying it to by non root user and it shows bellow error

    tech@lxd1:~$ lxc start win10 –console=vga
    Unable to init server: Could not connect: Connection refused

    (remote-viewer:50182): Gtk-WARNING **: 09:51:01.766: cannot open display:

    I have comment out

    #AllowAgentForwarding yes
    #AllowTcpForwarding yes
    #GatewayPorts no
    X11Forwarding yes
    #ForwardX11 yes
    #ForwardX11Trusted yes
    #X11DisplayOffset 10
    #X11UseLocalhost yes
    #PermitTTY yes
    #PrintMotd no
    #PrintLastLog yes
    #TCPKeepAlive yes
    #PermitUserEnvironment no
    #Compression delayed
    #ClientAliveInterval 0
    #ClientAliveCountMax 3
    #UseDNS no
    #PidFile /var/run/sshd.pid
    #MaxStartups 10:30:100
    #PermitTunnel no
    #ChrootDirectory none
    #VersionAddendum none

    Loading...

      • How to run a Windows virtual machine on LXD on Linux (21)
      • Simos Xenitellis on May 6, 2021 at 10:11
        Author
      • #
      • Reply

      I asked about the localhost:10.0 part, and why you get 10.0.

      I used SSH to connect from my system to my system (i.e. ssh localhost), and I got

      $ echo $DISPLAYlocalhost:10.0

      I also tried to start the win10 VM through the SSH session and I also got the same error,

      $ lxc start win10 --console=vgaX11 connection rejected because of wrong authentication.Unable to init server: Could not connect: Connection refused(remote-viewer:19881): Gtk-WARNING **: 12:00:17.968: cannot open display: localhost:10.0^C^C^C^\SIGQUIT: quit

      Therefore, you are connecting with SSH to the LXD host and want to run the GUI of Win10 through X11 forwarding.

      Get a shell to the LXD host and install x11-apps and mesa-utils. These will give you the xlock application, and the glxgears GL application.
      You can see that both run fine from the remote LXD host. Below, I ssh to localhost for demonstration purposes.

      $ ssh -X localhost$ echo $DISPLAYlocalhost:10.0$ xclock # you see the clock. This is a pure X11 application.^C$ glxgears # you see the gears. This is a GL application.^C$ lxc start win10 --console=vgaX11 connection rejected because of wrong authentication.Unable to init server: Could not connect: Connection refused(remote-viewer:19881): Gtk-WARNING **: 12:00:17.968: cannot open display: localhost:10.0^C^C^C^\SIGQUIT: quit

      Therefore, something is happening in LXD and most likely it is a bug in LXD.
      As long as you can run other GUI applications, you should be able to run the remote viewer.

      Visit https://github.com/lxc/lxd/issues and file a bug report.
      Mention that you connect to the LXD host with SSH. And while you can run X11 and GL applications
      through X11 forwarding, you cannot get the remote viewer for the Win10 VM to work.

      Loading...

    • How to run a Windows virtual machine on LXD on Linux (22)
    • Tett on May 5, 2021 at 10:59
    • #
    • Reply

    root user shows

    root@lxd1:~# echo $DISPLAY
    localhost:10.0

    sudo user shows no output

    tech@lxd1:~$ echo $DISPLAY

    tech@lxd1:~$

    Loading...

    • How to run a Windows virtual machine on LXD on Linux (23)
    • Jim McCulloch on May 8, 2021 at 21:36
    • #
    • Reply

    This is a massive pain! I started 7 hours ago, I got to and saw the Windows install screen once 2 hours ago and I can’t get back to it after 3 hours of trying to get the install started. On the positive side this site got me further along than any other.

    Loading...

      • How to run a Windows virtual machine on LXD on Linux (24)
      • Simos Xenitellis on May 8, 2021 at 23:12
        Author
      • #
      • Reply

      Do you get a specific error or is it just general slowness?

      Things to do to get better performance:
      1. Use ZFS or btrfs for the storage pool in LXD. dir is likely bad for performance.
      2. A VM needs much more RAM than a system container. If you have less than 8GB of total RAM, you should look into this.

      An LXD VM uses qemu behind the scenes and does not implement virtualization from scratch. If you install virt-manager, you will be able to manage the same VM and perhaps fine-tune it.

      Loading...

    • How to run a Windows virtual machine on LXD on Linux (25)
    • Jim McCulloch on May 11, 2021 at 05:22
    • #
    • Reply

    Thanks for the reply Simos.

    I spent the majority of the mostly sleepless weekend working on it. What I finally found was that the drive that it was being installed on was way to small and didn’t resize. I think I found that with ‘lxc info –show-log win10’. It showed that the drive had 0 bytes left. I really think this is the issue. How do I select which drive it is installed on?

    I am not a Linux expert in any sense of the word, I’ve dabbled in Linux since the mid to late 90’s when it was a massive pain to get a Desktop up and running until now. Those times were spaced out generously.

    PC: HP ProLiant DL360p Gen8 – Xeon 2640 x2 at 2.5GHz – 64GB RAM – 8 600GB SAS 10K Drives in a couple of various RAID configurations. Performance shouldn’t be an issue.

    OS: Ubuntu 20.04

    Windows 10 will not install for the above reason. My lack of current knowledge of Linux probably.
    However I’ve read that you can change the number of CPUs and amount of memory for container.

    Any help would be very much appreciated and thanks again for the reply.

    Loading...

      • How to run a Windows virtual machine on LXD on Linux (26)
      • Simos Xenitellis on May 11, 2021 at 12:17
        Author
      • #
      • Reply

      Hi Jim!

      When you setup LXD, you allocate space that will be used for the containers and virtual machines. This space has to be big enough so that when you instruct Win10 to use, let’s say, 30GB, then LXD should have that space available somewhere.

      Let’s look into these in detail.

      With the following, you can see the available storage pools in LXD; where LXD can store containers and virtual machines. Here you can see that my storage pool is called lxd, uses ZFS in some way to organize the space, and I have 34 instances (either containers or virtual machines!). Obviously, when I do not use an instance, I stop it so save precious memory.

      $ lxc storage list+------+--------+--------+-------------+---------+| NAME | DRIVER | SOURCE | DESCRIPTION | USED BY |+------+--------+--------+-------------+---------+| lxd | zfs | lxd | | 68 |+------+--------+--------+-------------+---------+

      But, what about the space?
      You can run the following, where lxd is the name of the storage pool in my case. In my case, I use a disk partition for ZFS.

      $ lxc storage show lxdconfig: source: lxd volatile.initial_source: /dev/sdd8 zfs.pool_name: lxddescription: ""name: lxddriver: zfs...

      Now, I am able to run the following and will show me the total size and the free space available.

      zpool list

      Go through these steps and report back the free space available. Most likely you use a storage pool with a loop file, and the space in that file has been exhausted. There are ways around the issue, and we will explore them once we have an idea about the diskspace picture.

      Loading...

    • How to run a Windows virtual machine on LXD on Linux (27)
    • James McCulloch on May 12, 2021 at 01:42
    • #
    • Reply

    Simos,

    I missed the entire lxd step. I started the whole process on this page. Here is the output from your reply, I new I was missing something, just didn’t know what it was. Do you have a page on the lxd configuration? Thanks for the generous help,

    $ lxc info --show-log win10Name: win10Location: noneRemote: unix://Architecture: x86_64Created: 2021/05/09 14:55 UTCStatus: StoppedType: virtual-machineProfiles: defaultPid: -1Resources: Processes: 0 Disk usage: root: 52.18MBError: open /var/snap/lxd/common/lxd/logs/win10/qemu.log: no such file or directory
    $ lxc storage list+---------+--------+---------+-------------+---------+| NAME | DRIVER | SOURCE | DESCRIPTION | USED BY |+---------+--------+---------+-------------+---------+| default | zfs | default | | 2 |+---------+--------+---------+-------------+---------+
    $ lxc storage show lxdError: not found

    Jim

    Loading...

      • How to run a Windows virtual machine on LXD on Linux (28)
      • Simos Xenitellis on May 14, 2021 at 11:27
        Author
      • #
      • Reply

      James, from what I can see, you have used the defaults when you set up LXD. Your storage pool uses ZFS, and most likely over a loop file. This means that LXD pre-allocated the space for you, and this is a fixed number of GBs.

      The last command that you tried, should be lxc storage show default, because default is the name of the storage pool from the previous command. The lxc storage show default will definitely show whether you are using a loop file (a big file that is formatted as ZFS), or a partition (like /dev/sdb4).

      At this stage you can run zpool list, which will show you the size of the storage pool, how much is allocated and how much is free.

      So, what do you do if you are stuck with a small storage pool? Being Linux and all, there are too ways around it. The obvious one is to tear everything apart and reinstall from scratch. When you run sudo lxd init this time, you would allocate more space. But that would be too easy.

      First, if you have a spare partition, with 80GB or more, then it would be great to put there the storage pool. ZFS on a block partition (instead of a loop file) is even more performant. If that is the case, then tell me to show you the lxc storage commands to create a second storage pool, and move your existing containers/VMs over to the second storage pool. Finally, you make the second storage pool the new default storage pool (and can get rid of the first one).

      Second, if you have lots of free space on your root partition (i.e. the / partition), then you can create an additional second storage pool. Now, this can be tricky if you have created separate / and /home/ partitions, and opted to allocate just 30-40GB for / as most installation guides say.

      Loading...

    • How to run a Windows virtual machine on LXD on Linux (29)
    • Don Chai on June 4, 2021 at 15:35
    • #
    • Reply

    Having these errors while installing it on LXD v4.8, ARM64 RaspberryPi4B8GB, Ubuntu 21.04 (Node #2/3 cluster)

    user@rpi2:~$ lxc info –show-log win10
    Name: win10
    Location: rpi2
    Remote: unix://
    Architecture: aarch64
    Created: 2021/06/04 14:02 UTC
    Status: Stopped
    Type: virtual-machine
    Profiles: default

    Log:

    Error screenshot: https://tinyurl.com/2cnz5s6w

    Any pointer to move forward from the errors?

    Loading...

      • How to run a Windows virtual machine on LXD on Linux (30)
      • Simos Xenitellis on June 5, 2021 at 11:55
        Author
      • #
      • Reply

      Hi!

      The first paragraph in the screenshot says that it could not find a disk.
      And the next paragraphs show the attempt to use PXE, which is a network booting protocol.

      Since you are running this on the RPi4, I suppose you are already familiar with the special instructions at https://www.worproject.ml/
      There should be a few more steps to get from https://www.worproject.ml/ to running distrobuilder which I have not tried.

      Loading...

    • How to run a Windows virtual machine on LXD on Linux (31)
    • donchai on June 7, 2021 at 15:22
    • #
    • Reply

    Thanks Simos,

    Progress thus far,

    Managed to convert to ISO particularly for ARM64 via uup by scripts from worproject (thanks for pointing out), and done distrobuilder (about 6GB+) in rpi#2. Boot into CD/DVD… on Ubuntu desktop (new cluster node#4/4 on x86_64 platform) with spice installed and got this “Guest disabled display.” right after after boot progress bar complete, argh…

    Still need more luck, shall keep trying.

    Progress screenshots:

    https://tinyurl.com/stz585kw

    https://tinyurl.com/44m457yp

    Loading...

      • How to run a Windows virtual machine on LXD on Linux (32)
      • Simos Xenitellis on June 8, 2021 at 11:35
        Author
      • #
      • Reply

      The message Guest disabled display is a Qemu error message. Something is wrong with the piping of the display of the VM to a window on the host. spice is a bit more advanced from the default VNC way.

      In the snap package of LXD for ARM, do you get libspice-server.so somewhere in /snap/lxd/current/?

      Loading...

    • How to run a Windows virtual machine on LXD on Linux (33)
    • Don on June 8, 2021 at 17:45
    • #
    • Reply

    Yeah Simos,

    Somehow it’s located under aarch64-linux-gnu folder as below.

    /snap/lxd/current/lib/aarch64-linux-gnu/libspice-server.so

    Screenshot: https://tinyurl.com/2p65nk2v

    Loading...

    • How to run a Windows virtual machine on LXD on Linux (34)
    • Don on June 8, 2021 at 18:05
    • #
    • Reply

    Tried on Windows with remote viewer instead, not able to key anything on remote viewer screen and powershell thrown some critical spice errors.

    Error screenshot: https://tinyurl.com/yth8npte

    Loading...

    • How to run a Windows virtual machine on LXD on Linux (35)
    • Mihail Igoshin on July 5, 2021 at 20:10
    • #
    • Reply

    I have some issues, I’m unable to start properly the vm.
    $ lxd –version
    4.15

    $ lxc start win10 –console=vga
    LXD automatically uses either spicy or remote-viewer when present.
    As neither could be found, the raw SPICE socket can be found at:
    spice+unix:///home/igoshin/snap/lxd/common/config/sockets/776543779.spice

    $ lxc info –show-log win10
    Name: win10
    Location: none
    Remote: unix://
    Architecture: x86_64
    Created: 2021/07/05 19:01 UTC
    Status: Running
    Type: virtual-machine
    Profiles: default
    Pid: 418943
    Resources:
    Processes: -1
    Network usage:
    eth0:
    Bytes received: 5.34kB
    Bytes sent: 4.91kB
    Packets received: 20
    Packets sent: 22

    Log:

    warning: tap: open vhost char device failed: Permission denied
    warning: tap: open vhost char device failed: Permission denied

    Loading...

    • How to run a Windows virtual machine on LXD on Linux (36)
    • daalocni on July 15, 2021 at 07:34
    • #
    • Reply

    sorry for bad english
    hello, is it possible to do something like this in lxd windows vm https://blog.tmm.cx/2020/05/15/passing-an-intel-gpu-to-a-linux-kvm-virtual-machine/

    i tried adding the i915-GVTg_V5_4 profile as an mdev gpu to the instance, and it sort of worked, it was detected in windows and auto installed the driver, device manager says device ok and in task manager it also appears, but i noticed i was still only seeing display feed from virtual gpu, tried disabling that in device manager but after i no longer had display (black screen) in spicy and had to restore snapshot. have any ideas?

    Loading...

    • How to run a Windows virtual machine on LXD on Linux (37)
    • Stefan on August 23, 2021 at 18:23
    • #
    • Reply

    Just a note for users with a Ryzen based system who want to install WSL on their LXC Win10: Don’t do it. It will break your Win10 beyond repair, constant BSOD’s. Nested virtualization is not working yet. Took me 2 days to find this out. I Hope it will safe others some time.

    Loading...

    • How to run a Windows virtual machine on LXD on Linux (38)
    • Gordon on September 19, 2021 at 14:23
    • #
    • Reply

    Hello Simos,

    thanks your explanations. I have been trying to setup a Windows 10 VM under ArchLinux and LXD 4.18 – but w/e I tried when trying to initially boot I get thrown into a BSOD with a “System Thread Exception Not Handled” error message. I injected the necessary drivers beforehand using distrobuilder and am using that .iso to boot up.

    Using that very same .iso and creating a VM under libvirt works perfectly fine and boots into the Windows installer which I don’t even see when trying to use LXD.

    My google-fu is failing me it seems – any thoughts on this?

    Thanks!

    Loading...

    • How to run a Windows virtual machine on LXD on Linux (39)
    • manuelll on November 10, 2021 at 00:39
    • #
    • Reply

    Hello Simos,

    thank you for this great tutorial eveything is working like a charm.
    I notice only one problem, i cant set a proper display resolution, inside windows settings is set to 800×600 and the menu is greyed out.
    I have tried to update gpu driver from win10 lxc without success, any thoughts on this? thank you in advance

    Loading...

    • How to run a Windows virtual machine on LXD on Linux (40)
    • GreenLepra on November 13, 2021 at 10:15
    • #
    • Reply

    Is there any way to use shiftfs with this ?

    Loading...

    • How to run a Windows virtual machine on LXD on Linux (41)
    • Michał on June 2, 2022 at 19:11
    • #
    • Reply

    Simos,

    What a great blog post! Thanks to you I have set up Win 10 VM as smoothly as it could be. Also thanks for your other posts, as I’ve found they are always helpful and you often provide some critical information, which other people miss. Thanks!

    Loading...

    • How to run a Windows virtual machine on LXD on Linux (42)
    • Jesse on August 15, 2022 at 15:26
    • #
    • Reply

    Hi Simos,
    I’m stuck on this error. Any assist would be much appreciated.

    INFO[2022-08-15T14:24:25Z] Mounting Windows ISO
    mount: /var/cache/distrobuilder.3961891372/source: WARNING: device write-protected, mounted read-only.

    Loading...

    • How to run a Windows virtual machine on LXD on Linux (43)
    • DoctorBurp on February 19, 2023 at 15:03
    • #
    • Reply

    Hi Simos,

    I’v followed the guide are, tried both Win10 and Win11, however I’m always end up in a shell screen (Shell>) instead of windows installation.

    Instance info:
    Resources:
    Processes: -1
    Disk usage:
    root: 23.00KiB
    Network usage:
    eth0:
    Type: broadcast
    State: UP
    Host interface: tapce1c3d68
    MAC address: 00:16:3e:48:7b:e7
    MTU: 1500
    Bytes received: 6.30kB
    Bytes sent: 5.39kB
    Packets received: 36
    Packets sent: 27
    IP addresses:
    inet6: fd42:1444:fd53:adc6:216:3eff:fe48:7be7/64 (global)
    inet6: fe80::216:3eff:fe48:7be7/64 (link)

    Log:
    warning: tap: open vhost char device failed: Permission denied
    warning: tap: open vhost char device failed: Permission denied

    Could you please help?

    Loading...

    • How to run a Windows virtual machine on LXD on Linux (44)
    • brian mulllan on March 23, 2023 at 01:17
    • #
    • Reply

    Simos
    I have a need to create a LXD Win7 VM to support a legacy application.

    The problems I encounter trying to follow/use your instructions are:
    1) Distrobuilder doesn’t support Windows 7
    2) Unlike Windows 10/11 that have VIRTIO drivers embedded in the install media… Windows 7 does not as the virtio for Win7 is a separate virtio.iso file.

    In your instructions because its involving Win10 only loads the win10.iso which has virtio embedded.

    I can’t figure out how to add 2 ISOs (one for the win7.iso and one for the virtio.iso)

    If I only do the win7 .iso the installer starts but gets to the point where it says it can’t find Windows Drivers (so the Installer needs that virtio.iso drivers included

    Do you have any clues as to how to do that?

    brian

    Loading...

    • How to run a Windows virtual machine on LXD on Linux (45)
    • Jason Pell on April 26, 2023 at 04:18
    • #
    • Reply

    I found it’s important to hit the enter key when prompted in the viewer to boot from the CD / DVD, something I did not do initially and then I get the error similar to what some others have reported.

    Loading...

    • How to run a Windows virtual machine on LXD on Linux (46)
    • Konrad on April 28, 2023 at 22:06
    • #
    • Reply

    Can’t install Windows 2012, digital signature fail after booting from ISO preparated by Distrobuilder, normal ISO starting correctly but needs some drivers for disk.

    Loading...

    • How to run a Windows virtual machine on LXD on Linux (47)
    • aurelien on June 20, 2023 at 09:22
    • #
    • Reply

    Hi,

    Is it possible to run your solution without KVM?

    Best regards

    Loading...

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.

Recents posts

  • How to install and setup the Incus Web UIMarch 29, 2024
  • How to run an Incus VM inside an Incus VM (nested virtualization)March 27, 2024
  • How to manage the files of several Incus containers from a separate Incus containerMarch 14, 2024
  • How to customize Incus containers with cloud-initFebruary 3, 2024
  • How to run a Windows virtual machine on Incus on LinuxFebruary 1, 2024
  • Simos Xenitellis on How to run a Windows virtual machine on Incus on Linux
  • brian mullan on How to run a Windows virtual machine on Incus on Linux
  • brian mullan on How to run a Windows virtual machine on Incus on Linux
  • How to install and setup the Incus Web UI – Mi blog lah! on Migrating to Incus from LXD
  • Simos Xenitellis on How to install and setup the Incus Web UI

webpage

  • Προσωπική Σελίδα
How to run a Windows virtual machine on LXD on Linux (2024)
Top Articles
Latest Posts
Article information

Author: Kieth Sipes

Last Updated:

Views: 5589

Rating: 4.7 / 5 (67 voted)

Reviews: 82% of readers found this page helpful

Author information

Name: Kieth Sipes

Birthday: 2001-04-14

Address: Suite 492 62479 Champlin Loop, South Catrice, MS 57271

Phone: +9663362133320

Job: District Sales Analyst

Hobby: Digital arts, Dance, Ghost hunting, Worldbuilding, Kayaking, Table tennis, 3D printing

Introduction: My name is Kieth Sipes, I am a zany, rich, courageous, powerful, faithful, jolly, excited person who loves writing and wants to share my knowledge and understanding with you.