[SOLVED] LXC (unprivileged) backup task failing

Stefano Giunchi

Renowned Member
Jan 17, 2016
91
13
73
50
Forlì, Italy
www.soasi.com
I want to backup an unprivileged LXC to a NFS (Qnap nas).
This is a frequent question, and usually the answer is to remove NO_ROOT_SQUASH or enable --tmpdir.
I tried both, without success:

Code:
INFO: starting new backup job: vzdump 108 --storage backup --mode suspend --mailto log@example.com --tmpdir /data/tmp-backup/ --mailnotification always --quiet 1 --compress lzo
INFO: Starting Backup of VM 108 (lxc)
INFO: Backup started at 2020-04-22 13:04:26
INFO: status = running
INFO: backup mode: suspend
INFO: ionice priority: 7
INFO: CT Name: revp
INFO: starting first sync /proc/14727/root// to /data/tmp-backup/vzdumptmp25774
INFO: Number of files: 35,281 (reg: 25,102, dir: 4,372, link: 5,807)
INFO: Number of created files: 35,280 (reg: 25,102, dir: 4,371, link: 5,807)
INFO: Number of deleted files: 0
INFO: Number of regular files transferred: 23,555
INFO: Total file size: 1,026,856,147 bytes
INFO: Total transferred file size: 1,014,928,006 bytes
INFO: Literal data: 1,014,928,006 bytes
INFO: Matched data: 0 bytes
INFO: File list size: 1,507,116
INFO: File list generation time: 0.001 seconds
INFO: File list transfer time: 0.000 seconds
INFO: Total bytes sent: 1,017,447,914
INFO: Total bytes received: 586,837
INFO: sent 1,017,447,914 bytes  received 586,837 bytes  55,028,905.46 bytes/sec
INFO: total size is 1,026,856,147  speedup is 1.01
INFO: first sync finished (18 seconds)
INFO: suspend vm
INFO: starting final sync /proc/14727/root// to /data/tmp-backup/vzdumptmp25774
INFO: Number of files: 35,281 (reg: 25,102, dir: 4,372, link: 5,807)
INFO: Number of created files: 0
INFO: Number of deleted files: 0
INFO: Number of regular files transferred: 0
INFO: Total file size: 1,026,856,147 bytes
INFO: Total transferred file size: 0 bytes
INFO: Literal data: 0 bytes
INFO: Matched data: 0 bytes
INFO: File list size: 196,578
INFO: File list generation time: 0.001 seconds
INFO: File list transfer time: 0.000 seconds
INFO: Total bytes sent: 1,153,710
INFO: Total bytes received: 4,667
INFO: sent 1,153,710 bytes  received 4,667 bytes  772,251.33 bytes/sec
INFO: total size is 1,026,856,147  speedup is 886.46
INFO: final sync finished (1 seconds)
INFO: resume vm
INFO: guest is online again after 1 seconds
INFO: creating archive '/mnt/pve/backup/dump/vzdump-lxc-108-2020_04_22-13_04_26.tar.lzo'
INFO: /bin/bash: /mnt/pve/backup/dump/vzdump-lxc-108-2020_04_22-13_04_26.tar.dat: Permission denied
ERROR: Backup of VM 108 failed - command 'set -o pipefail && lxc-usernsexec -m u:0:100000:65536 -m g:0:100000:65536 -- tar cpf - --totals --one-file-system -p --sparse --numeric-owner --acls --xattrs '--xattrs-include=user.*' '--xattrs-include=security.capability' '--warning=no-file-ignored' '--warning=no-xattr-write' --one-file-system '--warning=no-file-ignored' '--directory=/data/tmp-backup/vzdumptmp25774' ./etc/vzdump/pct.conf ./etc/vzdump/pct.fw '--directory=/data/tmp-backup/vzdumptmp25774' --no-anchored '--exclude=lost+found' --anchored '--exclude=./tmp/?*' '--exclude=./var/tmp/?*' '--exclude=./var/run/?*.pid' . | lzop >/mnt/pve/backup/dump/vzdump-lxc-108-2020_04_22-13_04_26.tar.dat' failed: exit code 1
INFO: Failed at 2020-04-22 13:04:47
cp: cannot create regular file '/mnt/pve/backup/dump/vzdump-lxc-108-2020_04_22-13_04_26.log': Permission denied
INFO: Backup job finished with errors

TASK ERROR: job errors

This command works:
Code:
lxc-usernsexec -m u:0:100000:65536 -m g:0:100000:65536 touch /mnt/pve/backup/testfile

Any suggestion?
 
on a hunch does:
Code:
lxc-usernsexec -m u:0:100000:65536 -m g:0:100000:65536 touch /mnt/pve/backup/dump/testfile

also work (note that the permission denied error comes from the `dump` subfolder
 
on a hunch does:
Code:
lxc-usernsexec -m u:0:100000:65536 -m g:0:100000:65536 touch /mnt/pve/backup/dump/testfile

also work (note that the permission denied error comes from the `dump` subfolder

That's right, I didn't think to folder rights
Code:
# lxc-usernsexec -m u:0:100000:65536 -m g:0:100000:65536 touch /mnt/pve/backup/dump/testfile
touch: cannot touch '/mnt/pve/backup/dump/testfile': Permission denied

# ls -alh
total 36K
drwxrwxrwx 10 root root 4.0K Apr 22 13:05 .
drwxr-xr-x  3 root root 4.0K Jul 27  2017 ..
drwxr-xr-x  3 root root 4.0K Apr 22 02:21 dump

The dump folder was created when NFS had NO_ROOT_SQUASH enabled.
I did a chmod 777 on the dump folder (from the NAS shell) and now it works, I don't need neither --tmdir.

Thanks
 
  • Like
Reactions: Stoiko Ivanov

About

The Proxmox community has been around for many years and offers help and support for Proxmox VE, Proxmox Backup Server, and Proxmox Mail Gateway.
We think our community is one of the best thanks to people like you!

Get your subscription!

The Proxmox team works very hard to make sure you are running the best software and getting stable updates and security enhancements, as well as quick enterprise support. Tens of thousands of happy customers have a Proxmox subscription. Get yours easily in our online shop.

Buy now!