Lxc file push "Error: driver: bad connection"

I’m trying to push a folder into a container. The process fails

% lxc file push system toot/home/mastodon/live/public -r
Error: Failed to load container: Check if project has profiles: Fetch project config: driver: bad connection
% lxc file push system toot/home/mastodon/live/public -r
Error: driver: bad connection

I tried to delete the folder and start again, same result. What’s wrong?

I’m running Ubuntu 18.04, lxd is installed with snap (version 3.18, revision 12181).
Thank you for your help.

That’s usually indicative of a database problem on the LXD side.

I’d make sure you didn’t run out of disk space first (as that’s a pretty common source of problems) and if not, then run systemctl reload snap.lxd.daemon to restart LXD, then try again.

I have enough space, I increased the partition yesterday (btrfs file system). I managed to increase the partition size without rebooting the servers, can it be a source of problem? I see the right size in the containers.

Anyway, I reload lxd, same issue, different message

% lxc file push system toot/home/mastodon/live/public -r
Error: Post http://unix.socket/1.0/instances/toot/files?path=%2Fhome%2Fmastodon%2Flive%2Fpublic%2Fsystem%2Fmedia_attachments%2Ffiles%2F000%2F106%2F989%2Fsmall%2Fa507cad6e45bad5d.jpeg: read unix @->/var/snap/lxd/common/lxd/unix.socket: read: connection reset by peer

It made the container crashed.

I suspect a limitation of the command because I’m trying to transfer a large amount of data (73GB of small files). Some files are transferred, so I did a simple for loop to copy folder by folder. So far so good, I achieved to copy more files than in one shot, but the loop is still running (I guess it’s taking more time since it’s not optimal).

I manage to transfer all data. The issue was indeed a limitation of the command lxc file push. It seems that it cannot handle a large amount of small files. My work around was a for loop to push the folders one at the time.