Lxc file push/pull: "Instance not found"

I feel like I must be missing something super-obvious, but here it is. After upgrading a server, I have recreated two containers. I now want to push backup data onto those containers. However, using the commands “lxc file push” or “lxc file pull” I just get the message “Instance not found”. Trying verbose produces nothing more. The containers are running, I’ve obviously checked the names.

What could I be missing?

Edited to add: I’ve just found that other commands also give the same error: “lxc exec”, “lxc config”, etc… None of them recognize the containers. If it’s relevant, the server upgrade changed LXC/LXD from the apt version to the snap version. Perhaps something with the upgrade went wrong?

What does lxc list show?

You say you recreated the containers, but did you run sudo lxd.migrate after installing the snap?

This should then offer to remove the old apt lxc/lxd packages, otherwise you may find conflicts.

Thanks for your reply. The migrate process hung completely. There was some message about needing to change an entry in fstab, but the only entries in fstab are for the two disk partitions and and swap - nothing relevant to containers.

In the end, I deleted everything, installed the snap, and then re-created the containers. “lxc list” is empty, but “lxc-ls” shows the containers. Having looked around since then, I have a theory - perhaps you can confirm. Is it possible that LXC containers are not visible to LXD? I created the containers using “lxc-create” instead of “lxc launch”. I assumed that the two methods were basically equivalent, which may be wrong?

Yes any command that starts lxc- is unrelated to LXD and containers that exist in that system are not managed or visible by LXD.

Oof, ok, that’s what I was afraid of. It’s what happens when you don’t do this stuff very often. Thanks for the help!

You may find this helpful: