Lxc export issue

Can you do: tar -tvf archive.tar.gz and show the output please (specifically the first few lines)

-rw-r–r-- root/root 1048 2020-07-22 19:50 metadata.yaml
drwxr-xr-x 0/0 0 2020-07-23 14:35 rootfs
drwxr-xr-x 0/0 0 2020-07-22 18:59 rootfs/bin
-rwxr-xr-x 0/0 1113504 2019-06-07 01:28 rootfs/bin/bash
-rwxr-xr-x 0/0 716464 2018-03-13 01:04 rootfs/bin/btrfs
-rwxr-xr-x 0/0 375952 2018-03-13 01:04 rootfs/bin/btrfs-debug-tree
-rwxr-xr-x 0/0 371856 2018-03-13 01:04 rootfs/bin/btrfs-find-root
-rwxr-xr-x 0/0 396432 2018-03-13 01:04 rootfs/bin/btrfs-image
-rwxr-xr-x 0/0 375952 2018-03-13 01:04 rootfs/bin/btrfs-map-logical
-rwxr-xr-x 0/0 371856 2018-03-13 01:04 rootfs/bin/btrfs-select-super
-rwxr-xr-x 0/0 371856 2018-03-13 01:04 rootfs/bin/btrfs-zero-log
lrwxrwxrwx 0/0 0 2018-03-13 01:04 rootfs/bin/btrfsck → btrfs
-rwxr-xr-x 0/0 375952 2018-03-13 01:04 rootfs/bin/btrfstune
-rwxr-xr-x 0/0 34888 2019-07-04 15:35 rootfs/bin/bunzip2
-rwxr-xr-x 0/0 2062296 2019-03-06 22:51 rootfs/bin/busybox
hrwxr-xr-x 0/0 0 2019-07-04 15:35 rootfs/bin/bzcat link to rootfs/bin/bunzip2
lrwxrwxrwx 0/0 0 2019-07-04 15:35 rootfs/bin/bzcmp → bzdiff
-rwxr-xr-x 0/0 2140 2019-07-04 15:35 rootfs/bin/bzdiff
lrwxrwxrwx 0/0 0 2019-07-04 15:35 rootfs/bin/bzegrep → bzgrep
-rwxr-xr-x 0/0 4877 2019-07-04 15:35 rootfs/bin/bzexe
lrwxrwxrwx 0/0 0 2019-07-04 15:35 rootfs/bin/bzfgrep → bzgrep
-rwxr-xr-x 0/0 3642 2019-07-04 15:35 rootfs/bin/bzgrep
hrwxr-xr-x 0/0 0 2019-07-04 15:35 rootfs/bin/bzip2 link to rootfs/bin/bunzip2
-rwxr-xr-x 0/0 14328 2019-07-04 15:35 rootfs/bin/bzip2recover
lrwxrwxrwx 0/0 0 2019-07-04 15:35 rootfs/bin/bzless → bzmore
-rwxr-xr-x 0/0 1297 2019-07-04 15:35 rootfs/bin/bzmore
-rwxr-xr-x 0/0 35064 2018-01-18 11:43 rootfs/bin/cat
-rwxr-xr-x 0/0 14328 2017-04-21 23:44 rootfs/bin/chacl
-rwxr-xr-x 0/0 63672 2018-01-18 11:43 rootfs/bin/chgrp
-rwxr-xr-x 0/0 59608 2018-01-18 11:43 rootfs/bin/chmod
-rwxr-xr-x 0/0 67768 2018-01-18 11:43 rootfs/bin/chown
-rwxr-xr-x 0/0 10312 2018-01-22 15:49 rootfs/bin/chvt
-rwxr-xr-x 0/0 141528 2018-01-18 11:43 rootfs/bin/cp
-rwxr-xr-x 0/0 157224 2019-11-05 20:09 rootfs/bin/cpio
-rwxr-xr-x 0/0 121432 2018-01-25 09:14 rootfs/bin/dash
-rwxr-xr-x 0/0 100568 2018-01-18 11:43 rootfs/bin/date
-rwxr-xr-x 0/0 76000 2018-01-18 11:43 rootfs/bin/dd
-rwxr-xr-x 0/0 84776 2018-01-18 11:43 rootfs/bin/df
-rwxr-xr-x 0/0 133792 2018-01-18 11:43 rootfs/bin/dir
-rwxr-xr-x 0/0 72000 2020-03-05 19:23 rootfs/bin/dmesg
lrwxrwxrwx 0/0 0 2018-01-31 14:08 rootfs/bin/dnsdomainname → hostname
lrwxrwxrwx 0/0 0 2018-01-31 14:08 rootfs/bin/domainname → hostname
-rwxr-xr-x 0/0 170520 2018-01-22 15:49 rootfs/bin/dumpkeys
-rwxr-xr-x 0/0 35000 2018-01-18 11:43 rootfs/bin/echo
-rwxr-xr-x 0/0 51512 2016-04-27 00:54 rootfs/bin/ed
-rwxr-xr-x 0/0 28 2019-09-18 18:00 rootfs/bin/egrep
-rwxr-xr-x 0/0 30904 2018-01-18 11:43 rootfs/bin/false
-rwxr-xr-x 0/0 10312 2018-01-22 15:49 rootfs/bin/fgconsole
-rwxr-xr-x 0/0 28 2019-09-18 18:00 rootfs/bin/fgrep
-rwxr-xr-x 0/0 64784 2020-03-05 19:23 rootfs/bin/findmnt
-rwxr-xr-x 0/0 1185 2018-03-13 01:04 rootfs/bin/fsck.btrfs
-rwxr-xr-x 0/0 35928 2018-12-11 17:46 rootfs/bin/fuser
-rwsr-xr-x 0/0 30800 2016-08-11 15:52 rootfs/bin/fusermount
-rwxr-xr-x 0/0 23160 2017-04-21 23:44 rootfs/bin/getfacl
-rwxr-xr-x 0/0 219456 2019-09-18 18:00 rootfs/bin/grep
-rwxr-xr-x 0/0 2301 2017-04-28 06:50 rootfs/bin/gunzip
-rwxr-xr-x 0/0 5927 2017-04-28 06:50 rootfs/bin/gzexe
-rwxr-xr-x 0/0 101560 2017-04-28 06:50 rootfs/bin/gzip
-rwxr-xr-x 0/0 18504 2018-01-31 14:08 rootfs/bin/hostname
-rwxr-xr-x 0/0 558200 2020-05-11 17:40 rootfs/bin/ip
-rwxr-xr-x 0/0 63576 2020-05-03 14:30 rootfs/bin/journalctl
-rwxr-xr-x 0/0 10312 2018-01-22 15:49 rootfs/bin/kbd_mode
-rwxr-xr-x 0/0 26704 2019-08-09 18:37 rootfs/bin/kill
-rwxr-xr-x 0/0 149688 2020-04-09 07:03 rootfs/bin/kmod

