Run Proxmox lxc container on lxd - LXDoNe

Hello, I want to run the Proxmox lxc containers in the opennebula V5.6. I tried to copy the contents of the lxc container into an lxd ext4 image, but I get the following error in the nebula log, when try to deploy CT:

[Z0][VMM][I]: raise exceptions.LXDAPIException(response)
[Z0][VMM][I]: pylxd.exceptions.LXDAPIException: file does not exist

The normal lxd of nebula Apps work without problems!
Can anybody tell me how to convert lxc to lxd to work in nebula?

Hello,

Proxmox containers, AKA templates in PVE, is just plain rootfs compressed in a tar.gz file, which then is decompressed in the rootfs directory of the container directory. LXD images are the uncompressed tar.gz rootfs plus metadata. So, the quick fix would be to replace the rootfs content of a lxd container with the proxmox container rootfs, and then dump meta + rootfs into a raw image.

You can read https://github.com/OpenNebula/addon-lxdone/blob/master/Image.md to know a bit of LXD image tinkering. You can also check older versions of that file, which had more tinkering with plain LXC https://github.com/OpenNebula/addon-lxdone/commit/51b1c8f74c19593006866f3ed5a540789af27bce.

Thanks, I just did not understand how exactly, for example, I’m doing a backup of the container in proxmox that is in the tar. For example, and the uncompressed content dump it in .img or what metadata dump and what the contents of the lxd image? For example:
–/var
–/root

or
…rootfs/var
…rootfs/root

Because I have already tried the contents of the proxmox container dump into a raw image, but it did not work.
Тhanks in advance! :slight_smile:

LXD structure:

— container_dir
|- rootfs/
|- templates/
|- metadata.yaml

That is what you get when you decompress a regular LXD unified tar.gz image (there are two image formats, unifed and split. The latest has a tar.gz for metadata and another tar.gz for rootfs). Try listing the container directory. This is an example of a container called package-build.

[gram dann1]# ls -lh /var/lib/lxd/containers/package-build/
total 11K
-r--------  1 root  root  1,8K ago  2 15:34 backup.yaml
-rw-r--r--  1 root  root  1,5K mar 18 19:40 metadata.yaml
drwxr-xr-x 21 root  root  3,5K ago  2 15:34 rootfs
drwxr-xr-x  2 dann1 dann1 3,5K nov  2  2016 templates

The proxmox template creates a tar from the content of the previous rootfs dir.

If you successfully convert your container, can you make a pull request with this specific use case for Proxmox, in order to make it visible on https://github.com/OpenNebula/addon-lxdone/blob/master/Image.md. There could be a lot of people thinking about migrating from a virtual infrastructure manager to a full stacked cloud platform as OpenNebula due to the container support.

Thanks a lot, already works! And the context for the hostname only works in context and not just user and password. I have installed addon-context-linux-lkd on the container. What else is needed to set a user and password through the context?
Thank you again!

Well, I haven’t tried contextualizing the user, didn’t know it was possible. I know you can set the password for the root user if you set a field PASSWORD = “password” in the context custom vars. This should be all supported, since addon-context-linux-lxd just removed some of the new required dependencies unneeded for LXD, and improved network contextualization. But again, I’ve just tested the network contextualization, since it was practically my only need.

Yes with:
PASSWORD = “password”,
USERNAME = “user”
and work with image from Nebula Apps, but the proxymox container does not work by default by going into the container and trying to log in with root does not give it to me, maybe it is because principe through ssh root auth is disable in proxmox.

Why would ssh disabled as root would be a problem ? If you create a user, then you should be able to log in with that user through ssh.