Blame SOURCES/0131-Fix-systemctl-kexec-exit-status-check.patch

5593c8
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
5593c8
From: Javier Martinez Canillas <javierm@redhat.com>
5593c8
Date: Tue, 9 Apr 2019 12:30:38 +0200
5593c8
Subject: [PATCH] Fix systemctl kexec exit status check
5593c8
5593c8
There's always an error printed even when the systemctl kexec command does
5593c8
succeed. That's because systemctl executes it asynchronously, but the emu
5593c8
loader seems to expect it to be synchronous and that should never return.
5593c8
5593c8
Also, it's wrong to test if kexecute == 1 since we already know that's the
5593c8
case or otherwise the function wouldn't had called grub_fatal() earlier.
5593c8
5593c8
Finally, systemctl kexec failing shouldn't be a fatal error since the emu
5593c8
loader fallbacks to executing the kexec command in case of a failure.
5593c8
5593c8
Signed-off-by: Javier Martinez Canillas <javierm@redhat.com>
5593c8
---
5593c8
 grub-core/loader/emu/linux.c | 6 ++++--
5593c8
 1 file changed, 4 insertions(+), 2 deletions(-)
5593c8
5593c8
diff --git a/grub-core/loader/emu/linux.c b/grub-core/loader/emu/linux.c
5593c8
index fda9e00d24c..5b85b225eed 100644
5593c8
--- a/grub-core/loader/emu/linux.c
5593c8
+++ b/grub-core/loader/emu/linux.c
5593c8
@@ -71,8 +71,10 @@ grub_linux_boot (void)
5593c8
 		(kexecute==1) ? "do-or-die" : "just-in-case");
5593c8
   rc = grub_util_exec (systemctl);
5593c8
 
5593c8
-  if (kexecute == 1)
5593c8
-    grub_fatal (N_("Error trying to perform 'systemctl kexec'"));
5593c8
+  if (rc == GRUB_ERR_NONE)
5593c8
+    return rc;
5593c8
+
5593c8
+  grub_error (rc, N_("Error trying to perform 'systemctl kexec'"));
5593c8
 
5593c8
   /* need to check read-only root before resetting hard!? */
5593c8
   grub_printf("Performing 'kexec -e'");