I did this at the dell laptop where i first create the tar image

Thanks, and what version is LXD on the node you created the tarball on?

4.3 installed from snap

( I type lxd verison and print 4.3)

That doesn’t look like an output from the backup system. Are you certain that is the file that was generated?

That looks more like the image publish tarball format.

Ah, I see, you’ve done lxc image export rather than lxc export <instance name>.

You can’t import an image tarball directly as an instance, you need to do lxc image import instead.

1 Like

I am bit confused :neutral_face: .

So suppose i have a container with name CameraSvc. I have installed there opencv for example and i want its image to tar.gz. What are the steps ?

  1. sudo lxc export CameraSvc ?
    and after that ?

What are you trying to achieve?

I want after the installation of libraries to a container , somehow to move this image with these libraries. For example i want my raspberry pie which is a drone to have images of both arm and x86 architectures. So i imagined that because the rpi can’t store x86 images due to different architecture , it will can carry the images of different architectures in tar.gz.
So as it flies , if it discovers another device , if they have the same architecture no problem.
If they haven’t , drone will send the tar.gz to the device and the device will untar it and make a container .

So an image export using lxc image export can only be imported using lxc image import.

If you want to export a container, then you need to do lxc export and lxc import.

You can’t import an image directly as a container, you have to import it as an image and then create a container from that imported image.

