[systemd-devel] Failed to rename '\loader\entries\entry+3-0.conf' to 'entry+2-1.conf', ignoring: Access denied
Hugo LAFFONT
hugo.laffont at smile.fr
Fri Jun 21 11:48:28 UTC 2024
Hello,
I am creating an update system using systemd (repart + sysupdate) and
systemd-boot on an embedded target (beaglebone black).
Everything seems to works except the bootcounting of systemd-boot. "Failed
to rename '\loader\entries\entry+3-0.conf' to 'entry+2-1.conf', ignoring:
Access denied". This happens when the function handle->SetInfo(handle,
MAKE_GUID_PTR(EFI_FILE_INFO), file_info_size, file_info) is called
(src/boot/efi/boot.c line 1385). Then the system is able to boot but I need
to get this bootcouting system working to be able of doing fallback if the
update goes wrong.
According to the UEFI Specification we get Access denied after the call of
this function in these cases:
- An attempt is made to change the name of a file to a file that is
already present.
- An attempt is being made to change the EFI_FILE_DIRECTORY Attribute.
- An attempt is being made to change the size of a directory.
- InformationType is EFI_FILE_INFO_ID and the file was opened read-only
and an attempt is being made to modify a field other than Attribute.
However, none of these cases seem to happen because only the field FileName
is modified, the file is opened read/write before and the new name of the
file is not taken by an other file.
I tried first to find the implementation of SetInfo function to see in more
details what is going wrong, but I didn't find it. Then, I tried to
identify the problem by printing the Attributes field of the EFI_FILE
\loader\entries\entry+3-0.conf. I found that this field is set to 0 and it
correspond to nothing :
- #define EFI_FILE_READ_ONLY 0x01U
- #define EFI_FILE_HIDDEN 0x02U
- #define EFI_FILE_SYSTEM 0x04U
- #define EFI_FILE_RESERVED 0x08U
- #define EFI_FILE_DIRECTORY 0x10U
- #define EFI_FILE_ARCHIVE 0x20U
- #define EFI_FILE_VALID_ATTR 0x37U
I built the image with Yocto and here are the different partitions in the
image :
# u-boot partition
part --source uboot-part --ondisk mmcblk0 --fstype=vfat --label uboot
--active --align 1024 --fixed-size 32 --mbr
# esp partition
part --source esp-part --ondisk mmcblk0 --fstype=vfat --label esp --align
1024 --part-type C12A7328-F81F-11D2-BA4B-00A0C93EC93B
# recovery partition
part / --source rootfs --ondisk mmcblk0 --fstype=ext4 --label recovery
--align 1024
# create gpt layout with mbr
bootloader --ptable=gpt-hybrid
systemd-boot was started by u-boot using the bootefi command :
fatload mmc 0:2 ${loadaddr} EFI/BOOT/bootarm.efi ; bootefi ${loadaddr}
So, my question is why I get Access denied when I activate the systemd-boot
bootcounting ? Is it because the Attributes field of the file
entry+3-0.conf is set to 0 ? If yes, how can I set it correctly ?
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.freedesktop.org/archives/systemd-devel/attachments/20240621/fd1c004d/attachment.htm>
More information about the systemd-devel
mailing list