#3116 Issue open: Changing TMPDIR in local.conf not working

Labels: support / question

nnachtegael opened issue at 2023-12-21 17:01:

  • ReaR version ("/usr/sbin/rear -V"):
from ~/rear 
sudo usr/sbin/rear -V
Relax-and-Recover 2.7 / Git
  • If your ReaR version is not the current version, explain why you can't upgrade:

  • OS version ("cat /etc/os-release" or "lsb_release -a" or "cat /etc/rear/os.conf"):

No LSB modules are available.
Distributor ID: Ubuntu
Description:    Ubuntu 22.04.3 LTS
Release:        22.04
Codename:       jammy
  • ReaR configuration files ("cat /etc/rear/site.conf" and/or "cat /etc/rear/local.conf"):
OUTPUT=USB
BACKUP=NETFS
BACKUP_PROG=rsync
BACKUP_URL="usb:///dev/disk/by-label/REAR-ORICO4TB"
USB_DEVICE_FILESYSTEM=ext4
USB_RETAIN_BACKUP_NR=1
#export TMPDIR="/mnt/sde2/reartmp"
export TMPDIR="${TMPDIR-/mnt/sde2/reartmp}"
  • Hardware vendor/product (PC or PowerNV BareMetal or ARM) or VM (KVM guest or PowerVM LPAR):
    Home build PC

  • System architecture (x86 compatible or PPC64/PPC64LE or what exact ARM device):
    x86

  • Firmware (BIOS or UEFI or Open Firmware) and bootloader (GRUB or ELILO or Petitboot):

  • Storage (local disk or SSD) and/or SAN (FC or iSCSI or FCoE) and/or multipath (DM or NVMe):

 sudo fdisk -l
Disk /dev/nvme0n1: 931.51 GiB, 1000204886016 bytes, 1953525168 sectors
Disk model: Seagate FireCuda 510 SSD ZP1000GM30001
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disklabel type: gpt
Disk identifier: CB1BC206-CD11-40A8-95D5-EBDAE3FFFA5D

Device          Start        End    Sectors  Size Type
/dev/nvme0n1p1   2048     999423     997376  487M EFI System
/dev/nvme0n1p2 999424 1953523711 1952524288  931G Linux RAID


Disk /dev/nvme1n1: 931.51 GiB, 1000204886016 bytes, 1953525168 sectors
Disk model: Seagate FireCuda 510 SSD ZP1000GM30001
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disklabel type: gpt
Disk identifier: 1E6695CA-F1E5-40EF-9BE4-972661123072

Device          Start        End    Sectors  Size Type
/dev/nvme1n1p1   2048     999423     997376  487M EFI System
/dev/nvme1n1p2 999424 1953523711 1952524288  931G Linux RAID


Disk /dev/sda: 1.82 TiB, 2000398934016 bytes, 3907029168 sectors
Disk model: WDC WD2002FFSX-6
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 4096 bytes
I/O size (minimum/optimal): 4096 bytes / 4096 bytes


Disk /dev/sdb: 1.82 TiB, 2000398934016 bytes, 3907029168 sectors
Disk model: WDC WD2002FFSX-6
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 4096 bytes
I/O size (minimum/optimal): 4096 bytes / 4096 bytes


Disk /dev/sdc: 1.82 TiB, 2000398934016 bytes, 3907029168 sectors
Disk model: WDC WD2002FFSX-6
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 4096 bytes
I/O size (minimum/optimal): 4096 bytes / 4096 bytes


Disk /dev/md0: 2.73 TiB, 3000395366400 bytes, 5860147200 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 4096 bytes
I/O size (minimum/optimal): 524288 bytes / 1572864 bytes


Disk /dev/md128: 930.91 GiB, 999557169152 bytes, 1952260096 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes


Disk /dev/sdd: 3.64 TiB, 4000787030016 bytes, 7814037168 sectors
Disk model: ASM236X NVME
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 33553920 bytes
Disklabel type: gpt
Disk identifier: C8A7D900-2F8F-44C9-84CA-5AAC269EC59D

Device       Start        End    Sectors  Size Type
/dev/sdd1    16384    2113535    2097152    1G EFI System
/dev/sdd2  2113536 7814037134 7811923599  3.6T Linux filesystem


Disk /dev/sde: 4.55 TiB, 5000947302400 bytes, 9767475200 sectors
Disk model: Elements 2620
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 4096 bytes
I/O size (minimum/optimal): 4096 bytes / 4096 bytes
Disklabel type: gpt
Disk identifier: 096E1D0E-60BE-4FB0-A184-A78C80E1F24A

Device       Start        End    Sectors  Size Type
/dev/sde1    16384    2113535    2097152    1G EFI System
/dev/sde2  2113536 9767473151 9765359616  4.5T Microsoft basic data
  • Storage layout ("lsblk -ipo NAME,KNAME,PKNAME,TRAN,TYPE,FSTYPE,LABEL,SIZE,MOUNTPOINT"):