Yes i know that. I first export the image and then a transfer it to my other laptop with a USB stick . Then i did lxc image import and i was hoping to see at my local image store a new image

The command you showed in your original post was lxc import and not lxc image import, that is why you got the error about index.yaml missing (because your tarball file is an image export not an instance export).

Hmm i am not sure if it is a typo or i actually did this but i will retry it.

I test sudo lxc export ContainerName and i create a backup.tar.gz.
At the same machine i tried sudo lxc import backup.tar.gz and i received

Error:Create instance from backup: Cannot restore volume, already exists on target.

When i move the tar.gz to the other laptop i received

Error: Create instance from backup: Error starting unpack: Failed to run: tar -zxf - --xattrs-include=* --strip-components=2 -C /var/snap/lxd/common/lxd/storage-pools/default/containers/CameraSvc backup/container: gzip: stdin: unexpected end of file
tar: Unexpected EOF in archive
tar: Unexpected EOF in archive
tar: Error is not recoverable: exiting now

I retry the export/import situation with the image tar.gz.

±------±-------------±-------±-----------------------------------±-------------±----------±----------±------------------------------+
| ALIAS | FINGERPRINT | PUBLIC | DESCRIPTION | ARCHITECTURE | TYPE | SIZE | UPLOAD DATE |
±------±-------------±-------±-----------------------------------±-------------±----------±----------±------------------------------+
| | 62cb2fd786f2 | no | Ubuntu 18.04 LTS server (20200722) | x86_64 | CONTAINER | 2383.38MB | Aug 12, 2020 at 11:33am (UTC) |
±------±-------------±-------±-----------------------------------±-------------±----------±----------±------------------------------+

The imge was created succesfully.
When i tried sudo lxc launch 62cb2fd786f2 c1 i receive :

tar: rootfs/usr/share: Cannot mkdir: No space left on device
tar: rootfs/usr/share/zoneinfo/right/EET: Cannot open: No such file or directory
tar: rootfs/usr/share: Cannot mkdir: No space left on device
tar: rootfs/usr/share/zoneinfo/right/EST: Cannot open: No such file or directory
tar: rootfs/usr/share: Cannot mkdir: No space left on device
tar: rootfs/usr/share/zoneinfo/right/EST5EDT: Cannot open: No such file or directory
tar: rootfs/usr/share: Cannot mkdir: No space left on device
tar: rootfs/usr/share/zoneinfo/right/Egypt: Cannot open: No such file or directory
tar: rootfs/usr/share: Cannot mkdir: No space left on device
tar: rootfs/usr/share/zoneinfo/right/Eire: Cannot open: No such file or directory
tar: rootfs/usr/share: Cannot mkdir: No space left on device
tar: rootfs/usr/share/zoneinfo/right/Etc: Cannot mkdir: No such file or directory
tar: rootfs/usr/share: Cannot mkdir: No space left on device
tar: rootfs/usr/share/zoneinfo/right/Etc/GMT: Cannot open: No such file or directory
tar: rootfs/usr/share: Cannot mkdir: No space left on device
tar: rootfs/usr/share/zoneinfo/right/Etc/GMT+0: Cannot open: No such file or directory
tar: rootfs/usr/share: Cannot mkdir: No space left on device
tar: rootfs/usr/share/zoneinfo/right/Etc/GMT+1: Cannot open: No such file or directory
tar: rootfs/usr/share: Cannot mkdir: No space left on device

I have 4,1 GB available . Is this the real problem , or is something else ?

i have the same issue, but this bug report is a lil bit too fragmented (thats why you should never ask two questions in one). Can someone explaint to me how i can fix the issue with

lxc export backup
Error: Create backup: Backup “backup/backup0” already exists

in case its required: my storage backend is ceph, LXD 4.4 from snap

Hmm, that’s an odd one.

Can you show lxc query /1.0/instances/backup/backups?recursion=1