#2884 Issue closed: bootloader extlinux for output usb is not working for a vfat boot partition

Labels: enhancement, fixed / solved / done

DEvil0000 opened issue at 2022-10-26 14:51:

  • ReaR version ("/usr/sbin/rear -V"):
    2.7 and also master (f21a6d6940896c1fbdd51721560737df982b1a8d)

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

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

BACKUP=BORG
BORGBACKUP_ENC_TYPE="repokey"
export BORG_RELOCATED_REPO_ACCESS_IS_OK="yes"
export TMPDIR="/wsp_var/tmp/"
USING_UEFI_BOOTLOADER=1
OUTPUT=USB
OUTPUT_URL=usb:///dev/disk/by-label/REAR-EFI
USB_DEVICE=/dev/disk/by-label/REAR-000
USB_DEVICE_FILESYSTEM_LABEL=REAR-000
USB_DEVICE_PARTED_LABEL=gpt
USB_DEVICE_FILESYSTEM=ext4
USB_UEFI_PART_SIZE="2048"
BORGBACKUP_REPO="/borg"
BORGBACKUP_UMASK="0002"
  • Hardware vendor/product (PC or PowerNV BareMetal or ARM) or VM (KVM guest or PowerVM LPAR):
    HP gen9 380

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

  • 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"):

/dev/sda                       8:0    0   10G  0 disk 
|-/dev/sda1                    8:1    0  538M  0 part /boot/efi
`-/dev/sda2                    8:2    0  9.5G  0 part /boot
/dev/sdb                       8:16   0  1.6T  0 disk 
`-/dev/sdb1                    8:17   0  1.6T  0 part 
  |-/dev/mapper/system   253:4    0   46G  0 lvm  /
/dev/sdc                       8:32   1 57.3G  0 disk

/dev/sda1: UUID="FE85-310E" TYPE="vfat" PARTUUID="c9b6500b-9cd1-4011-b4aa-5d9feaa7ffcd"
  • Description of the issue (ideally so that others can reproduce it):
    rear format -- --efi
    rear mkrescue fails due to vfat as a boot partition FS on the running system.
    the error with -D:
Making /dev/sdc bootable with syslinux/extlinux
ERROR: Filesystem vfat for the booting related files is not supported
Some latest log messages since the last called script 850_make_USB_bootable.sh:
  2022-10-26 14:40:08.736359982 Entering debugscript mode via 'set -x'.
  2022-10-26 14:40:08.762337736 Making /dev/sdc bootable with syslinux/extlinux
Aborting due to an error, check /var/log/rear/rear-wsp61.log for details
Exiting rear mkrescue (PID 3012642) and its descendant processes ...
  • analysis:
    to my unserstanding syslinux should be fine with vfat while for extlinux it is not perfectly clear.
    as far as I remember vfat for the boot partition is fine too.

options:

  1. it should be perfectly fine to install a ext2 instead of a vfat FS on the boot partition in such a case.
    ext3 and ext4 should also work to my understanding but this may depend on your bios too.
    maybe just use some ext with a warning instead of a error and exit
  2. I remember it working with vfat so allowing this may work just fine.

  3. Workaround, if any:
    guess using ext2 on boot partition of the system would do or fixing the usb device manually.

DEvil0000 commented at 2022-11-03 12:25:

Now install the bootloader. For FAT, ext2/3/4, or btrfs boot partition use extlinux, where the device has been mounted:

this is from archwiki and tells us extlinux is fine with vfat.

not sure if this is actually the correct syntax but vfat should here be handled the same as extX.

diff --git a/usr/share/rear/output/USB/Linux-i386/850_make_USB_bootable.sh b/usr/share/rear/output/USB/Linux-i386/850_make_USB_bootable.sh
index f243b14a..5a7dc85a 100644
--- a/usr/share/rear/output/USB/Linux-i386/850_make_USB_bootable.sh
+++ b/usr/share/rear/output/USB/Linux-i386/850_make_USB_bootable.sh
@@ -30,7 +30,7 @@ LogPrint "Making $RAW_USB_DEVICE bootable with syslinux/extlinux"
 # so we search for " $BUILD_DIR/outputfs " in /proc/mounts to get the filesystem (third field) where the booting related files are:
 usb_filesystem=$( grep " $BUILD_DIR/outputfs " /proc/mounts | cut -d' ' -f3 | tail -1 )
 case "$usb_filesystem" in
-    (ext?)
+    (ext? | vfat)
         if [[ "$FEATURE_SYSLINUX_EXTLINUX_INSTALL" ]] ; then
             extlinux -i "$BUILD_DIR/outputfs/$SYSLINUX_PREFIX" || Error "'extlinux -i $BUILD_DIR/outputfs/$SYSLINUX_PREFIX' failed"
         else

github-actions commented at 2023-01-03 02:25:

Stale issue message

jsmeix commented at 2023-01-03 10:05:

Happy New Year!

@DEvil0000
does it work for you with the change in your
https://github.com/rear/rear/issues/2884#issuecomment-1302024086

I made
https://github.com/rear/rear/pull/2904
with that change right now but I could not yet test it.

DEvil0000 commented at 2023-01-03 14:27:

same to you!

yes, this fix is a valid fix. I guess it was the only bug preventing it to work but I do not actually remember if this was the only bug or not.

pcahyna commented at 2023-01-04 17:04:

I am curious how it happened, because I believe that with USING_UEFI_BOOTLOADER=1 leads to using GRUB as the bootloader, so the syslinux/extlinux part should be skipped. @jsmeix I suspect there may be a problem with your commit https://github.com/rear/rear/commit/93abd4e1026a10553aa835d8794893f1b0b9b6f6. Tse problem apparently is that even empty USB_BOOTLOADER= means GRUB in the UEFI case, see the comment in default.conf:

# Default is using GRUB2 for EFI other then elilo, extlinux for ext, syslinux otherwise:
USB_BOOTLOADER=

pcahyna commented at 2023-01-04 17:15:

hmm, it should not be the problem witht hat commit. I must admit I don't understand how this code is supposed to work and why is it using extlinux even on UEFI.

jsmeix commented at 2023-01-05 10:40:

@pcahyna
don't worry,
for me the whole OUTPUT=USB related code is a mystery ;-)

Cf.
https://github.com/rear/rear/issues/2588#issuecomment-805658626
and subsequent comments

jsmeix commented at 2023-01-10 13:21:

With https://github.com/rear/rear/pull/2904 merged
this specific issue should be fixed (hopefully).

DEvil0000 commented at 2023-01-10 19:05:

sorry for the late reply.

I am curious how it happened, because I believe that with USING_UEFI_BOOTLOADER=1 leads to using GRUB as the bootloader, so the syslinux/extlinux part should be skipped.

I remember it was not installing a efi bootloader the usual way but copying over the needed files. If i remember correct it was putting a syslinux-efi file there if USB_BOOTLOADER= was not set to grub. It is however possible that I set USB_BOOTLOADER to syslinx manually while testing.

Please also keep in mind that hybrid bootload (installing a bios and a uefi bootloader) is perfectly valid. This is what I started to introduce with the format flags --bios/--efi (none set is hybrid for usb at least).

for me the whole OUTPUT=USB related code is a mystery ;-)

the USB code is a bit of a mess as most of those options.
technically however it works mostly the same way as for RAW as well as for ISO. At least when it comes to the bootloader. This does not mean those 3 versions do the same thing since they do not share much code but they could.


[Export of Github issue for rear/rear.]