NAME             KNAME          PKNAME         TRAN   TYPE   FSTYPE            LABEL           SIZE MOUNTPOINT
/dev/sda         /dev/sda                      sata   disk   linux_raid_member ubuntu-host:0   1.8T
`-/dev/md0       /dev/md0       /dev/sda              raid10 ext4                              2.7T /mnt/md0
/dev/sdb         /dev/sdb                      sata   disk   linux_raid_member ubuntu-host:0   1.8T
`-/dev/md0       /dev/md0       /dev/sdb              raid10 ext4                              2.7T /mnt/md0
/dev/sdc         /dev/sdc                      sata   disk   linux_raid_member ubuntu-host:0   1.8T
`-/dev/md0       /dev/md0       /dev/sdc              raid10 ext4                              2.7T /mnt/md0
/dev/sdd         /dev/sdd                      usb    disk                                     3.6T
|-/dev/sdd1      /dev/sdd1      /dev/sdd              part   vfat              REAR-EFI          1G
`-/dev/sdd2      /dev/sdd2      /dev/sdd              part   ext4              REAR-ORICO4TB   3.6T
/dev/sde         /dev/sde                      usb    disk                                     4.5T
|-/dev/sde1      /dev/sde1      /dev/sde              part   vfat              REAR-EFI          1G
`-/dev/sde2      /dev/sde2      /dev/sde              part   ntfs              wd5tb           4.5T /mnt/sde2
/dev/sr0         /dev/sr0                      sata   rom                                     1024M
/dev/nvme0n1     /dev/nvme0n1                  nvme   disk                                   931.5G
|-/dev/nvme0n1p1 /dev/nvme0n1p1 /dev/nvme0n1   nvme   part   vfat                              487M /boot/efi
`-/dev/nvme0n1p2 /dev/nvme0n1p2 /dev/nvme0n1   nvme   part   linux_raid_member kvm-host:128    931G
  `-/dev/md128   /dev/md128     /dev/nvme0n1p2        raid1  ext4                            930.9G /
/dev/nvme1n1     /dev/nvme1n1                  nvme   disk                                   931.5G
|-/dev/nvme1n1p1 /dev/nvme1n1p1 /dev/nvme1n1   nvme   part   vfat                              487M
`-/dev/nvme1n1p2 /dev/nvme1n1p2 /dev/nvme1n1   nvme   part   linux_raid_member kvm-host:128    931G
  `-/dev/md128   /dev/md128     /dev/nvme1n1p2        raid1  ext4                            930.9G /
  • Description of the issue (ideally so that others can reproduce it):

I try to change the TEMPDIR for my rsync backup to an attached USB /dev/sde2/reartmp directory.
The directory /reartmp exists on the USB disk.

I did an export TMPDIR="/mnt/sde2/reartmp"
before running the usr/sbin/rear -v mkbackup

TEMPDIR stays at /var/tmp even after the
export TMPDIR="${TMPDIR-/mnt/sde2/reartmp}"
in my /home/nnoel/rear/etc/rear/local.conf

see in my attached log file

2023-12-21 16:57:16.200891182 Creating rsync archive '/var/tmp/rear.dO7flE5aeOqUj3H/outputfs/rear/kvm-host/20231221.1655/backup'

if I try export TMPDIR="/mnt/sde2/reartmp" in local.conf
it also doesn't work: same situation TMPDIR stays at /var/tmp

  • Workaround, if any:

    • Attachments, as applicable ("rear -D mkrescue/mkbackup/recover" debug log files):
      ~/rear$ sudo usr/sbin/rear -v mkbackup log file

rear-kvm-host.log

You can drag-drop log files into this editor to create an attachment
or paste verbatim text like command output or file content
by including it between a leading and a closing line of
three backticks like this:

verbatim content

jsmeix commented at 2023-12-22 08:22:

@nnachtegael
usr/share/rear/conf/default.conf reads

# To have a specific working area directory prefix for Relax-and-Recover call
#   export TMPDIR="/prefix/for/rear/working/directory"
# before calling 'rear' (/prefix/for/rear/working/directory must already exist).

see
https://github.com/rear/rear/blob/rear-2.7/usr/share/rear/conf/default.conf#L55

jsmeix commented at 2023-12-22 08:32:

For some reasoning and details behind see also
https://github.com/rear/rear/issues/2654

nnachtegael commented at 2023-12-22 10:58:

I restarted from beginning

  • $ sudo -i
  • #export TMPDIR="/mnt/sde2/reartmp"
  • set permissions 777 for /mnt/sde2/reartmp
  • #git clone https://github.com/rear/rear.git
  • edit /root/rear/etc/rear/local.conf

OUTPUT=USB
BACKUP=NETFS
BACKUP_PROG=rsync
BACKUP_URL="usb:///dev/disk/by-label/REAR-000"
USB_DEVICE_FILESYSTEM=ext4
USB_RETAIN_BACKUP_NR=1
export TMPDIR="/mnt/sde2/reartmp"

  • #usr/sbin/rear -v format -- --efi /dev/sdd

  • message is "Could not remove build area /mnt/sde2/reartmp/rear.1GDQ69LwxnIc1SU"
    rear-format-efi.log

  • manually cleaned /mnt/sde2/reartmp

  • #usr/sbin/rear -v mkbackup

  • messages "/bin/ldd: line 158: /dev/null: Permission denied"

  • BUG in /root/rear/usr/share/rear/build/default/990_verify_rootfs.sh line 57:
    ReaR recovery system in '/mnt/sde2/reartmp/rear.6UbnO5EbBKxcYHs/rootfs' is broken: 'ldd /bin/bash' failed
    rear-mkbackup.log

I'm now stopped by this ldd error message
Searching for this ldd error did not gave me an answer...

jsmeix commented at 2023-12-22 12:31:

It "just works" for me with

OUTPUT=USB
BACKUP=NETFS
BACKUP_URL=usb:///dev/disk/by-label/REAR-000

I.e. I do the backup with 'tar' not with 'rsync'
because I am not a 'rsync' user.
And I do not use UEFI but BIOS.

As TMPDIR I use a mounted partiton
with ext2 filesystem on my /dev/sda harddisk:

# mount -v /dev/sda6 /other
mount: /dev/sda6 mounted on /other.

# export TMPDIR="/other"

# ls -ld /other
drwxr-xr-x 5 root root 4096 Dec 15 12:04 /other

# usr/sbin/rear -D format /dev/sdb
...
Using build area: /other/rear.D6fkLoxK8bHihSv
...
Exiting rear format (PID 13329) and its descendant processes ...
Running exit tasks
To remove the build area you may use (with caution): rm -Rf --one-file-system /other/rear.D6fkLoxK8bHihSv

# usr/sbin/rear -D mkbackup
...
Using build area: /other/rear.R0pgPzGqxtkAYha
...
Exiting rear mkbackup (PID 15867) and its descendant processes ...
Running exit tasks
To remove the build area you may use (with caution): rm -Rf --one-file-system /other/rear.R0pgPzGqxtkAYha

Also with automated removal of the build area

# usr/sbin/rear -v format /dev/sdb
...
Exiting rear format (PID 11371) and its descendant processes ...
Running exit tasks

# usr/sbin/rear -v mkbackup
...
Exiting rear mkbackup (PID 12418) and its descendant processes ...
Running exit tasks

I checked that during "rear -v format" and "rear -v mkbackup"
build areas appeared under /other/ and got automatically removed.

jsmeix commented at 2023-12-22 12:43:

I cannot help with 'rsync' specific issues
because I am not a 'rsync' user.
I assume it does not matter regarding TMPDIR
if 'tar' or 'rsync' is used.

I don't know if 'rsync' with OUTPUT=USB works with

OUTPUT=USB
BACKUP=NETFS
BACKUP_PROG=rsync
BACKUP_URL="usb:///dev/disk/by-label/REAR-000"
USB_DEVICE_FILESYSTEM=ext4
USB_RETAIN_BACKUP_NR=1

pcahyna commented at 2024-01-02 11:24:

NAME             KNAME          PKNAME         TRAN   TYPE   FSTYPE            LABEL           SIZE MOUNTPOINT
/dev/sde         /dev/sde                      usb    disk                                     4.5T
|-/dev/sde1      /dev/sde1      /dev/sde              part   vfat              REAR-EFI          1G
`-/dev/sde2      /dev/sde2      /dev/sde              part   ntfs              wd5tb           4.5T /mnt/sde2

#export TMPDIR="/mnt/sde2/reartmp"

I doubt that putting TMPDIR on a NTFS filesystem can work properly. Most likely NTFS does not support all the needed attributes, like the executable bit (that would explain the ldd error).

schlomo commented at 2024-01-13 18:28:

@nnachtegael can you please share with us the actual problem you are trying to solve? Can it be that your system is so full that there is not enough disk space on any hard disk for the ReaR build area? Or do you want to do a ReaR backup without touching the local disks?

In any case, as @pcahyna mentioned the TMPDIR for sure needs to be a regular Linux filesystem.

The same holds true for the target of an rsync backup, but looking at your disks it seems like that is already the case.

For backup to USB storage I'd also recommend using an archive instead of rsync as you would then benefit from the compression, which both reduces the required disk space and probably increases the backup performance.

So if you can share more of the problem you want to solve (like big picture) or more of your context, then we can surely give you some ideas how to solve it.


[Export of Github issue for rear/rear.]