Snap & LXD - Can't backup container to anything but $HOME


(David Whyte) #1

Hi,

Trying to use the native backup solution for LXD, I kept encountering trouble of ‘no such file or directory’:

djwhyte@server1:/data/shared/Not Backed-Up/db_backups$ lxc export hass /data/shared/Not\ Backed-Up/lxd_backups/hass.tar.xz --container-only
Error: open /data/shared/Not Backed-Up/lxd_backups/hass.tar.xz: no such file or directory
djwhyte@server1:/data/shared/Not Backed-Up/db_backups$ sudo lxc export hass /data/shared/Not\ Backed-Up/lxd_backups/hass.tar.xz --container-only
[sudo] password for djwhyte: 
Error: open /data/shared/Not Backed-Up/lxd_backups/hass.tar.xz: no such file or directory
djwhyte@server1:/data/shared/Not Backed-Up/db_backups$ lxc export hass /data/shared/Not\ Backed-Up/lxd_backups/hass.tar.xz --container-only
Error: open /data/shared/Not Backed-Up/lxd_backups/hass.tar.xz: no such file or directory
djwhyte@server1:/data/shared/Not Backed-Up/db_backups$ sudo lxc export hass /data/shared/Not\ Backed-Up/lxd_backups/hass.tar.xz --container-only
[sudo] password for djwhyte: 
Error: open /data/shared/Not Backed-Up/lxd_backups/hass.tar.xz: no such file or directory

After some research, I now think this might be because the LXD snap won’t have writable access to /data/shared/Not Backed-Up/lxd_backups.

I am new to snaps. Is there anyway to relax the restrictions on the snap so it could write to that directory?

Thanks,
Whytey


#2

Have a look at

It talks about the interfaces of a snap.
See if you can add the removable-media interface,
https://docs.snapcraft.io/reference/interfaces


(David Whyte) #3

Thanks simos. I did see that but from my reading that only provides access to the /media directory. I was hoping to specify a directory that is visible to the snap.


(Stéphane Graber) #4

LXD should have access to all paths even from the snap.
I suspect the problem here is a missing call to shared.HostPath in the client code.

Can you file a bug at https://github.com/lxc/lxd/issues so we can look into it (I’d send a patch now but I’m on vacation).


(David Whyte) #5

Hi Stephane,

I will do so, once I am home near my LXD install. Enjoy your vacation.

Cheers,
Whytey


(David Whyte) #6

Done at https://github.com/lxc/lxd/issues/4643


(Stéphane Graber) #7

This was fixed.