Bug#988450: bootctl systemd-efi-options doesn't work

2021-07-07 Thread Michael Biebl
Control: forwarded -1 https://github.com/systemd/systemd/issues/19597
Control: fixed -1 249~rc1-1

Hi Thomas

On Thu, 13 May 2021 10:46:04 + =?utf-8?q?Thomas_M=C3=BChlbacher?=
 wrote:
> I will file it upstream. Thanks for helping!

Thanks for that. Marking accordingly.

It appears this has been fixed in by
https://github.com/systemd/systemd/pull/19896 which is part of 249~rc1-1
Marking as fixed for that version.

Regards,
Michael


signature.asc
Description: This is a digitally signed message part


Bug#988450: bootctl systemd-efi-options doesn't work

2021-05-13 Thread Michael Biebl

Am 13.05.21 um 12:46 schrieb Thomas Mühlbacher:

Hi,

yes, I am using GRUB with Secure Boot enabled. SB does apparently make
it so the variable does not get cached.

So imo, the problem is that the command only even tries to read the
variable from the cache and not from `/sys`.

I will file it upstream. Thanks for helping!


looking a bit more into it, I *guess* systemd-efi-options is only set / 
cached during boot if you actually use sd-boot and it only shows the 
currently active boot options.
So I'm not actually sure anymore, if this is really a bug or working as 
expected. If the latter, the man page could be clarified in that regard. 
So it seems worthwile filing a bug report in any case.




Bug#988450: bootctl systemd-efi-options doesn't work

2021-05-13 Thread Thomas Mühlbacher
Hi,

yes, I am using GRUB with Secure Boot enabled. SB does apparently make
it so the variable does not get cached.

So imo, the problem is that the command only even tries to read the
variable from the cache and not from `/sys`.

I will file it upstream. Thanks for helping!

-- 
Regards,
Thomas Mühlbacher



Bug#988450: bootctl systemd-efi-options doesn't work

2021-05-13 Thread Michael Biebl

Control: tags -1 + moreinfo

Am 13.05.21 um 11:03 schrieb Thomas Mühlbacher:


```shell
# bootctl systemd-efi-options
Failed to query SystemdOptions EFI variable: No data available
# bootctl systemd-efi-options 'debug'
# bootctl systemd-efi-options
Failed to query SystemdOptions EFI variable: No data available
$ hd 
/sys/firmware/efi/efivars/SystemdOptions-8cf2644b-4b0b-428f-9387-6d876050dc67
  07 00 00 00 64 00 65 00  62 00 75 00 67 00 00 00  |d.e.b.u.g...|
0010
```


So writing the efi variable to efivars succeeds, but bootctl does not 
create a corresponding cache entry in /run/systemd/efivars. When it 
reads the data, it only tries to read the cached entry and fails, as 
there is none. Did I get that correctly?


Sounds like a valid bug to me and I'd suggest you file this upstream.

Regards,
Michael



Bug#988450: bootctl systemd-efi-options doesn't work

2021-05-13 Thread Michael Biebl

Am 13.05.2021 um 11:24 schrieb Michael Biebl:

Am 13.05.2021 um 11:03 schrieb Thomas Mühlbacher:

Package: systemd
Version: 247.3-5

The `systemd-efi-options` subcommand of `bootctl` fails to read the EFI
variable. Even after setting one, which does works. This variable then
also actually works when booting, for example the `debug` option is then
used by systemd. I am on an AMD Thinkpad E495, however I was also able
to reproduce this on an Intel system with a BIOS from a different
vendor.


Have you booted your system using "systemd-boot" or are you using 
something like grub?


And are you using SecureBoot?

Fwiw, I'm not really familiar with systemd-boot (as I don't use it myself).
My recommendation would be, that you file this issue upstream at
https://github.com/systemd/systemd

I'd probably include a debug log when executing those bootctl commands.
You can set the log level via systemd-analyze or via the 
SYSTEMD_LOG_LEVEL= env var.


Michael



Bug#988450: bootctl systemd-efi-options doesn't work

2021-05-13 Thread Michael Biebl

Am 13.05.2021 um 11:03 schrieb Thomas Mühlbacher:

Package: systemd
Version: 247.3-5

The `systemd-efi-options` subcommand of `bootctl` fails to read the EFI
variable. Even after setting one, which does works. This variable then
also actually works when booting, for example the `debug` option is then
used by systemd. I am on an AMD Thinkpad E495, however I was also able
to reproduce this on an Intel system with a BIOS from a different
vendor.


Have you booted your system using "systemd-boot" or are you using 
something like grub?




Bug#988450: bootctl systemd-efi-options doesn't work

2021-05-13 Thread Thomas Mühlbacher
Package: systemd
Version: 247.3-5

The `systemd-efi-options` subcommand of `bootctl` fails to read the EFI
variable. Even after setting one, which does works. This variable then
also actually works when booting, for example the `debug` option is then
used by systemd. I am on an AMD Thinkpad E495, however I was also able
to reproduce this on an Intel system with a BIOS from a different
vendor.

```shell
# bootctl systemd-efi-options
Failed to query SystemdOptions EFI variable: No data available
# bootctl systemd-efi-options 'debug'
# bootctl systemd-efi-options
Failed to query SystemdOptions EFI variable: No data available
$ hd 
/sys/firmware/efi/efivars/SystemdOptions-8cf2644b-4b0b-428f-9387-6d876050dc67
  07 00 00 00 64 00 65 00  62 00 75 00 67 00 00 00  |d.e.b.u.g...|
0010
```

When using this subcommand to read the variable, from what I can tell,
this function is called:

https://salsa.debian.org/systemd-team/systemd/-/blob/debian/247.3-5/src/basic/efivars.c#L398

Looking at the code a little, it appears that it only tries to read the
EFI variable from `/run/systemd/efivars/`, which appears to be a cache
dir for EFI vars to avoid the overhead of reading from
`/sys/firmware/efi/efivars/`. However this directory does not exist on
my system, even after running the command to set the `SystemdOptions`
var.

-- 
Cheers,
Thomas Mühlbacher