Lxc export issue

Arch Linux
lxd --version 4.2
I use dir as storage backend.

During an export I experience a power loss and the operation don’t complete its process.
Now every time I try to do export I have this:

lxc export win2016std backup1.tar.gz --instance-only -v  --compression none 
 Error: Create backup: Backup "win2016std/backup0" already exists

I also delete the folder win2016std/backup0 thatI find on my FS but without success

And what are the command that I can use with compression option?
I try to use borg but without success

lxc list                                            
|     NAME     |  STATE  | IPV4 | IPV6 |      TYPE       | SNAPSHOTS |
| pgsql        | STOPPED |      |      | CONTAINER       | 1         |
| win2016std   | STOPPED |      |      | VIRTUAL-MACHINE | 0         |

lxc export pgsql --instance-only -v  --compression borg
Error: Create backup: Backup create: Error adding "/var/lib/lxd/storage-pools/pool/containers/pgsql/rootfs/bin/bash" as "backup/container/rootfs/bin/bash" to tarball: Failed to copy file content "/var/lib/lxd/storage-pools/pool/containers/pgsql/rootfs/bin/bash": io: read/write on closed pipe


@stgraber is there a way to delete the backup record from the lxc cli or will it require a manual SQL query?

1 Like

Do you have the borg command installed? And does that command allow files to be added via stdin?

I have similar issue with lzma also if with a config set commands:

lxc config set backups.compression_algorithm lzma
Error: cannot set 'backups.compression_algorithm' to 'lzma': exec: "lzma": executable file not found in $PATH
which lzma
echo $PATH

and yes also borg allow to added file via stdin:
When giving ‘-‘ as path, borg will read data from standard input and create a file ‘stdin’ in the created archive from that data.

Do you run LXD from snap?

Yes, from snap

@stgraber do you think we should be using shared.HostPath() here https://github.com/lxc/lxd/blob/068b04263a5819e2dc00feb41412289a40664e77/lxd/images.go#L147 so that external commands are used for compression, or should it only use the ones in the snap?

Sorry, but now I realize that may be I give you the wrong answer:

Do you run LXD from snap?

Do you mean if I install LXD with snap or pacman?

Yep, just checking whether you install LXD via snap, as it looks like the snap is not looking outside of its mount namespace for the compression tool specified.

sudo snap install lxd
2020-06-19T15:49:40+02:00 INFO Waiting for automatic snapd restart…
Warning: /var/lib/snapd/snap/bin was not found in your $PATH. If you’ve not restarted your session
since you installed snapd, try doing that. Please see https://forum.snapcraft.io/t/9469
for more details.

lxd 4.2 from Canonical✓ installed

It is also possible to redirect the output of export to stdout? In this way I can either backup with borg

Have similar issue also in import the image:

:/var/tmp$ lxc -v import /var/tmp/win2016.export
Importing instance: 100% (358.99MB/s)Error: exec: “lzma”: executable file not found in $PATH

I have to install lzma with snap?
Is it possible to install LXD 4 stable also with apt on ubuntu bionic ?
On arch I solved using lxd from aur, on bionic that is my production host I’m in trouble

I am just waiting on confirmation from @stgraber as to whether we only use the tools inside the snap for a reason or whether we can change this to look outside of the snap’s namespace.

1 Like

Tell me if I can do some test or try for you

Can you try using:

lxc config set backups.compression_algorithm /var/lib/snapd/hostfs/usr/bin/lzma

Have the follow:

lxc config set backups.compression_algorithm /var/lib/snapd/hostfs/usr/bin/lzma
Error: cannot set 'backups.compression_algorithm' to '/var/lib/snapd/hostfs/usr/bin/lzma': exec: "/var/lib/snapd/hostfs/usr/bin/lzma": stat /var/lib/snapd/hostfs/usr/bin/lzma: no such file or directory

Infact the folder doesn’t exist:

:/var/lib/snapd/hostfs$ pwd
:/var/lib/snapd/hostfs$ ls -lrt
total 0

I also try to setup a different folder for backup poupose and have similar behaiuovr:

root@charles:/data/lxdbkp# lxc storage create bkp_pool dir source=/data/lxdbkp
Error: Source path ‘/var/lib/snapd/hostfs/data/lxdbkp’ isn’t empty
ls -lrt /var/lib/snapd/hostfs/data/lxdbkp
ls: cannot access ‘/var/lib/snapd/hostfs/data/lxdbkp’: No such file or directory

Instead I have the folder /data/lxdbkp on FS.

lzma on Ubuntu is a symlink to xz which is included in the snap.

With the branch I sent earlier today, you’ll be able to set your compressor to xz -F lzma which will do what you want.

1 Like

How I can use that branch?
Now I’m on snap with 4.0.1 LTS

We’ll cherry-pick it to the snap over the coming days, it will also be in 4.0.2.

I have 2 laptops. A dell and an hp. Both are the same architecture ( x86_64).
I have test migration and all the remote features and they work perfect.
At the dell laptop i have an image.
I did

sudo lxc image export ImageName .

After that the tar.gz is created.

When i am still on dell laptop and i am doing

sudo lxc import imagename.tar.gz

i have an error which says

Error: Backup is missing index.yaml

When i am taking the same tar.gz to my other laptop ( hp ) i am taking another error which says

Importing instance: 100% (156.96MB/s)Error: Error reading backup file info: unexpected EOF

Any help ? ( Especially when moving the tar.gz to another laptop and trying to make the image there )