projg2 / installkernel-gentoo

Gentoo fork of installkernel from debianutils
GNU General Public License v2.0
19 stars 7 forks source link

Unicode decode error #24

Closed SpomJ closed 6 months ago

SpomJ commented 6 months ago

UnicodeDecodeError: 'utf-16-le' codec can't decode bytes in position 4-5: illegal UTF-16 surrogate

Full output ``` # make install INSTALL /boot Loading /usr/lib/kernel/install.conf… layout=uki set via /usr/lib/kernel/install.conf INITRD_GENERATOR (none) set via /usr/lib/kernel/install.conf. UKI_GENERATOR (ukify) set via /usr/lib/kernel/install.conf. Loaded /usr/lib/kernel/install.conf. MACHINE_ID=e11287d9d73f480fa79f3b4ffa3b71fe set via /etc/machine-id. Found cgroup2 on /sys/fs/cgroup/, full unified hierarchy Found container virtualization none. Directory "/boot" is not the root of the file system. Couldn't find an XBOOTLDR partition. Using EFI System Partition at /efi as $BOOT_ROOT. Using entry token: e11287d9d73f480fa79f3b4ffa3b71fe kernel version (6.7.9-gentoo) set via command line. kernel image file (/usr/src/linux/arch/x86/boot/bzImage) set via command line. Using ENTRY_DIR=/efi/e11287d9d73f480fa79f3b4ffa3b71fe/6.7.9-gentoo Using plugins: /usr/lib/kernel/install.d/00-00machineid-directory.install /usr/lib/kernel/install.d/10-copy-prebuilt.install /usr/lib/kernel/install.d/50-depmod.install /usr/lib/kernel/install.d/60-ukify.install /usr/lib/kernel/install.d/90-compat.install /usr/lib/kernel/install.d/90-loaderentry.install /usr/lib/kernel/install.d/90-uki-copy.install /usr/lib/kernel/install.d/95-efistub-kernel-bootcfg.install Plugin environment: LC_COLLATE=C.UTF-8 KERNEL_INSTALL_VERBOSE=1 KERNEL_INSTALL_IMAGE_TYPE=pe KERNEL_INSTALL_MACHINE_ID=e11287d9d73f480fa79f3b4ffa3b71fe KERNEL_INSTALL_ENTRY_TOKEN=e11287d9d73f480fa79f3b4ffa3b71fe KERNEL_INSTALL_BOOT_ROOT=/efi KERNEL_INSTALL_LAYOUT=uki KERNEL_INSTALL_INITRD_GENERATOR=none KERNEL_INSTALL_UKI_GENERATOR=ukify KERNEL_INSTALL_STAGING_AREA=/tmp/kernel-install.staging.V9iB92 Plugin arguments: add 6.7.9-gentoo /efi/e11287d9d73f480fa79f3b4ffa3b71fe/6.7.9-gentoo /usr/src/linux/arch/x86/boot/bzImage Successfully forked off '(sd-exec-strv)' as PID 142380. About to execute /usr/lib/kernel/install.d/00-00machineid-directory.install add 6.7.9-gentoo /efi/e11287d9d73f480fa79f3b4ffa3b71fe/6.7.9-gentoo /usr/src/linux/arch/x86/boot/bzImage Successfully forked off '(direxec)' as PID 142381. /usr/lib/kernel/install.d/00-00machineid-directory.install succeeded. About to execute /usr/lib/kernel/install.d/10-copy-prebuilt.install add 6.7.9-gentoo /efi/e11287d9d73f480fa79f3b4ffa3b71fe/6.7.9-gentoo /usr/src/linux/arch/x86/boot/bzImage Successfully forked off '(direxec)' as PID 142382. Copying prebuilt UKI to staging area /usr/lib/kernel/install.d/10-copy-prebuilt.install succeeded. About to execute /usr/lib/kernel/install.d/50-depmod.install add 6.7.9-gentoo /efi/e11287d9d73f480fa79f3b4ffa3b71fe/6.7.9-gentoo /usr/src/linux/arch/x86/boot/bzImage Successfully forked off '(direxec)' as PID 142385. +depmod -a 6.7.9-gentoo /usr/lib/kernel/install.d/50-depmod.install succeeded. About to execute /usr/lib/kernel/install.d/60-ukify.install add 6.7.9-gentoo /efi/e11287d9d73f480fa79f3b4ffa3b71fe/6.7.9-gentoo /usr/src/linux/arch/x86/boot/bzImage Successfully forked off '(direxec)' as PID 142386. KERNEL_INSTALL_LAYOUT and KERNEL_INSTALL_UKI_GENERATOR are good Wrote unsigned /tmp/kernel-install.staging.V9iB92/uki.efi /tmp/kernel-install.staging.V9iB92/uki.efi has been created /usr/lib/kernel/install.d/60-ukify.install succeeded. About to execute /usr/lib/kernel/install.d/90-compat.install add 6.7.9-gentoo /efi/e11287d9d73f480fa79f3b4ffa3b71fe/6.7.9-gentoo /usr/src/linux/arch/x86/boot/bzImage Successfully forked off '(direxec)' as PID 142387. /usr/lib/kernel/install.d/90-compat.install succeeded. About to execute /usr/lib/kernel/install.d/90-loaderentry.install add 6.7.9-gentoo /efi/e11287d9d73f480fa79f3b4ffa3b71fe/6.7.9-gentoo /usr/src/linux/arch/x86/boot/bzImage Successfully forked off '(direxec)' as PID 142388. /usr/lib/kernel/install.d/90-loaderentry.install succeeded. About to execute /usr/lib/kernel/install.d/90-uki-copy.install add 6.7.9-gentoo /efi/e11287d9d73f480fa79f3b4ffa3b71fe/6.7.9-gentoo /usr/src/linux/arch/x86/boot/bzImage Successfully forked off '(direxec)' as PID 142389. Installing /tmp/kernel-install.staging.V9iB92/uki.efi as /efi/EFI/Linux/e11287d9d73f480fa79f3b4ffa3b71fe-6.7.9-gentoo.efi /usr/lib/kernel/install.d/90-uki-copy.install succeeded. About to execute /usr/lib/kernel/install.d/95-efistub-kernel-bootcfg.install add 6.7.9-gentoo /efi/e11287d9d73f480fa79f3b4ffa3b71fe/6.7.9-gentoo /usr/src/linux/arch/x86/boot/bzImage Successfully forked off '(direxec)' as PID 142392. Adding /efi/EFI/Linux/e11287d9d73f480fa79f3b4ffa3b71fe-6.7.9-gentoo.efi to UEFI boot entries Traceback (most recent call last): File "/usr/lib/python-exec/python3.11/kernel-bootcfg", line 8, in sys.exit(main()) ^^^^^^ File "/usr/lib/python3.11/site-packages/virt/firmware/bootcfg/main.py", line 271, in main add_uki(cfg, options) File "/usr/lib/python3.11/site-packages/virt/firmware/bootcfg/main.py", line 43, in add_uki nr = cfg.find_uki_entry(efiuki.efi_filename()) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/lib/python3.11/site-packages/virt/firmware/bootcfg/bootcfg.py", line 104, in find_uki_entry optpath = str(ucs16.from_ucs16(entry.optdata, 0)).split()[0] ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/lib/python3.11/site-packages/virt/firmware/efi/ucs16.py", line 40, in __str__ return self.data.decode('utf-16le') ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/lib/python3.11/encodings/utf_16_le.py", line 16, in decode return codecs.utf_16_le_decode(input, errors, True) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ UnicodeDecodeError: 'utf-16-le' codec can't decode bytes in position 4-5: illegal UTF-16 surrogate /usr/lib/kernel/install.d/95-efistub-kernel-bootcfg.install failed with exit status 1. /usr/lib/kernel/install.d/95-efistub-kernel-bootcfg.install failed with exit status 1. (sd-exec-strv) failed with exit status 1. make[1]: *** [arch/x86/Makefile:295: install] Error 1 make: *** [Makefile:234: __sub-make] Error 2 ```
efibootmgr
plain ``` BootCurrent: 0001 Timeout: 1 seconds BootOrder: 0001,0018,0013,0014,0015,0016,0017,0019,001A Boot0001* Arch Linux HD(1,GPT,5b0af188-1674-2d48-a16e-bc5e83b17d8a,0x800,0x400000)/File(\vmlinuz-linux)72006f006f0074003d002f006400650076002f006e0076006d00650030006e00310070003300200072007700200069006e0069007400720064003d005c0069006e0069007400720061006d00660073002d006c0069006e00750078002e0069006d006700 Boot0010 Setup FvFile(721c8b66-426c-4e86-8e99-3457c46ab0b9) Boot0011 Boot Menu FvFile(86488440-41bb-42c7-93ac-450fbf7766bf) Boot0012 Diagnostic Splash FvFile(a7d8d9a6-6ab0-4aeb-ad9d-163e59a7a380) Boot0013* USB FDD: VenMsg(bc7838d2-0f82-4d60-8316-c068ee79d25b,6ff015a28830b543a8b8641009461e49) Boot0014* NVMe: Samsung SSD 970 EVO Plus 250GB PciRoot(0x0)/Pci(0x1d,0x0)/Pci(0x0,0x0)/NVMe(0x1,00-25-38-58-91-B3-A8-FB){99191c00-d932-4e4c-ae9a-a0b6e98eb8a4} Boot0015* ATA NVMe: VenMsg(bc7838d2-0f82-4d60-8316-c068ee79d25b,91af625956449f41a7b91f4f892ab0f602) Boot0016* ATA HDD: WDC WD5000LPCX-24VHAT0 PciRoot(0x0)/Pci(0x17,0x0)/Sata(1,0,0){5962af91-4456-419f-a7b9-1f4f892ab0f6} Boot0017* ATAPI CD: PLDS DVD-RW DA8AESH PciRoot(0x0)/Pci(0x17,0x0)/Sata(0,0,0){0a09a2ae-dedf-4e21-8b3a-5e471856a354} Boot0018* USB HDD: VenMsg(bc7838d2-0f82-4d60-8316-c068ee79d25b,33e821aaaf33bc4789bd419f88c50803) Boot0019* USB CD: VenMsg(bc7838d2-0f82-4d60-8316-c068ee79d25b,86701296aa5a7848b66cd49dd3ba6a55) Boot001A* PCI LAN: VenMsg(bc7838d2-0f82-4d60-8316-c068ee79d25b,78a84aaf2b2afc4ea79cf5cc8f3d3803) ```
unicode ``` BootCurrent: 0001 Timeout: 1 seconds BootOrder: 0001,0018,0013,0014,0015,0016,0017,0019,001A Boot0001* Arch Linux HD(1,GPT,5b0af188-1674-2d48-a16e-bc5e83b17d8a,0x800,0x400000)/File(\vmlinuz-linux)root=/dev/nvme0n1p3 rw initrd=\initramfs-linux.img Boot0010 Setup FvFile(721c8b66-426c-4e86-8e99-3457c46ab0b9) Boot0011 Boot Menu FvFile(86488440-41bb-42c7-93ac-450fbf7766bf) Boot0012 Diagnostic Splash FvFile(a7d8d9a6-6ab0-4aeb-ad9d-163e59a7a380) Boot0013* USB FDD: VenMsg(bc7838d2-0f82-4d60-8316-c068ee79d25b,6ff015a28830b543a8b8641009461e49) Boot0014* NVMe: Samsung SSD 970 EVO Plus 250GB PciRoot(0x0)/Pci(0x1d,0x0)/Pci(0x0,0x0)/NVMe(0x1,00-25-38-58-91-B3-A8-FB)ᰀ餙乌骮뚠軩꒸ Boot0015* ATA NVMe: VenMsg(bc7838d2-0f82-4d60-8316-c068ee79d25b,91af625956449f41a7b91f4f892ab0f602) Boot0016* ATA HDD: WDC WD5000LPCX-24VHAT0 PciRoot(0x0)/Pci(0x17,0x0)/Sata(1,0,0)꾑奢䑖䆟릧伟⪉ Boot0017* ATAPI CD: PLDS DVD-RW DA8AESH PciRoot(0x0)/Pci(0x17,0x0)/Sata(0,0,0)ꊮਉ両㪋䝞嘘咣 Boot0018* USB HDD: VenMsg(bc7838d2-0f82-4d60-8316-c068ee79d25b,33e821aaaf33bc4789bd419f88c50803) Boot0019* USB CD: VenMsg(bc7838d2-0f82-4d60-8316-c068ee79d25b,86701296aa5a7848b66cd49dd3ba6a55) Boot001A* PCI LAN: VenMsg(bc7838d2-0f82-4d60-8316-c068ee79d25b,78a84aaf2b2afc4ea79cf5cc8f3d3803) ```

Install works either when SYSTEMD_KERNEL_INSTALL=0 or with all the PciRoot entries removed (though while the last one works, the table gets wiped by UEFI so there's not really any point in doing that other than for testing)

Nowa-Ammerlaan commented 6 months ago

Install works either when SYSTEMD_KERNEL_INSTALL=0

Without systemd's kernel-install, the kernels will be installed, but no uefi entries are made. We are still working on supporting USE=efistub with the traditional Debian installkernel method.

Looks like kernel-bootcfg fails when it is trying to determine if an entry for this kernel already exists. Probably what we should do here is catch the exception and ignore the entry that we cannot parse. Reporting this upstream.

Nowa-Ammerlaan commented 6 months ago

Could you test this patch for app-emulation/virt-firmware and let me know if it fixes your problem: https://gitlab.com/kraxel/virt-firmware/-/merge_requests/12

SpomJ commented 6 months ago

Yes, that solves the error

Nowa-Ammerlaan commented 6 months ago

Resolved upstream and snapshot updated.

0xr0bert commented 6 months ago

I get a similar error where I get an IndexError upstream, I have opened a MR upstream: https://gitlab.com/kraxel/virt-firmware/-/merge_requests/13