.tmp: Cannot open: Permission denied

Martino Rabe

Renowned Member
Jul 24, 2016
18
1
68
44
Hello,

I tried to create a backup of all VM by adding an external USB HDD to the system, mount them at /media/backup. Afterwards I started the backup via GUI. I am able to see that the backup finished (it reached 100%) but afterwards the tmp file failed.

Code:
INFO:  95% (171.3 GiB of 180.0 GiB) in 57m 39s, read: 4.2 GiB/s, write: 0 B/s
<snip>
INFO: 100% (180.0 GiB of 180.0 GiB) in 57m 42s, read: 2.9 GiB/s, write: 2.7 KiB/s
INFO: backup is sparse: 97.80 GiB (54%) total zero data
INFO: transferred 180.00 GiB in 3462 seconds (53.2 MiB/s)
INFO: archive file size: 61.80GB
INFO: adding notes to backup
INFO: prune older backups with retention: keep-daily=2, keep-last=3, keep-monthly=3, keep-weekly=2, keep-yearly=1
INFO: pruned 0 backup(s)
INFO: Finished Backup of VM 100 (00:57:42)
INFO: Backup finished at 2023-06-21 23:03:42
INFO: Starting Backup of VM 101 (lxc)
INFO: Backup started at 2023-06-21 23:03:42
INFO: status = running
INFO: CT Name: numberconverter
INFO: including mount point rootfs ('/') in backup
INFO: backup mode: snapshot
INFO: ionice priority: 7
INFO: create storage snapshot 'vzdump'
INFO: creating vzdump archive '/media/backup/dump/vzdump-lxc-101-2023_06_21-23_03_42.tar.gz'
INFO: tar: /media/backup/dump/vzdump-lxc-101-2023_06_21-23_03_42.tmp: Cannot open: Permission denied
INFO: tar: Error is not recoverable: exiting now
INFO: cleanup temporary 'vzdump' snapshot
ERROR: Backup of VM 101 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=/media/backup/dump/vzdump-lxc-101-2023_06_21-23_03_42.tmp' ./etc/vzdump/pct.conf ./etc/vzdump/pct.fw '--directory=/mnt/vzsnap0' --no-anchored '--exclude=lost+found' --anchored '--exclude=./tmp/?*' '--exclude=./var/tmp/?*' '--exclude=./var/run/?*.pid' ./ | gzip --rsyncable >/media/backup/dump/vzdump-lxc-101-2023_06_21-23_03_42.tar.dat' failed: exit code 2
INFO: Failed at 2023-06-21 23:03:43
INFO: Backup job finished with errors
TASK ERROR: job errors

If I look at the directory I am able to see a file of 62GB was created without problems.

Code:
root@goldway:/media/backup/dump# ls -alh
total 124G
drwxr-xr-x 2 root root 4.0K Jun 21 23:03 .
drwx------ 4 1000 1000 4.0K Jun 21 21:56 ..
-rw-r--r-- 1 root root 1.5K Jun 21 21:45 vzdump-lxc-101-2023_06_21-21_45_18.log
-rw-r--r-- 1 root root 1.5K Jun 21 23:03 vzdump-lxc-101-2023_06_21-23_03_42.log
-rw-r--r-- 1 root root 7.1K Jun 21 21:45 vzdump-qemu-100-2023_06_21-20_47_55.log
-rw-r--r-- 1 root root  62G Jun 21 21:45 vzdump-qemu-100-2023_06_21-20_47_55.vma.gz
-rw-r--r-- 1 root root   10 Jun 21 21:45 vzdump-qemu-100-2023_06_21-20_47_55.vma.gz.notes
-rw-r--r-- 1 root root 7.0K Jun 21 23:03 vzdump-qemu-100-2023_06_21-22_06_00.log
-rw-r--r-- 1 root root  62G Jun 21 23:03 vzdump-qemu-100-2023_06_21-22_06_00.vma.gz
-rw-r--r-- 1 root root   10 Jun 21 23:03 vzdump-qemu-100-2023_06_21-22_06_00.vma.gz.notes

For me it does not look like that some file permissions are not correct furthermore disk space should also not be a problem because I use a new 2 TB HDD. I don't have any idea what could be the reason for the issue.
 
Last edited:
Hello Chris,

temp directory is no option because I don't have enough space for this (except the external usb hdd). I looked at the document you provided but I was not able to find the correct user. From the /etc/password I also didn't find a user with the name lxc.

What would be the correct user in order to change the permission of the external hdd ?
 
Last edited:
Hello Chris,

temp directory is no option because I don't have enough space for this (except the external usb hdd). I looked at the document you provided but I was not able to find the correct user. From the /etc/password I also didn't find a user with the name lxc.

What would be the correct user in order to change the permission of the external hdd ?
Hey Martino,

Login through terminal or SSH onto your Proxmox server.

Make sure your USB drive mount has the correct permissions.

I encountered the same issues and realized the permissions were only set to 700.

So this was my setup, my USB drives main partition was sde1, ( you can find out what your USB drive is by running the command lsblk) so I created a directory in /mnt/ called "USB", where I could mount my USB drive to.

Then I mounted the usb to said directory I just created:
Code:
mount /dev/sde1 /mnt/USB

Then I gave root user full permissions to that directory:
Code:
chown -R root:root /mnt/USB

Then I changed the directory permissions so root had read and write:
Code:
chmod -R 755 /mnt/USB

I was then able to run a successful backup.

Obviously this is under the assumption you are using the "root" user in proxmox.

Hope that helps!
 
Last edited:
  • Like
Reactions: shaywood
Hey Martino,

Login through terminal or SSH onto your Proxmox server.

Make sure your USB drive mount has the correct permissions.

I encountered the same issues and realized the permissions were only set to 700.

So this was my setup, my USB drives main partition was sde1, ( you can find out what your USB drive is by running the command lsblk) so I created a directory in /mnt/ called "USB", where I could mount my USB drive to.

Then I mounted the usb to said directory I just created:
Code:
mount /dev/sde1 /mnt/USB

Then I gave root user full permissions to that directory:
Code:
chown -R root:root /mnt/USB

Then I changed the directory permissions so root had read and write:
Code:
chmod -R 755 /mnt/USB

I was then able to run a successful backup.

Obviously this is under the assumption you are using the "root" user in proxmox.

Hope that helps!
Thanks for the advise. Worked great for me.