summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorA. Wilcox <AWilcox@Wilcox-Tech.com>2023-10-21 22:12:09 -0500
committerA. Wilcox <AWilcox@Wilcox-Tech.com>2023-10-21 22:12:09 -0500
commitab212730bd17d6156edec350f3ff61aa0c7f9561 (patch)
tree35224eeb1ad83777ad4d4af967069d1591272cb9
parent975b506cdd645edb75312a1e8ead9346e69b3ecf (diff)
downloadhorizon-ab212730bd17d6156edec350f3ff61aa0c7f9561.tar.gz
horizon-ab212730bd17d6156edec350f3ff61aa0c7f9561.tar.bz2
horizon-ab212730bd17d6156edec350f3ff61aa0c7f9561.tar.xz
horizon-ab212730bd17d6156edec350f3ff61aa0c7f9561.zip
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")
-rw-r--r--CHANGELOG.rst2
-rw-r--r--hscript/meta.cc9
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. */