Cannot write to EFI variables which have a ':' in their name, such as 'prev-lang:kbd':
$ echo -n 'de:3\0' | sudo efivar -w -n '7C436110-AB2A-4BBB-A880-FE41995C9F82-prev-lang:kbd'
efivar: Invalid guid 7C436110-AB2A-4BBB-A880-FE41995C9F82-prev
'7C436110-AB2A-4BBB-A880-FE41995C9F82-prev-lang:kbd' is a variable used by Apple to store the selected language and keyboard layout as an EFI variable.
Looking at the error message and breakdown_name() in usr.sbin/efivar/efivar.c, this rather looks like "efivar cannot write to EFI variables which have a '-' in their name". If you look at the code linked below, the issue is quite obvious -- we use strrchr() to find the end of GUID, and in this case it's not correct:
This needs a better way of distinguishing between GUID and var name.
Created attachment 219556 [details]
possible fix using regex to match guid part
Possible fix using regex to match guid part. Doing comp/free every time breakdown_name() is called should not be too expensive.
OR, we could do a cp = name + 36 (guid len) and be done with it as it looks like guid is checked somewhere else anyway :)
Is there a way to compile the patched version without needing to download and/or compile the entire FreeBSD source?
(In reply to probono from comment #5)
usr.sbin/efivar has a Makefile  so one should be able to make install in that directory after patching to install just that component.
The proposed patch isn't quite right. You can specify names as well as UUIDs and there's a table lookup for those names.
has my proposed alternate fix that doesn't break the name lookup.
Thank you very much, highly appreciated.