From ab212730bd17d6156edec350f3ff61aa0c7f9561 Mon Sep 17 00:00:00 2001 From: "A. Wilcox" Date: Sat, 21 Oct 2023 22:12:09 -0500 Subject: hscript: bootloader: Set rdwr on 'real' efivarfs We have to clear the RDONLY flag on the base /sys before we clear it from the target /sys, otherwise it doesn't work. Fixes: 975b506cdd ("hscript: bootloader: Really, truly revamp EFI") --- CHANGELOG.rst | 2 ++ hscript/meta.cc | 9 +++++++-- 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.rst b/CHANGELOG.rst index d6ebfc8..75649f8 100644 --- a/CHANGELOG.rst +++ b/CHANGELOG.rst @@ -81,6 +81,8 @@ Metadata of copies of the key on local disk. This allows you to use System Installation from non-Adélie Linux systems. +* EFI installation has been made more reliable. + Qt UI ----- diff --git a/hscript/meta.cc b/hscript/meta.cc index 9ba1b40..c4a4070 100644 --- a/hscript/meta.cc +++ b/hscript/meta.cc @@ -868,6 +868,10 @@ bool Bootloader::execute() const { if(errno == EBUSY) { struct mount_attr attr = {}; attr.attr_clr = MS_RDONLY; + /* set rdwr on parent mount first + * if this fails we can still try the target mount */ + syscall(SYS_mount_setattr, -1, "/sys/firmware/efi/efivars", + 0, &attr, sizeof(attr)); if(syscall(SYS_mount_setattr, -1, efipath.c_str(), 0, &attr, sizeof(attr)) != 0) { output_error(pos, "bootloader: failed to make NVRAM read/write", @@ -875,9 +879,10 @@ bool Bootloader::execute() const { } else { efivarfs = true; } + } else { + output_error(pos, "bootloader: failed to mount efivarfs", + ::strerror(errno)); } - output_error(pos, "bootloader: failed to mount efivarfs", - ::strerror(errno)); } else { efivarfs = true; umount = true; /* We mounted it ourselves. */ -- cgit v1.2.3-60-g2f50