How do I lxc remote add from an ubuntu in wsl2?

HI folks, I keep going in circles with this, perhaps someone can point me on the right direction.

I’ve built a home lab with ubuntu server 22.04, set up lxd, and have several instances running.

On my windows machine I have set up wsl2 and installed the ubuntu image.

I’m trying to interact with my lxd remotely through my wsl2 ubuntu.

Snap doesn’t work on wsl2, is there a way to install the “client” lxd/lxc without using snap?
I was able to do that for windows, using chocolatey, so I do have lxc working on powershell, but not everything work, e.g. lxc shell vm01.

Should I be using another distro on wsl2 that doesn’t depend on snap?

I’ve tried ubuntu 18 but lxc is version 3.0.3 and I get the TLS error.

I’ve tried Debian without any luck either.

I’ve even tried to build from a release but I must be missing something.

cannot load io/fs: 
malformed module path "io/fs": missing dot in first path element

Any recomendations?

I cant give specific advise on wsl2 / ubuntu but from powershell;

Looks wrong, dont you have todo lxc shell myremote:vm01 ?

I suspect lxc shell is an internal alias.
I get these error messages:

 lxc shell
Error: Processing aliases failed: not supported by windows

lxc shell vm01
Error: Processing aliases failed: not supported by windows

Ignore what I posted, I looked at the source, no idea what im talking about sorry about that :sweat: Guess I do have some idea

Origianl post was something like:

Does the following work

lxc exec bash


and this works also

❯ lxc exec vm01 bash

that was easy…
didn’t think of that.

Great, happy hacking!

Don’t forget to mark as the solution if you have the time :smile:

thanks @turtle0x1, and I did mark it as a solution, but I’m looking for the solution to the wsl2 issue.
Your point is a good workaround for powershell not supporting the aliases.

Ah okay, no problem thought the wsl2 was just a work around!