Can't use an absolute path (maybe only as an user?)

Hi there.

When attempting to set up a periodic backup I ran into a weird issue of not being able to use an absolute path – either via --files-from or directly specifying it when passing it on to the restic command.

Example: restic backup --compression max --verbose /home/sevos/x/y leads to this:

Fatal: unable to save snapshot: NodeFromFileInfo: Listxattr: xattr.list /home: permission denied

Current setup:

  • Using ENV variables: RESTIC_REPOSITORY and RESTIC_PASSWORD
  • Using the latest beta binary: restic 0.13.1-dev (compiled manually) compiled with go1.18 on freebsd/amd64
  • User, no root

As a workaround, I can go to the subdirectory and include/pass the main folder.

Example:

cd /home/sevos/x
restic backup --compression max y

That will work just fine. However, not perfect if I want to do multiple --files-from paths.

Is there any way to fix this nicely or is it particularly restic related issue?

Thanks in advance for your help!

What are the exact permissions on /home? Use e.g. ls -la /home to see them (the .).

lrwxr-xr-x  1 root  0  8  3 lut  2019 /home -> usr/home

Hi @rawtaz.

I built restic with debug support and produced a log to show more details of the issue. I hope you’ll find this helpful.

2022/07/27 23:00:56 archiver/archiver.go:631    archiver.(*Archiver).SaveTree   63      /home, saved subtree Tree<1 nodes> as 0f3e287d
2022/07/27 23:00:56 archiver/archiver.go:638    archiver.(*Archiver).SaveTree   63      /home, dir node data loaded from /home/sevos
2022/07/27 23:00:56 restic/node.go:622  restic.(*Node).fillExtendedAttributes   63      fillExtendedAttributes(/home/sevos) [] <nil>
2022/07/27 23:00:56 archiver/archiver.go:656    archiver.(*Archiver).SaveTree   63      waiting on 0 nodes
2022/07/27 23:00:56 repository/repository.go:374        repository.(*Repository).saveAndEncrypt 146     save id REDACTED_ID (tree, 367 bytes)
2022/07/27 23:00:56 repository/packer_manager.go:92     repository.(*packerManager).SaveBlob    146     pack is not full enough (51026 bytes)
2022/07/27 23:00:56 archiver/archiver.go:631    archiver.(*Archiver).SaveTree   63      /, saved subtree Tree<1 nodes> as 815a068a
2022/07/27 23:00:56 archiver/archiver.go:638    archiver.(*Archiver).SaveTree   63      /, dir node data loaded from /home
2022/07/27 23:00:56 restic/node.go:622  restic.(*Node).fillExtendedAttributes   63      fillExtendedAttributes(/home) [] Listxattr: xattr.list /home: permission denied
2022/07/27 23:00:56 archiver/archiver.go:846    archiver.(*Archiver).Snapshot.func1     62      err is NodeFromFileInfo: Listxattr: xattr.list /home: permission denied
2022/07/27 23:00:56 archiver/archiver.go:849    archiver.(*Archiver).Snapshot.func1     62      error while saving tree: NodeFromFileInfo: Listxattr: xattr.list /home: permission denied

Thanks! I’m on the road, that’s why I haven’t looked into it more. I’m very curious what the cause is though. Can you just for isolation purposes verify that you can successfully back up an absolute path that starts at the root of the disk and that does not contain any symlinks?

Also, can you show the output of mount as well as ls -la /usr/home?

1 Like

Enjoy your road! :slight_smile:

It’s a limited userspace – so no permissions for /usr/home or /home.

It’s quite surprising that restic does a lookup over there by default.
Though I don’t quite understand this behaviour and the purpose of it.

Basically, I have permissions only for my user folder, nowhere else.

Therefore mount will output this:

-bash: /sbin/mount: Permission denied

and ls -la /usr/home this:

total 0
ls: /usr/home: Permission denied

This is issue unable to save snapshot: NodeFromFileInfo: Listxattr: xattr.list /home : permission denied · Issue #3600 · restic/restic · GitHub . The issue also describes a workaround.

1 Like

Hi!

I looked into this and I saw 2 workarounds there - one which I already mentioned before and the other which I just tried now by modifying the code in archiver.go.

After dropping the if statement and building restic again, the issue went gone. I was able to backup using an absolute path!

Hopefully this could be changed in the future release of restic? It seems to be a trivial fix but maybe I’m overlooking something here and it could affect the rest badly somehow?

Anyway, thanks for your help!

@Sevos I’ve opened #3853 can you test whether that fixes the issue for you?

Hey Michael,

Thanks for taking your time and effort to look into this and make a PR to help me with the issue!

Unfortunately this still doesn’t seem to work:

Fatal: unable to save snapshot: NodeFromFileInfo: xattr.list /home: permission denied

Sorry for the late reply. I think I’ve fixed the problem in the PR. At least there is now sufficient debug logging to know what goes wrong.