[LXD 5.2] working with a remote and a client instance of LXD

Hello :wave:

I installed LXD on a server and another LXD in my own workstation. I’m looking to use the LXD on the server to store some LXC project (images; configs; containers; …) and get those from my workstation.

I watched the stgraber’s video LXD token based remote authentication - YouTube

I have install the server same as the rpi used in the video. And on my workstation, I have installed the remote with the providing token (same as the dakara in the video). I have restricted my worksation user to use only a test project.

When I run lxc remote switch rpi I’m allowed to only show the lxc project.
When I run lxc image list I show the image aliased as debian11

But when I run lxc remote switch local to return on my local remote and then run lxc image list rpi: I don’t show any image.

This is the same problem with or without restricting my workstation to a project.

My goal is to be able to easly get or push image and containers from the workstation. And be able to provide those to other computer as well.

If you have any idea what is wrong for me.

EDIT. Something strange is I don’t see any tokens on the rpi remote using lxc config trust list-tokens but I added the workstation with a given one :thinking:

I wonder, does lxc image list rpi: --project test work?
If so, can you try running lxc project switch rpi:test and see if that solves it?

1 Like

That’s normal. The token is consumed when you do lxc remote add and so disappears from that list. You’ll see an entry in lxc config trust list though.

1 Like

Yes. These commands do the job. So I have to swich on the project and I work directly on the remote in this case.

Is there a way to get the project (or this references) on the workstation to work on it?

It is probably not a good pratice at all to want copy a project. Probably is better to create a project on the worksation to consume ressources given by the remote. As a local working project…

If I well understand the concept. In this use case, the remote can be used as a sources/backup repository. Right?

Also with this method I have an issue. Now I can copy a fresh downloaded image stored in my remote (rpi) using the command lxc image copy rpi:myimage --project myproject locale --alias myimage-dev.

The issue is when I try to init or launch container from this myimage-dev from commands lxc init myimage-dev c1 or lxc launch myimage-dev c1. I get the error:

Creating c1
Error: Failed creating instance record: Failed initialising instance: Invalid devices: Failed detecting root disk device: No root device could be found

I fix that after deleted my remote rpi project and recreating it without the profiles feature. And deleted the workstation project and recreating it with the network feature enable.

if anyone has any explanation for this problem.

If you look in your default profile on the default project you’ll see a device like;

    path: /
    pool: default
    size: 30GB
    type: disk

This default profile is attached to instances if profiles aren’t specified on creation and a result instances inheret their “root” disk device from this profile.

When you created a local project with the profiles feature flag enabled it doesn’t use the default profile (containing the root disk) from the default project. Its expected you’ll recreate a new “default” profile defining a root disk in the new project.

1 Like

Okay :slight_smile:

I think I’m a bit confused because I has no instance. Just an aliased image copied from images:

But in state, at the issue time. I created a new project with profile feature enable. Switch on it to copy the image. After that. I go on my home worksation to create a profile with all features on. Switch on this project to get the image from the other machine. Then the error appear when running the:
lxc launch local:my_imported_image c1. And same result appear when I switch back to the default project to run the same command :thinking:

So images inherit things like devices from profile when I download it? Or the problem is more on my workstation and I don’t understand the problem ? :joy:

Ok. It is the source of my error. So after some reads here I found the answer to retrieve the same settings for the profile of the new project to be the same as the default project one.

Thanks for help :slight_smile: :+1:

No problem, sorry if my wording wasn’t particularly clear :see_no_evil:

Me too :laughing: