Running Windows 10 inside a lxc Container Part 1. (fail-city)
In this guide we follow another guide which inevitable AFAIK know shows it does not actually work like much of the internet advice.
This guide is a walk-through of all the things that are required to hopefully get (any) version of windows to run inside a lxc container. Contrary to many 'it is easy' guides they simply do not actually work.
Attempt 1: Try the Ubuntu guide from here: (failed)
First we will install lxc and snap. We will require snap to install distrobuilder
sudo apt install lxc snap
Check the configuration with:
lxc-checkconfig
You will see a configuration as:
Next we will install distribution builder:
sudo snap install distrobuilder
Now get yourself a Windows image from here. Once you have downloaded it it's probably easy to rename it something easy (we called ours W.iso). This differs from the standard guide in that you need to specify the --windows-version w10
sudo distrobuilder repack-windows --windows-version w10 W.iso Wnew.iso
- Next from here we will make a empty VM
lxc init win10 --vm --empty
- And then upgrade it's hard drive size:
lxc config device override win10 root size=50GB
- Next we will add TPM (Trusted Platform Module) which Windows requires.
lxc config device add win10 vtpm tpm path=/dev/tmp0
- Next we will add the CD-ROM virtually as in (note that it will want the full path to the windows iso)
lxc config device add win10 install disk source=/q2/qemu/win/Wnew.iso
- Next we can have a look at our virtual machine as it is setup:
lxc config device show win10
This instance we neglected to set the boot.priority option for the CDROM to high - and because of this it will falsely boot into the empty hard drive and stop.
lxc config device remove win10 install
lxc config device add win10 install disk source=/q2/qemu/win/Wnew.iso boot.priority=10
We then boot the cdrom (Failed)
So the guide(s) do not actually work. Let's try turning on secure boot:
lxc config set win10 security.secureboot=true
lxc stop win10 --force
lxc start win10 --console=vga
Failed.
What about this alternate guide at here? Well it is almost identical. It did not work either. Notes:
- It is noted that some of the iso's were for Windows 11, and probably this is under a lot of updates.
- What if we tried using the other .iso that was not modified by distrobuilder?
lxc config device remove win10 install
lxc config device add win10 install disk source=/q2/qemu/win/W.iso boot.priority=10
Still failed.
Attempt 2: Find an alternate .iso image of Windows Note - this might of worked from the windows side. For this guide's purposes we have no windows OS to work with.
Time to get resourceful. Next we will try installing rufus - and use it to pull older versions of Windows (because they are actually hard to find!) But we do not have windows - so we will run it through wine.
sudo apt install wine -y
Now we will install rufus from here
We try to run a portable version:
win rp.exe (we renamed it).
Next we try polling a portable version from v.322 from here - that also failed.
- Installing wine32 is very messy - however getting aptitude to do it cleaned it up successfully.
sudo apt install aptitude
sudo apt install wine32
That still effectively failed. Next add i386 architecture and try again.
sudo dpkg --add-architecture i386 && sudo apt update
Ubuntu is not wine32 friendly (aka piles of packages are mising.) But what can potentially be done is to try finding a verison of Linux that is wine32 friendly.