#2683 Issue closed: mkbackup on uefi to USB drive error: Failed to copy KERNEL_FILE (cp: failed to preserve ownership)

Labels: bug, fixed / solved / done

bearpebble opened issue at 2021-09-29 08:32:

Relax-and-Recover (ReaR) Issue Template

  • ReaR version ("/usr/sbin/rear -V"):
    Relax-and-Recover 2.6 / Git (d032145b15a9e9c7f8df63d4bfe1e977b41cafee)

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

NAME=Fedora
VERSION="34 (Workstation Edition)"
ID=fedora
VERSION_ID=34
VERSION_CODENAME=""
PLATFORM_ID="platform:f34"
PRETTY_NAME="Fedora 34 (Workstation Edition)"
ANSI_COLOR="0;38;2;60;110;180"
LOGO=fedora-logo-icon
CPE_NAME="cpe:/o:fedoraproject:fedora:34"
HOME_URL="https://fedoraproject.org/"
DOCUMENTATION_URL="https://docs.fedoraproject.org/en-US/fedora/f34/system-administrators-guide/"
SUPPORT_URL="https://fedoraproject.org/wiki/Communicating_and_getting_help"
BUG_REPORT_URL="https://bugzilla.redhat.com/"
REDHAT_BUGZILLA_PRODUCT="Fedora"
REDHAT_BUGZILLA_PRODUCT_VERSION=34
REDHAT_SUPPORT_PRODUCT="Fedora"
REDHAT_SUPPORT_PRODUCT_VERSION=34
PRIVACY_POLICY_URL="https://fedoraproject.org/wiki/Legal:PrivacyPolicy"
VARIANT="Workstation Edition"
VARIANT_ID=workstation
  • ReaR configuration files ("cat /etc/rear/site.conf" and/or "cat /etc/rear/local.conf"):
### write the rescue initramfs to USB and update the USB bootloader
OUTPUT=USB

### create a backup using the internal NETFS method, using 'tar'
BACKUP=NETFS

### write both rescue image and backup to the device labeled REAR-000
BACKUP_URL=usb:///dev/disk/by-label/REAR-000
  • 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):
    UEFI, GRUB2

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

  • Storage layout ("lsblk -ipo NAME,KNAME,PKNAME,TRAN,TYPE,FSTYPE,SIZE,MOUNTPOINT"):

NAME                                                      KNAME          PKNAME         TRAN   TYPE  FSTYPE        SIZE MOUNTPOINT
/dev/loop0                                                /dev/loop0                           loop  squashfs        4K /var/lib/snapd/snap/bare/5
/dev/loop1                                                /dev/loop1                           loop  squashfs       51M /var/lib/snapd/snap/snap-store/547
/dev/loop2                                                /dev/loop2                           loop  squashfs      219M /var/lib/snapd/snap/gnome-3-34-1804/72
/dev/loop3                                                /dev/loop3                           loop  squashfs     99.3M /var/lib/snapd/snap/core/11606
/dev/loop4                                                /dev/loop4                           loop  squashfs     65.2M /var/lib/snapd/snap/gtk-common-themes/1519
/dev/loop5                                                /dev/loop5                           loop  squashfs     55.4M /var/lib/snapd/snap/core18/2128
/dev/loop6                                                /dev/loop6                           loop  squashfs     32.3M /var/lib/snapd/snap/snapd/13170
/dev/sda                                                  /dev/sda                      usb    disk              931.5G 
|-/dev/sda1                                               /dev/sda1      /dev/sda              part  vfat          512M 
`-/dev/sda2                                               /dev/sda2      /dev/sda              part  ext3          931G 
/dev/zram0                                                /dev/zram0                           disk                  8G [SWAP]
/dev/nvme0n1                                              /dev/nvme0n1                  nvme   disk              476.9G 
|-/dev/nvme0n1p1                                          /dev/nvme0n1p1 /dev/nvme0n1   nvme   part  vfat          600M /boot/efi
|-/dev/nvme0n1p2                                          /dev/nvme0n1p2 /dev/nvme0n1   nvme   part  ext4            1G /boot
`-/dev/nvme0n1p3                                          /dev/nvme0n1p3 /dev/nvme0n1   nvme   part  crypto_LUKS 475.4G 
  `-/dev/mapper/luks-0ebe953b-7d05-42b4-9e20-af5644f252c4 /dev/dm-0      /dev/nvme0n1p3        crypt btrfs       475.3G /home
[root@fedora ~]# ls -lah /boot/efi/EFI/fedora/grubx64.efi    # works
-rwx------. 1 root root 2.5M Jun 15 17:41 /boot/efi/EFI/fedora/grubx64.efi
[root@fedora ~]# ls -lah /boot/vmlinuz-5.13.16-200.fc34.x86_64   # error
-rwxr-xr-x. 1 root root 11M Sep 13 14:55 /boot/vmlinuz-5.13.16-200.fc34.x86_64
  • Workaround, if any:
    Removing the -p flag from the cp command on the line linked above leads to a successful run. But I'm not sure whether this is the correct fix or if this breaks something.

  • Attachments
    output of usr/sbin/rear -v -D mkbackup

usr/sbin/rear -D -v mkbackup
Relax-and-Recover 2.6 / Git
Running rear mkbackup (PID 43064 date 2021-09-29 09:42:47)
Command line options: /home/user/dev/rear/usr/sbin/rear -D -v mkbackup
Using log file: /home/user/dev/rear/var/log/rear/rear-fedora.log
Using build area: /var/tmp/rear.dFZTdzBNpo7BI7F
Running workflow mkbackup on the normal/original system
Using backup archive '/var/tmp/rear.dFZTdzBNpo7BI7F/outputfs/rear/fedora/20210929.0942/backup.tar.gz'
Found EFI system partition /dev/nvme0n1p1 on /boot/efi type vfat
Using UEFI Boot Loader for Linux (USING_UEFI_BOOTLOADER=1)
Using autodetected kernel '/boot/vmlinuz-5.13.16-200.fc34.x86_64' as kernel in the recovery system
Creating disk layout
Overwriting existing disk layout file /home/user/dev/rear/var/lib/rear/layout/disklayout.conf
Automatically excluding filesystem /tmp/rear-efi.OOv1HZ8SbH
Marking component 'fs:/tmp/rear-efi.OOv1HZ8SbH' as done in /home/user/dev/rear/var/lib/rear/layout/disktodo.conf
Automatically excluding disk /dev/sda (not used by any mounted filesystem)
Marking component '/dev/sda' as done in /home/user/dev/rear/var/lib/rear/layout/disktodo.conf
Dependant component /dev/sda1 is a child of component /dev/sda
Marking component '/dev/sda1' as done in /home/user/dev/rear/var/lib/rear/layout/disktodo.conf
Dependant component /dev/sda2 is a child of component /dev/sda
Marking component '/dev/sda2' as done in /home/user/dev/rear/var/lib/rear/layout/disktodo.conf
Dependant component fs:/tmp/rear-efi.OOv1HZ8SbH is a child of component /dev/sda
Component 'fs:/tmp/rear-efi.OOv1HZ8SbH' is marked as 'done fs:/tmp/rear-efi.OOv1HZ8SbH' in /home/user/dev/rear/var/lib/rear/layout/disktodo.conf
Disabling excluded components in /home/user/dev/rear/var/lib/rear/layout/disklayout.conf
Disabling component 'disk /dev/sda' in /home/user/dev/rear/var/lib/rear/layout/disklayout.conf
Disabling component 'part /dev/sda' in /home/user/dev/rear/var/lib/rear/layout/disklayout.conf
Component 'part /dev/sda' is disabled in /home/user/dev/rear/var/lib/rear/layout/disklayout.conf
Disabling component 'fs ... /tmp/rear-efi.OOv1HZ8SbH' in /home/user/dev/rear/var/lib/rear/layout/disklayout.conf
Using guessed bootloader 'EFI' for 'rear recover' (found in first bytes on /dev/nvme0n1)
Verifying that the entries in /home/user/dev/rear/var/lib/rear/layout/disklayout.conf are correct
Created disk layout (check the results in /home/user/dev/rear/var/lib/rear/layout/disklayout.conf)
Creating recovery system root filesystem skeleton layout
Skipping 'virbr0': not bound to any physical interface.
Handling network interface 'wlp0s20f3'
wlp0s20f3 is a physical device
Handled network interface 'wlp0s20f3'
Included current keyboard mapping (via 'dumpkeys -f')
No default US keyboard mapping included (no 'defkeymap.*' found in /lib/kbd/keymaps)
Included other keyboard mappings in /lib/kbd/keymaps
To log into the recovery system via ssh set up /root/.ssh/authorized_keys or specify SSH_ROOT_PASSWORD
Trying to find what to use as UEFI bootloader...
Trying to find a 'well known file' to be used as UEFI bootloader...
Using '/boot/efi/EFI/fedora/grubx64.efi' as UEFI bootloader file
Copying logfile /home/user/dev/rear/var/log/rear/rear-fedora.log into initramfs as '/tmp/rear-fedora-partial-2021-09-29T09:42:54+02:00.log'
Copying files and directories
Copying binaries and libraries
Copying all kernel modules in /lib/modules/5.13.16-200.fc34.x86_64 (MODULES contains 'all_modules')
Copying all files in /lib*/firmware/
Skip copying broken symlink '/etc/mtab' target '/proc/55235/mounts' on /proc/ /sys/ /dev/ or /run/
Skip copying broken symlink '/etc/resolv.conf' target '/run/systemd/resolve/stub-resolv.conf' on /proc/ /sys/ /dev/ or /run/
Broken symlink '/usr/lib/modules/5.13.16-200.fc34.x86_64/build' in recovery system because 'readlink' cannot determine its link target
Broken symlink '/usr/lib/modules/5.13.16-200.fc34.x86_64/source' in recovery system because 'readlink' cannot determine its link target
Testing that the recovery system in /var/tmp/rear.dFZTdzBNpo7BI7F/rootfs contains a usable system
Testing each binary with 'ldd' and look for 'not found' libraries within the recovery system
Testing that the existing programs in the PROGS array can be found as executable command within the recovery system
Testing that each program in the REQUIRED_PROGS array can be found as executable command within the recovery system
Creating recovery/rescue system initramfs/initrd initrd.cgz with gzip default compression
Created initrd.cgz with gzip default compression (386083815 bytes) in 13 seconds
ERROR: Failed to copy KERNEL_FILE '/boot/vmlinuz-5.13.16-200.fc34.x86_64' to /tmp/rear-efi.nswrvP2fe0//EFI/BOOT/kernel
Some latest log messages since the last called script 100_create_efiboot.sh:
2021-09-29 09:43:35.795792901 Entering debugscript mode via 'set -x'.
2021-09-29 09:43:35.800111446 Configuring device for EFI boot
'/boot/efi/EFI/fedora/grubx64.efi' -> '/tmp/rear-efi.nswrvP2fe0//EFI/BOOT/BOOTX64.efi'
'/boot/vmlinuz-5.13.16-200.fc34.x86_64' -> '/tmp/rear-efi.nswrvP2fe0//EFI/BOOT/kernel'
cp: failed to preserve ownership for '/tmp/rear-efi.nswrvP2fe0//EFI/BOOT/kernel': Operation not permitted
Aborting due to an error, check /home/user/dev/rear/var/log/rear/rear-fedora.log for details
Exiting rear mkbackup (PID 43064) and its descendant processes ...
Running exit tasks
To remove the build area use (with caution): rm -Rf --one-file-system /var/tmp/rear.dFZTdzBNpo7BI7F
Terminated

jsmeix commented at 2021-09-29 10:42:

@bearpebble
thank you for the bug report.
I will fix it...

jsmeix commented at 2021-09-29 12:11:

https://github.com/rear/rear/pull/2684
intends to fix in particular this issue.

@bearpebble
could you try out if the overhauled output/USB/Linux-i386/100_create_efiboot.sh
in https://github.com/rear/rear/pull/2684 works for you
by first saving your output/USB/Linux-i386/100_create_efiboot.sh like

cp -p usr/share/rear/output/USB/Linux-i386/100_create_efiboot.sh usr/share/rear/output/USB/Linux-i386/100_create_efiboot.sh.original

and then copying the content of
https://raw.githubusercontent.com/rear/rear/3211ec8084e6b55c83e17a4eaf9e67be64a9f599/usr/share/rear/output/USB/Linux-i386/100_create_efiboot.sh
over your usr/share/rear/output/USB/Linux-i386/100_create_efiboot.sh

bearpebble commented at 2021-09-30 06:59:

@jsmeix tested with your change and it worked. Thanks for the quick fixes

jsmeix commented at 2021-09-30 07:36:

@bearpebble
thank you again for your prompt test and feedback!

With https://github.com/rear/rear/pull/2684 merged
this issue is fixed.


[Export of Github issue for rear/rear.]