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 :)