Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Dealing with "provided value did not match any possible option" #2

Open
jat255 opened this issue Mar 14, 2024 · 8 comments
Open

Dealing with "provided value did not match any possible option" #2

jat255 opened this issue Mar 14, 2024 · 8 comments

Comments

@jat255
Copy link

jat255 commented Mar 14, 2024

Thanks for this tool. I'm trying to change my BIOS setting to restore power after external power is lost (it's a remote server, so it is difficult to go hook up a KB and monitor to do this).

The server is running an Asrock AB350 motherboard, and I can see a few relevant parameters in the output of uefisettings hii show-ifr:

        OpCode: Form
            OpCode: Subtitle - S: 
                OpCode: EqIdVal
                OpCode: OneOf - Q: Restore On AC Power Loss - Help: Restore Status On AC Power Loss
                -Range8(Range8 { min_value: 1, max_value: 2, step: 0 })
                -Answer: Unknown
                    OpCode: OneOfOption - S: Power On
                    -ValueType:0
                    -Value:NumSize8(1)
                    OpCode: OneOfOption - S: Power Off
                    -ValueType:0
                    -Value:NumSize8(2)
                OpCode: OneOf - Q: GPIO Devices Support - Help: Enable/Disable GPIO ACPI Devices Support, disable it will disable i2C and uart interface device.
                -Range8(Range8 { min_value: 1, max_value: 255, step: 0 })
                -Answer: Unknown
                    OpCode: OneOfOption - S: Enabled
                    -ValueType:0
                    -Value:NumSize8(1)
                    OpCode: OneOfOption - S: Auto
                    -ValueType:0
                    -Value:NumSize8(255)

Likewise, in the list-strings output, I see that "Restore On AC Power Loss" as well:

            469: "Restore On AC Power Loss",
            470: "Restore Status On AC Power Loss",

If I get that value, it gives the following output:

$ sudo uefisettings hii get "Restore On AC Power Loss"
GetResponseList {
    responses: [
        GetResponse {
            selector: "899407D7-99FE-43D8-9A21-79EC328CAC21",
            backend: Backend::Hii,
            question: Question {
                name: "Restore On AC Power Loss",
                answer: "Unknown",
                options: [],
                help: "Restore Status On AC Power Loss",
            },
            is_translated: false,
        },
    ],
}

But if I try to set the value to one of the options indicated by show-ifr, I get an error:

$ sudo uefisettings hii set "Restore On AC Power Loss" "Power On"
{"error_message":"provided value did not match any possible option"}

I assume this is because there are no options allowed in the Question output above. Is there any way to set this value on my motherboard, or is this just likely unsupported?

Thanks for your help.

This is on a Linux (TrueNAS scale) system:

$ uname -a
Linux truenas 6.1.55-production+truenas #2 SMP PREEMPT_DYNAMIC Tue Oct 31 16:07:08 UTC 2023 x86_64 GNU/Linux
@xaionaro
Copy link
Member

xaionaro commented Mar 14, 2024

Thanks for reporting this issue!

Could you run uefisettings hii extract-db /tmp/my-hii-db and share the resulting file?

Currently we used the HII interface to manipulate BIOS settings only on OCP servers (and it works well there). But my experiments with my personal laptop showed that the developer of the BIOS firmware haven't implemented the feature correctly/completely (and I was too lazy to write to tech support asking them to fix that), and this is why it doesn't work on my personal laptop.

However, your case looks more interesting because of this:

                -Answer: Unknown
                    OpCode: OneOfOption - S: Power On
                    -ValueType:0
                    -Value:NumSize8(1)
                    OpCode: OneOfOption - S: Power Off
                    -ValueType:0
                    -Value:NumSize8(2)

I'm curious if this is a problem on the uefisettings side. If it is we can make it work :)
But more likely something is just wrong on the BIOS side (similar to the case I had with my personal laptop). Most likely your BIOS does not export required EFI variables. If so it is fixable only by fixing the BIOS firmware (so it would require to contact tech support of Asrock to add the required variable; or you can use opensource BIOS firmware, but this is a whole another journey).


