> Date: Mon, 24 Feb 2025 16:05:48 +0100
> From: Hrvoje Popovski <[email protected]>
> 
> On 24.2.2025. 14:48, Mark Kettenis wrote:
> >> Date: Mon, 24 Feb 2025 10:07:51 +0100
> >> From: Hrvoje Popovski <[email protected]>
> > Hi Hrvoje,
> > 
> >> Hi all,
> >>
> >> today I've sysupgrade my box and sysupgrade won't finish. It stops after
> >>
> >>
> >> Location of sets? (cd0 disk http nfs or 'done') [done] done
> >> Making all device nodes... done
> >> installboot: EFIIOC_VAR_SET: Boot000A: Invalid argument
> > Interesting.  That is not expected.  Can you install the efivar
> > package on that machine and send me the output of
> > 
> >   # efivar -l
> > 
> > for that machine?

Hrvoje, Landry, can you try the diff below?

After building and installing installboot try doing the following:

Add the following line to /etc/sysctl.conf:

  kern.securelevel=-1

And reboot the machine.  AFter the reboot run

  # installboot -cv sdX

where sdX is the boot driver of the machine (i.e. sd0).

Please show me the output of that command.

Thanks,

Mark


Index: usr.sbin/installboot/efi_bootmgr.c
===================================================================
RCS file: /cvs/src/usr.sbin/installboot/efi_bootmgr.c,v
diff -u -p -r1.2 efi_bootmgr.c
--- usr.sbin/installboot/efi_bootmgr.c  21 Feb 2025 20:41:50 -0000      1.2
+++ usr.sbin/installboot/efi_bootmgr.c  27 Feb 2025 20:27:45 -0000
@@ -77,6 +77,14 @@ typedef struct _FILEPATH_DEVICE_PATH {
 } __packed FILEPATH_DEVICE_PATH;
 
 /*
+ * Variable Attributes
+ */
+
+#define EFI_VARIABLE_NON_VOLATILE      0x00000001
+#define EFI_VARIABLE_BOOTSERVICE_ACCESS 0x00000002
+#define EFI_VARIABLE_RUNTIME_ACCESS    0x00000004
+
+/*
  * Load Options
  */
 
@@ -172,7 +180,7 @@ write_efi_load_option(EFI_LOAD_OPTION *o
                var.datasize = 0;
                error = ioctl(fd, EFIIOC_VAR_NEXT, &var);
                if (error) {
-                       if (errno == ENOENT)
+                       if (errno == ENOENT || errno == ENOSYS)
                                break;
                        err(1, "EFIIOC_VAR_NEXT");
                }
@@ -248,6 +256,9 @@ write_efi_load_option(EFI_LOAD_OPTION *o
                        var.namesize = 18;
                        var.data = opt;
                        var.datasize = optlen;
+                       var.attrib = EFI_VARIABLE_NON_VOLATILE |
+                           EFI_VARIABLE_BOOTSERVICE_ACCESS |
+                           EFI_VARIABLE_RUNTIME_ACCESS;
                        error = ioctl(fd, EFIIOC_VAR_SET, &var);
                        if (error) {
                                if (errno == EPERM || errno == ENOSYS)
@@ -297,6 +308,9 @@ write_efi_load_option(EFI_LOAD_OPTION *o
        }
 
        if (!nowrite) {
+               var.attrib = EFI_VARIABLE_NON_VOLATILE |
+                   EFI_VARIABLE_BOOTSERVICE_ACCESS |
+                   EFI_VARIABLE_RUNTIME_ACCESS;
                error = ioctl(fd, EFIIOC_VAR_SET, &var);
                if (error) {
                        if (errno == EPERM || errno == ENOSYS)

Reply via email to