#3098 Issue closed: OUTPUT_URL=file://... conflicts with OUTPUT=USB but ReaR does not error out appropriately

Labels: bug, fixed / solved / done

malvinas2 opened issue at 2023-12-01 22:27:

  • ReaR version ("/usr/sbin/rear -V"):
    Relax-and-Recover 2.7-git.5333.0fd8a77a.master / 2023-12-01 (last master)

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

  • ReaR configuration files ("cat /etc/rear/site.conf" and/or "cat /etc/rear/local.conf"):
    local.conf:

OUTPUT=USB
BACKUP=NETFS
BACKUP_URL=usb:///dev/disk/by-label/REAR-000
BACKUP_PROG_EXCLUDE=( "${BACKUP_PROG_EXCLUDE[@]}" '/meinesachen/*')
EXCLUDE_MOUNTPOINTS=(/media/disc)
EXCLUDE_MD=("/dev/md0" "/dev/md1" "/dev/md2" "/dev/md3" "/dev/md4")
EXCLUDE_VG=(lvraid)
  • Hardware vendor/product (PC or PowerNV BareMetal or ARM) or VM (KVM guest or PowerVM LPAR):
    PC, Motherboard Gigabyte B560M DS3H V2

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

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

  • Storage layout ("lsblk -ipo NAME,KNAME,PKNAME,TRAN,TYPE,FSTYPE,LABEL,SIZE,MOUNTPOINT"):
    https://pastebin.com/raw/1g1SpQwm

  • Description of the issue (ideally so that others can reproduce it):

  • Plug in an USB-stick

  • Format it using rear format -- --efi /dev/sdg
  • Start ReaR using /usr/sbin/rear -v mkbackup
  • Abort due to an error:
BUG in /usr/share/rear/output/USB/Linux-i386/850_make_USB_bootable.sh line 63:
'Filesystem where the booting related files are on /dev/sdg could not be found'

See complete output: https://pastebin.com/raw/rRdvnQDs

  • What I have tried:

  • tried two different USB-Sticks, fresh out-of-the box

mkdir -p /mnt/rear_test
mount /dev/disk/by-label/REAR-000 /mnt/rear_test
cat /proc/mounts

shows
/dev/sdg2 /mnt/rear_test ext3 rw,relatime 0 0
so I don't understand why the case conditional statement "$usb_filesystem" in line 32 of file /usr/share/rear/output/USB/Linux-i386/850_make_USB_bootable.sh doesn't find "ext3". I inserted a "sleep 2" before the definition of usb_filesystem, no change

pcahyna commented at 2023-12-04 11:59:

usb_filesystem gets assigned here:

https://github.com/rear/rear/blob/0fd8a77add3d5c4dec44393abca847e33b2f47fe/usr/share/rear/output/USB/Linux-i386/850_make_USB_bootable.sh#L31

please show the output of grep " /var/tmp/rear.xDPgkw0v4eTr9Dy/outputfs " /proc/mounts - hopefully we will see what is the problem from there.

pcahyna commented at 2023-12-04 12:11:

I see something suspect in the log:

2023-12-01 22:55:26.566790320 Including prep/NETFS/default/980_umount_NETFS_dir.sh
2023-12-01 22:55:26.571158792 Unmounting '/var/tmp/rear.xDPgkw0v4eTr9Dy/outputfs'

I would expect to see outputfs mounted again, but there is just

2023-12-01 22:57:06.984775757 Including output/default/100_mount_output_path.sh

and no log message from it.

I suspect outputfs is not mounted at this point.

Can you please rerun rear mkrescue with -D and provide the complete output?

malvinas2 commented at 2023-12-04 22:39:

Outputs and debug logs of mkrescue and mkbackup:
output_mkrescue.txt
rear-jammy__mkrescue_d.log
output_mkbackup.txt
rear-jammy__mkbackup_d.log

malvinas2 commented at 2023-12-04 22:41:

please show the output of grep " /var/tmp/rear.xDPgkw0v4eTr9Dy/outputfs " /proc/mounts - hopefully we will see what is the problem from there.

Well, there is no output...

