Lxc export error backup file not found


(Chris Kruijntjens) #1

Hi all

I have an issue with 2 containers. When i do a lxc export containername it runs until the end and then it errors out with:

Error: fetch container backup file: not found

How can i resolve this?


#2

off the top of my head I have no great suggestion for debugging this, but first ensure that you have at least 3 times the container’s size on the system partition (where lxd is installed)


(Chris Kruijntjens) #3

Hi,

Thank you. Can i also write it to an external hdd without first writing it to the primary hdd?


#4

why not ? on one of the systems I manage I use sshfs and it works fine.


(Chris Kruijntjens) #5

What woyld be the command to do this?


#6

if by ‘this’ you mean sshfs, there is nothing mystical in a directory mounted with sshfs, it’s just a directory. The part related to lxc looks like this:

containers=( "server1" "server2" "server3")
mtpoint=/mnt/sav
lxcbin=/snap/bin/lxc
DOW=$(date +%u)
DEST=$mtpoint/savLinux/$DOW
if [ -d $DEST ]; then
    for cont in "${containers[@]}"
    do
       echo "begin $cont"
       $lxcbin export -q $cont $DEST/$cont.tar.gz
       echo "end $cont, return $?"
    done
fi

for sshfs, man sshfs and man fusermount :slight_smile:


(Chris Kruijntjens) #7

Whre does lxd write the export to? Now i have mounted a hdd and tell lxc to write it there but before it had bin written to the external hdd it is writing in somewhere in the root. What directory is it writing to?


#8

Don’t quite remember I’m afraid. Possibly under a subdirectory of
/var/snap/lxd/common/lxd/disk
I don’t like the idea of messing around snap directories, so my way of handling this problem is to keep enough free space available.

FYI, the plan for solving this problem is here:


but it’s not done yet.


(Chris Kruijntjens) #9

Hi

I free memory and there should be enough however i get the same error? Any ideas?


#10

well in this case debugging seems the only option :-/ enter in a console:

lxc monitor

and launch your export in another. Who knows ? maybe there will be some useful info.

Edit: after looking again at what happens while exporting, I think that the most useful tool to find out what happens is … ps.


(Chris Kruijntjens) #11

Hi,

How can i do this with ps? I did the first command you gave me and al it gives me is this:


(Chris Kruijntjens) #12

And this for the lxc export command (3 containers worked fine however the other ones not):


#13

Oh well I just looked a bit on how it’s done and it’s highly difficult to find out what is happening without going full to debugging mode. Basically lxd is not doing much of the work, the actual job is delegated at the storage level.
So export behaviour is storage specific, what I could say from what I see for my storage (btrfs, I think that it’s in lxd/storage_btrfs.go) would not apply if you are using zfs ou ceph. A backup is doing many calls to different functions with a standard error behaviour of ‘if err != nil return err’ but the error code depends on the storage you use and the particular function that fails. All what you get is the final error code without knowing the call that failed. Possibly the error code is the ‘103’ that appears in your screen dump. Not very useful if you are not a lxd developer and even then it’s probably not sufficient.

At this point I have no very positive input for you I’m afraid.
Try to reboot computer :-/
Try to compare containers that fails and containers that succeed, is there a pattern ?


(Chris Kruijntjens) #14

Hi

I understand. Wat should be the best solution to backup containers and upload them to cloud storage?


#15

Not sure I follow you. If you can’t backup you have to find a way to do it at least locally. After that you can search for a way to upload to cloud servers, but if it don’t work locally don’t worry about cloud.

I forgot that the problem could be at the disk level, not hardware but some structural damage. You could test the storage integrity with your specific storage tools. Since I don’t know an easy way to debug your problem, the only advice I have is to check for all possible problems.


(Chris Kruijntjens) #16

Hi all,

Now a few days later i tried to debug this problem however i am stuck. I have a lot of free memory. (700GB) and the export stops at 92GB wit the error that the backup file can not be found. I restarted the system but still the same issue. Am i the first one with this problem? The container looks the same as the on that works only different is that the size of the workin containers is much less.


#17

I just learned today that LXD is calling tar that does not understand well sparse files. Could you have one (or more) huge sparse file in your container ?


(Chris Kruijntjens) #18

Not that i am aware of. Now witht he dubig mode on i get this error afger copying many gb

Error: Create backup: Backup storage: open /var/snap/lxd/common/lxd/backups/kopano/backup0: no such file or directory

When i am running the export i can see this in the following path:

Path /var/snap/lxd/common/lxd/backups/lxd_backup_565323753/

In this path i see the file container.bin and this file grows while i am doing the export.


#19

In the interest of research, is a snapshot of the ‘bad’ container succeeding ?
and also try
lxc export yourcontainer yourcontainer.tar.gz --optimized-storage=false


(Chris Kruijntjens) #20

Hi

A snapshot is working. No problem what so ever. I will try your command.