LXC Container on Windows without Proxmox?

G-mox

New Member
Feb 27, 2023
4
0
1
I have a Proxmox 7 4-node cluster running on Debian 11 Linux with ZFS and it works great. I've been using Proxmox since v4, so for some time now. No big issues to date.

However, I have a disaster recovery use case where I'd like to be able to take the zst backup files for one or two of my simple LXC containers and run them on Windows, without the need to do a full Proxmox installation first.

Has anyone tried this? Could it be done with WSL or some free virtualisation app?
 
I suppose this is at least windows professional edition, just spin up a hyper-v PVE and import the backup there. This should be the easiest method.
Thanks for the speedy response! I do have Win10-Pro so I can give that a go but I'm trying to avoid the weight of a full PVE installation - although it might be the most flexible option.

I suppose what I'm after is the spell I need to cast in order to run an LXC container (extracted from a Promox backup) in a WSL session - this would be the quickest and most lightweight solution and suit my current needs perfectly.
 
I suppose what I'm after is the spell I need to cast in order to run an LXC container (extracted from a Promox backup) in a WSL session - this would be the quickest and most lightweight solution and suit my current needs perfectly.
A quick googleing yields this article, which implies that LXD is possible on WSL2, so that you "only" need convert the PVE LX(C) container into plain old LXD and try that.
 
  • Like
Reactions: G-mox
A quick googleing yields this article, which implies that LXD is possible on WSL2, so that you "only" need convert the PVE LX(C) container into plain old LXD and try that.
Thanks, I thought I'd found a short cut by extracting the tar from from the zst backup and then importing that to WSL - it works in that the file system is all there, but no systemd init process means none of the services have started!
 
Here's my failed attempt in case it's of use to anyone or you can spot a quick way to sort the lack of systemd init.

My need is to be able to retrieve a backup of a Proxmox container from a cloud backup and run it on Windows as there are some key containers that it would be useful to have up and running as quickly as possible whilst rebuilding a PVE cluster after a catastrophic disaster (think fire or theft etc).

My method can run ok on WSL v1 or v2, but does have some limitations in that the containers should be unprivileged and not reliant on the original underlying OS at all - so no mountpoints or UID/GID maps, although there are ways to work around those kinds of issues once you have your precious container running again!

So assuming you have Windows Subsystem for Linux (WSL) and Virtual Machine Platform both enabled on your Windows PC, then It goes something like this:

1. Retrieve your PVE container backup from your cloud storage on to your Windows PC, let's say "D:\Data\MyLXC\vzdump-lxc-999.tar.zst"

2. Fire up a Powershell (as administrator) and run:
wsl --install --no-launch -d Ubuntu-22.04

3. Create a local user when prompted, then within the new Ubuntu container run:
sudo -i
apt -y install zstd
cd /mnt/d/Data/MyLXC
unzstd vzdump-lxc-999.tar.zst

When this completes you can close the Ubuntu window - we don't need it any more.

We're really just using this Ubuntu container to unpack the ZST file to a TAR. I chose to do it this way as it seems the ZST tools native to Windows are not yet stable for large archives. If this changes then Steps 2 & 3 above can be skipped by using a suitable Windows tool to extract the tar.


4. Back at (admin) Powershell:
wsl --set-default-version 2
wsl --import MyLXC D:\Data\MyLXC D:\Data\MyLXC\vzdump-lxc-999.tar

Note: I'd rather set the default WSL Version to v1, as WSL v1 has a couple of advantages over v2 relevant to this use case:
  1. Access to Windows filesystem is faster in v1 than v2
  2. v1 uses bridged network access rather than just NAT, so the container will have the same IP address as the host and be able to accept incoming connections without any further work (except perhaps allow it through Windows firewall)
However, the import process seems to fail with v1 so v2 it is!

You can check that your new container is there with wsl -l -v and start it with:
wsl -d MyLXC

After a short wait you'll be inside your running container - except you might find nothing has started due to a lack of SystemD :-/

However, I was able to start the processes I needed manually so not all is lost and this may still be sufficient for my disaster recovery needs!
 

About

The Proxmox community has been around for many years and offers help and support for Proxmox VE, Proxmox Backup Server, and Proxmox Mail Gateway.
We think our community is one of the best thanks to people like you!

Get your subscription!

The Proxmox team works very hard to make sure you are running the best software and getting stable updates and security enhancements, as well as quick enterprise support. Tens of thousands of happy customers have a Proxmox subscription. Get yours easily in our online shop.

Buy now!