root@jammy:~# grep "/var/tmp/rear.sp5QVNiZuk6Ml7v/outputfs/" /proc/mounts
root@jammy:~# grep " /var/tmp/rear.sp5QVNiZuk6Ml7v/outputfs " /proc/mounts
root@jammy:~# grep "/var/tmp/rear.sp5QVNiZuk6Ml7v/outputfs" /proc/mounts

root@jammy:~# lsa /var/tmp/rear.sp5QVNiZuk6Ml7v
insgesamt 20
drwx------  5 root root 4096 Dez  4 23:26 .
drwxrwxrwt  9 root root 4096 Dez  4 23:26 ..
drwx------  4 root root 4096 Dez  4 23:26 outputfs
drwxr-xr-x 16 root root 4096 Dez  4 23:24 rootfs
drwxr-xr-x  4 root root 4096 Dez  4 23:26 tmp

root@jammy:~# lsa /var/tmp/rear.sp5QVNiZuk6Ml7v/outputfs/
insgesamt 16
drwx------ 4 root root 4096 Dez  4 23:26 .
drwx------ 5 root root 4096 Dez  4 23:26 ..
drwx------ 3 root root 4096 Dez  4 23:26 boot
drwx------ 3 root root 4096 Dez  4 23:26 rear

pcahyna commented at 2023-12-05 10:44:

Your debug log shows that you also have /etc/rear/site.conf with this content:

OUTPUT=ISO
BACKUP=NETFS
OUTPUT_URL=file:///media/relax
BACKUP_URL=iso://
BACKUP_PROG_EXCLUDE=("${BACKUP_PROG_EXCLUDE[@]}" '/meinesachen/*')
EXCLUDE_MOUNTPOINTS=(/media/disc)
EXCLUDE_MD=("/dev/md0" "/dev/md1" "/dev/md2" "/dev/md3" "/dev/md4")
EXCLUDE_VG=(lvraid)

Since OUTPUT_URL is not set in your local.conf, this setting persists, and since it uses file://, ReaR expects that the output filesystem is already mounted there, which it is not.

pcahyna commented at 2023-12-05 10:47:

See above:

  • ReaR configuration files ("cat /etc/rear/site.conf" and/or "cat /etc/rear/local.conf"):

pcahyna commented at 2023-12-05 13:33:

There should be some detection and early exit with a meaningful error message when such condition occurs, but when investinating the code, I could not understand it and it seems like a mess. In particular, it does not seem to take into account the possibility that OUTPUT_URL can be different from BACKUP_URL for OUTPUT=USB, although this seems to me a perfectly legal combination (create bootable USB, but put backup somewhere else). The code uses USB_DEVICE, but it is determined preferably from BACKUP_URL, although it would be more logical to determine it from OUTPUT_URL.

malvinas2 commented at 2023-12-05 22:12:

I don't even remember ever using site.conf - my little cheat sheet only has local.conf and default.conf written down - but in fact this file was there with my usual entries.
After deleting it, the backup is smoothly created on the USB stick.
Thank you very much!

pcahyna commented at 2023-12-07 15:09:

@malvinas2 thanks for the verification!

It would be the best to add more code to the prep stage to verify the consistency of BACKUP_URL, OUTPUT_URL and USB_DEVICE, but I don't have the energy to untangle all this and this problem does not arise very often, so I am adding only one check that there is something mounted at $BUILD_DIR/outputfs: #3102

malvinas2 commented at 2023-12-08 12:16:

Why are there multiple configuration files anyway? In my opinion there should just be the default configuration (default.conf) and a custom configuration (local.conf).
If further user-defined configurations are required, these must be specified explicitly (e.g. as command line parameters).

jsmeix commented at 2023-12-08 13:48:

@malvinas2
site.conf is (optionally) for site specific configuration,
see "man rear" (excerpts):

FILES
...
  /etc/rear/local.conf
    System specific configuration can be set here.

  /etc/rear/site.conf
    Site specific configuration can be set here
    (not created by default).
...
  /usr/share/rear/conf/default.conf
    Relax-and-Recover default values.
    Contains a complete set of parameters and its explanation.
    Do not edit or modify things therein but use
    local.conf or site.conf for specific settings.

e.g. online via
https://github.com/rear/rear/blob/master/doc/rear.8.adoc

jsmeix commented at 2023-12-12 07:36:

@pcahyna
thank you for debugging and for your fix!


[Export of Github issue for rear/rear.]