Also let me modify uefisettings to be more verbose. Give me 24h.

@xaionaro
Copy link
Member

xaionaro commented Mar 15, 2024

@jat255 : I've just added more verbosity to the code. Could you build uefisettings from the main branch and try again the hii get command?

@jat255
Copy link
Author

jat255 commented Mar 15, 2024

Thanks for the quick reply! I too was curious, since it looked like uefisettings was able to find the options "Power On" and "Power Off", but they didn't show with the hii get command.

I've rebuilt off the latest main, and I get the following, which now shows the values in the options:

$ sudo uefisettings hii get "Restore On AC Power Loss"
GetResponseList {
    responses: [
        GetResponse {
            selector: "899407D7-99FE-43D8-9A21-79EC328CAC21",
            backend: Backend::Hii,
            question: Question {
                name: "Restore On AC Power Loss",
                answer: "<VStoreError: failed to open sysfs efivars '/sys/firmware/efi/efivars/Setup-ec87d643-eba4-4bb5-a1e5-3f3e36b20da9' to get varstore bytes>",
                options: [
                    "Power On",
                    "Power Off",
                ],
                help: "Restore Status On AC Power Loss",
            },
            is_translated: false,
        },
    ],
}

If I try to set, the error is now:

$ sudo uefisettings hii set "Restore On AC Power Loss" "Power On" 
{"error_message":"Failed to open efivarfs file '/sys/firmware/efi/efivars/Setup-ec87d643-eba4-4bb5-a1e5-3f3e36b20da9' to get varstore bytes: No such file or directory (os error 2)"}

I've extracted the HII db, but before I share, is there a way I can review what information is contained within it, just to confirm there's no sensitive information?

@xaionaro
Copy link
Member

xaionaro commented Mar 15, 2024

From your reply it is pretty clear what's going on, and this is bad news:

