| Summary: | /etc/grub.d/30_uefi-firmware does not work with zero | ||
|---|---|---|---|
| Product: | Sisyphus | Reporter: | Ivan A. Melnikov <iv> |
| Component: | grub-common | Assignee: | Николай Костригин <nickel> |
| Status: | CLOSED FIXED | QA Contact: | qa-sisyphus |
| Severity: | normal | ||
| Priority: | P5 | CC: | jqt4, nickel, placeholder, rider, sin |
| Version: | unstable | ||
| Hardware: | all | ||
| OS: | Linux | ||
Очень странный кусок кода:
$(printf 0x%x \'"$(cat $OS_INDICATIONS | cut -b5)"\')
По всей видимости, от пытается получить младший байт переменной OsIndicationsSupported из 8be4df61-93ca-11d2-aa0d-00e098032b8c (в файлах efivars первые 4 байта заглолвок), однако получается у него совсем не это:
$ xxd test2.bin
00000000: 0600 0000 0000 0000 0000 0000 ............
$ echo $(printf 0x%x \'"$(cat test2.bin | cut -b5)"\')
-bash: warning: command substitution: ignored null byte in input
0x27
0x27 -- это одинарная кавычка ("'").
Вообще, вместо таких сложных подстановок с пайпами можно было бы просто взять od, bash прекрасно умеет побитовые операции и с десятичными числами:
$ od -An -t u8 --read-bytes=1 --skip-bytes=4 test2.bin
0
$ xxd test3.bin
00000000: 0600 0000 1122 3344 5566 7788 ....."3DUfw.
$ od -An -t u8 --read-bytes=1 --skip-bytes=4 test3.bin
17
(да, 17 == 0x11).
Могу сделать патч.
Да, давайте конечно патч. (In reply to Anton Farygin from comment #2) > Да, давайте конечно патч. По-моему, как-то так: http://git.altlinux.org/people/iv/packages/?p=grub.git;a=commitdiff;h=6889ce261a7f4bfe91e8507043bad26c94f7ad75 Спасибо за патч grub-2.06-alt7 -> sisyphus: Thu Feb 24 2022 Nikolai Kostrigin <nickel@altlinux> 2.06-alt7 - grub-efi: improve RPM filetrigger and post install script to skip all actions in case of being invoked at package installing stage by OS installer (closes: #42025) - 30_uefi-firmware.in: Fix for zero supported indications (closes: #41970) - pack 41_custom as there appear to be users of it (closes: #41832) |
Некоторые реализации UEFI (например, u-boot) не поддерживают ни один из OS Indicators: # xxd /sys/firmware/efi/efivars/OsIndicationsSupported-8be4df61-93ca-11d2-aa0d-00e098032b8c 00000000: 0600 0000 0000 0000 0000 0000 ............ В этом случае 30_uefi-firmware должен, по идее, ничего не делать, однако он выдаёт ошибку и добавляет в config не рабочий menuentry: # grub-mkconfig [...] ### BEGIN /etc/grub.d/30_uefi-firmware ### /etc/grub.d/30_uefi-firmware: line 34: warning: command substitution: ignored null byte in input Adding boot menu entry for UEFI Firmware Settings ... menuentry 'UEFI Firmware Settings' $menuentry_id_option 'uefi-firmware' { fwsetup } ### END /etc/grub.d/30_uefi-firmware ### [...]