#2552 Issue closed: ./EFI/BOOT/grub.cfg': No space left on device

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

abbbi opened issue at 2021-01-13 13:48:

  • ReaR version ("/usr/sbin/rear -V"):
    2.6

In certain cases REAR backup might fail while propagating the the EFI boot partition contents:

[..]
cp: error writing '/tmp/rear.PXM8Jei7m8TJjSA/tmp/efi_virt/./EFI/BOOT/elilo.conf': No space left on device
'/tmp/rear.PXM8Jei7m8TJjSA/tmp/mnt/./EFI/BOOT/grub.cfg' -> '/tmp/rear.PXM8Jei7m8TJjSA/tmp/efi_virt/./EFI/BOOT/grub.cfg'
cp: error writing '/tmp/rear.PXM8Jei7m8TJjSA/tmp/efi_virt/./EFI/BOOT/grub.cfg': No space left on device
'/tmp/rear.PXM8Jei7m8TJjSA/tmp/mnt/./EFI/BOOT/embedded_grub.cfg' -> '/tmp/rear.PXM8Jei7m8TJjSA/tmp/efi_virt/./EFI/BOOT/embedded_grub.cfg'
cp: error writing '/tmp/rear.PXM8Jei7m8TJjSA/tmp/efi_virt/./EFI/BOOT/embedded_grub.cfg': No space left on device
umount: /tmp/rear.PXM8Jei7m8TJjSA/tmp/efi_virt (/dev/loop1) unmounted

The cause for the issue seems to be the calculated amount of the of EFI virtual image blocks as done in:

usr/share/rear/output/ISO/Linux-i386/700_create_efibootimg.sh
[..]
efi_img_sz=( $( du --block-size=32M --summarize $TMP_DIR/mnt ) )
[..]

The Amount of blocks here is calculated to small for the data to fit in:

For more Detail:

du --summarize --block-size=32M tmp/mnt
7       tmp/mnt
/tmp/rear.PXM8Jei7m8TJjSA # du --summarize tmp/mnt
229348  tmp/mnt
/tmp/rear.PXM8Jei7m8TJjSA # echo $((7 * 32 * 1024))
229376
/tmp/rear.PXM8Jei7m8TJjSA # echo $((229376 - 229348))
28

usr/share/rear/output/ISO/Linux-i386/700_create_efibootimg.sh

should probably check if the amount of blocks that is used is enough for the data to
to be stored and if not, allocate another block?

Or would it be save to allocate one block more, just for safety ($efi_img_sz++)
I lack required information about UEFI/EFI if this could cause any issues.

gdha commented at 2021-01-22 15:53:

@abbbi Please provide a PR if you find the time for it - thanks.

abbbi commented at 2021-01-29 08:36:

@abbbi Please provide a PR if you find the time for it - thanks.

im happy to provide PR, but i dont know about the background. Is it of any issue if the image size is just one block bigger? If not, the fix would be quite simple.

gdha commented at 2021-01-29 11:16:

@abbbi As long we do not go beyond the borderies I'm ok with that.
@jsmeix @gozora What is your opinion on this matter?

gozora commented at 2021-01-29 11:45:

Hey @gdha,

Surprisingly I've faced similar issue on couple (maybe 10-15 out of ~1000) of my servers.
This issue seems to hit systems with certain size of $TMP_DIR/mnt.
I did not had time to investigate this issue further so I just applied "the rule of thumb" and applied quick and dirty patch:

# diff -ruNp /usr/share/rear/output/ISO/Linux-i386/70_create_efibootimg.sh /repository/custom/rear/70_create_efibootimg.sh
--- /usr/share/rear/output/ISO/Linux-i386/70_create_efibootimg.sh       2016-04-07 08:59:10.000000000 +0000
+++ /repository/custom/rear/70_create_efibootimg.sh     2020-07-30 14:31:58.018057088 +0000
@@ -8,7 +8,8 @@ is_true $USING_UEFI_BOOTLOADER || return
 # The du output is stored in an artificial bash array
 # so that $efi_img_sz can be simply used to get the first word
 # which is the disk usage of the directory measured in 32MiB blocks:
-efi_img_sz=( $( du --block-size=32M --summarize $TMP_DIR/mnt ) )
+sleep 5
+efi_img_sz=$(( $( du --block-size=32M --summarize $TMP_DIR/mnt | awk '{print $1}' ) + 2 ))
 StopIfError "Failed to determine disk usage of EFI virtual image content directory."

 # prepare EFI virtual image aligned to 32MiB blocks:

At first I've suspected some timing issue so I've added sleep 5. But I guess it is not necessary for this workaround.

Hope it helps.

V.

jsmeix commented at 2021-01-29 12:15:

@gozora
as far as I understand (as EFI noob) it your workaround in
https://github.com/rear/rear/issues/2552#issuecomment-769757174

efi_img_sz=$(( $( du --block-size=32M --summarize $TMP_DIR/mnt | awk '{print $1}' ) + 2 ))

by adding 2 more 32MiB blocks in any case aswers the question from @abbbi
https://github.com/rear/rear/issues/2552#issuecomment-769661520
"Is it of any issue if the image size is just one block bigger?"

gozora commented at 2021-01-29 12:20:

Hello @jsmeix

"Is it of any issue if the image size is just one block bigger?"

It is some time since I've dealt with this issue, but I guess I've added 2 blocks, just to be on safe site ;-).

V.

jsmeix commented at 2021-01-29 12:31:

I proposed https://github.com/rear/rear/pull/2562

@abbbi
could you test if the change in https://github.com/rear/rear/pull/2562
works for you?

jsmeix commented at 2021-02-01 14:57:

With https://github.com/rear/rear/pull/2562 merged this issue should be avoided.

@abbbi
thank you for your issue report and for your analysis
of the exact code part where things failed.


[Export of Github issue for rear/rear.]