It looks like the BIOS firmware haven't exported the EFI variables required to control these settings.
It seems like you either need to ask your motherboard vendor to fix the firmware, or to migrate to opensource firmware (which most likely will be a big time investment for you). Or if somebody could tell me how to find the variable storage without using these EFI vars, I can use that (but I'm not aware of any such method, unfortunately).

Also as the last hope you may look for other tools. For example, there is high probability that your firmware is written by AMI (American Megatrends Inc.), and if so, you may try a tool called SCELNX. It is a proprietary one, but it also worked fine on the OCP servers. However I think it uses the exactly same interface, so most likely it won't work anyway (due to the same reasons as uefisettings). If your BIOS is developed by somebody else, then try to look for a tool specific to that specific developer company.

A desperate attempt could be to update the BIOS firmware to the latest version. Most likely it won't help, but there is a slight chance that they already fixed this. Also you may take a look at the tools provided at the motherboard vendor website. But since this is a gaming motherboard it is unlikely that they provided a tool for your use case.

Sorry :(


P.S.: I realized I haven't explained what's going on. So this is what's going on: BIOS firmware exported HiiDB, which contains information about these variables, including the name of the variable, possible values, the name of the "storage" (where the variable value is stored) and the offset inside the storage to access the variable value. But they forgot to export the storage itself (so I cannot access the value of the variable, thus cannot see what's the current value or/and change it).


P.P.S.: Also JFYI my understanding is that:
Usually motherboard vendors do not develop firmwares by themselves and they hire other companies (like AMI) to do that for them. AMI, in turn, has already some hacked firmware from another project they did before, similar to what the motherboard vendor wants. So they do few fixes here and there, and oua-la. So even if you ask your vendor to fix it, they actually cannot do that by themselves, and they need to ask the sub-contractor to do that, which might be difficult, so they might just ignore your request (unless you are subscribed to some premium support or something). But won't hurt to try :)

@xaionaro
Copy link
Member

xaionaro commented Mar 15, 2024

I guess I need to update uefisettings to give link to this conversation when an EFI variable is not exported.

@TymanLS
Copy link

TymanLS commented Mar 22, 2024

Hello! I happened across this issue while looking for information on setting hidden UEFI/BIOS settings on my ASRock Z690M-ITX/ax motherboard from within the operating system, and I wanted to see if any of the information from my testing could be of assistance. My system is configured with two drives; one has Ubuntu 22.04 and one has Windows 11.

Here are my system specifications, if it helps at all:

  • CPU: Intel i5-14500
  • Motherboard: ASRock Z690M-ITX/ax
  • RAM: Patriot Viper 4 Blackout Series 2x32GB DDR4-3600 CL18 (running at DDR4-3400)
  • PSU: Silverstone FX350-G 350W Flex ATX

Initially on the Ubuntu installation, I got similar results to @jat255 when using uefisettings. The uefisettings hii get command shows the specified question, but the options array is empty; running uefisettings hii list-questions seems to show that all questions have empty options arrays. However, when I set a supervisor password in the UEFI/BIOS, then uefisettings was unable to get any questions at all.

I then switched to the Windows 11 installation and attempted to use the SCEWIN proprietary utility by AMI, version 5.05. I used this Reddit post as a reference, since my goal was also to enable power-saving options on my motherboard. Using that guide, SCEWIN appeared to have no problem listing all the UEFI/BIOS settings and showing the correct options for each setting, and it appeared to have even been able to successfully enable the "Low Power S0 Idle Capability" option using the same commands. The "Low Power S0 Idle Capability" option is not available in the UEFI/BIOS menu, so I could not verify the status of that option from there, but SCEWIN showed it as enabled afterward. Interestingly enough, this guide states that a supervisor password must be set in the UEFI/BIOS for SCEWIN to work properly.

I'm rather unfamiliar with exactly how firmware works and I'm not sure if using a different OS would cause different EFI variables to be exported, but this suggests to me that the motherboard is publishing the proper EFI variables and HiiDB to allow the SCEWIN tool to change UEFI/BIOS settings within Windows. However, I'm wondering if the firmware was written in such a way that it only exports the proper EFI variables if a UEFI/BIOS supervisor password is set; that may explain why the Reddit guide said the password must be set for SCEWIN to work. However, it appears that setting that password also protects the information in such a way that prevents uefisettings from reading them; that could explain why I was able to see the full list of questions when I had no password set, but did not see any questions when I set the UEFI/BIOS password.

I would like to test if uefisettings can read the proper EFI variables and HiiDB with a UEFI/BIOS password set, but that would require the ability to supply that password to uefisettings, whether through a command-line argument, environment variable, or some other method. However, the documentation so far does not seem to suggest a way to do this. Could specifying a UEFI/BIOS password be implemented in uefisettings, or is it perhaps already implemented and not documented (like the list-settings subcommand)?

I hope this information was helpful, and please let me know if there is a way to specify UEFI/BIOS passwords in uefisettings. Thank you!

@xaionaro
Copy link
Member

xaionaro commented Mar 22, 2024

@TymanLS : Thank you for this report; this is really insightful!

I'm curious would it be difficult to also try SCELNX in Linux? If SCELNX works just fine then I'll try to obtain some of these motherboards and investigate, when I'll have free time.

Could specifying a UEFI/BIOS password be implemented in uefisettings, or is it perhaps already implemented and not documented (like the list-settings subcommand)?

It is not implemented, yet. I even didn't know there is such a feature in this interface. But if SCELNX works fine in Linux then I think I can make uefisettings also work.

@TymanLS
Copy link

TymanLS commented Mar 23, 2024

I would love to, but unfortunately I have not been able to find a copy of the SCELNX binary that works on my system. I have found some AMISCE packages on the internet, which bundle both SCEWIN and SCELNX, but when using those bundles, both of the tools give the following error:

This tool is not supported on this system.
49 - Error: A platform condition has prevented executing

The only version of SCEWIN that worked for me was the one at this repo, which extracts it from MSI Center. However, this does not provide the SCELNX equivalent. If there is some place I'd be able to get a working Aptio V version of SCELNX for my system I'd be more than happy to try it out, but unfortunately as of now I'm afraid I don't have the ability to provide further information... Please let me know if there is anything else I can do to help though!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants