#1921 Issue closed: ERROR: Could not copy /boot/grub/locale/ files

Labels: enhancement, support / question, fixed / solved / done

kgosismalz opened issue at 2018-10-04 11:55:

Relax-and-Recover (ReaR) Issue Template

Fill in the following items before submitting a new issue
(quick response is not guaranteed with free support):

  • ReaR version ("/usr/sbin/rear -V"):
$ /usr/sbin/rear -V
Relax-and-Recover 2.4 / 2018-06-21
  • OS version ("cat /etc/rear/os.conf" or "lsb_release -a" or "cat /etc/os-release"):
lsb_release -a
No LSB modules are available.
Distributor ID: Ubuntu
Description:    Ubuntu 16.04.3 LTS
Release:        16.04
Codename:       xenial
  • ReaR configuration files ("cat /etc/rear/site.conf" and/or "cat /etc/rear/local.conf"):
$ cat /etc/rear/site.conf
O$UTPUT=ISO
BACKUP=NETFS
NETFS_URL=nfs://IP/export/backups
NETFS_KEEP_OLD_BACKUP_COPY=1
BACKUP_PROG_EXCLUDE=( "${BACKUP_PROG_EXCLUDE[@]}" '/backup/*')
  • Hardware (PC or PowerNV BareMetal or ARM) or virtual machine (KVM guest or PoverVM LPAR):
    Virtual Machine on Hyper-V

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

$ uname -a
Linux * 4.4.0-93-generic #116-Ubuntu SMP Fri Aug 11 21:17:51 UTC 2017 x86_64 x86_64 x86_64 GNU/Linux
  • Firmware (BIOS or UEFI or Open Firmware) and bootloader (GRUB or ELILO or Petitboot):

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

  • Description of the issue (ideally so that others can reproduce it):
    Issued command "sudo /usr/sbin/rear -v mkrescue" and Rear terminated with an error;

/var/log/rear/rear-gp-ham-crm-p05.log
grub-mkimage: info: reading /usr/lib/grub/x86_64-efi/btrfs.mod.
grub-mkimage: info: reading /tmp/rear.kUWQCZc72yfUnRn/tmp/mnt/EFI/BOOT/embedded_grub.cfg.
grub-mkimage: info: kernel_img=0x7f251b087010, kernel_size=0x18800.
grub-mkimage: info: the core size is 0xc5498.
grub-mkimage: info: writing 0xc6800 bytes.
'/boot/grub/fonts/unicode.pf2' -> '/tmp/rear.kUWQCZc72yfUnRn/tmp/mnt/EFI/BOOT/fonts/unicode.pf2'
cp: missing destination file operand after '/tmp/rear.kUWQCZc72yfUnRn/tmp/mnt/EFI/BOOT/locale/'
Try 'cp --help' for more information.
2018-10-04 12:26:09.928444400 ERROR: Could not copy /boot/grub/locale/ files
==== Stack trace ====
Trace 0: /usr/sbin/rear:543 main
Trace 1: /usr/share/rear/lib/mkrescue-workflow.sh:22 WORKFLOW_mkrescue
Trace 2: /usr/share/rear/lib/framework-functions.sh:101 SourceStage
Trace 3: /usr/share/rear/lib/framework-functions.sh:49 Source
Trace 4: /usr/share/rear/output/ISO/Linux-i386/250_populate_efibootimg.sh:97 source
Trace 5: /usr/share/rear/lib/_input-output-functions.sh:371 StopIfError
Message: Could not copy /boot/grub/locale/ files
== End stack trace ==
2018-10-04 12:26:09.956139500 Exiting rear mkrescue (PID 19666) and its descendant processes
2018-10-04 12:26:11.019264700 rear,19666 /usr/sbin/rear -v mkrescue
  `-rear,37897 /usr/sbin/rear -v mkrescue
      `-pstree,37898 -Aplau 19666
/usr/share/rear/lib/_input-output-functions.sh: line 157: kill: (37901) - No such process
2018-10-04 12:26:11.076307000 Running exit tasks
removed directory '/tmp/rear.kUWQCZc72yfUnRn/outputfs'
2018-10-04 12:26:11.201140300 Finished in 98 seconds
2018-10-04 12:26:11.203903100 Removing build area /tmp/rear.kUWQCZc72yfUnRn
removed directory '/tmp/rear.kUWQCZc72yfUnRn'
2018-10-04 12:26:11.593319900 End of program reached
  • Work-around, if any:

jsmeix commented at 2018-10-04 12:27:

As far as I see it fails in
usr/share/rear/output/ISO/Linux-i386/250_populate_efibootimg.sh
at

if [ -d $grubdir/locale ]; then
    cp $v $grubdir/locale/* $TMP_DIR/mnt/EFI/BOOT/locale/ >&2
    StopIfError "Could not copy $grubdir/locale/ files"

which means (as far as I can imagine because I do not use Ubuntu)
there is a $grubdir/locale = /boot/grub/locale/ directory
but it contains no files so that $grubdir/locale/* evaluates to empty
(because usr/sbin/rear sets the nullglob bash option)
which results the invalid cp command

cp -v /tmp/rear.kUWQCZc72yfUnRn/tmp/mnt/EFI/BOOT/locale/

which fails accordingly.

@kgosismalz
do you know why you have a /boot/grub/locale/ directory
but it contains no files?

As a workaround to avoid that issue it should help
when you change that part of the code in your
usr/share/rear/output/ISO/Linux-i386/250_populate_efibootimg.sh
to something like

if test "$( echo $grubdir/locale/* )" ; then
    cp $v $grubdir/locale/* $TMP_DIR/mnt/EFI/BOOT/locale/ >&2
    StopIfError "Could not copy $grubdir/locale/ files"

kgosismalz commented at 2018-10-05 06:48:

@jsmeix, I use Rear on two similar Ubuntu versions and they also contain zero files in the /boot/grub/locale/ but the backups are always successful.

However, I will apply your suggestions and report back.

Thanks.

kgosismalz commented at 2018-10-05 07:22:

@jsmeix, I applied your workaround and we are now able to backup files.

Thanks.

jsmeix commented at 2018-10-05 11:58:

@kgosismalz
thank you for your prompt feedback, it helps me a lot!

Via https://github.com/rear/rear/pull/1922
I avoid some more of those nullglob pitfalls in 250_populate_efibootimg.sh
and I generally overhalued that script.


[Export of Github issue for rear/rear.]