bootctl: return recognizable Varlink error when we cannot determine the boot entry token

When running "bootctl install" on an empty --root= dir, we don't know
which token to use, and the operation will fail. Make sure to return an
explicit error about this.

This introduces a recognizable low-level error for this (EUNATCH), and
then turns this into a recognizable Varlink error.

(I made sure that the old low-level error EINVAL wasn't load-bearing,
and it is safe to change this.)
This commit is contained in:
Lennart Poettering
2026-02-06 23:16:50 +01:00
parent 91b3620b07
commit 9b29d38c33
3 changed files with 15 additions and 6 deletions
+2
View File
@@ -2087,6 +2087,8 @@ int vl_method_install(
return r;
r = run_install(&p.context);
if (r == -EUNATCH) /* no boot entry token is set */
return sd_varlink_error(link, "io.systemd.BootControl.BootEntryTokenUnavailable", NULL);
if (r < 0)
return r;