From a79c01f92a8af993ac9f00c3e80a5f5aa172043d461a4ba759601e8f60995e51 Mon Sep 17 00:00:00 2001 From: Michael Chang Date: Tue, 8 Jun 2021 05:13:58 +0000 Subject: [PATCH] Accepting request 898233 from home:michael-chang:branches:Base:System - Fix running grub2-once leads to failure of starting systemd service in the boot sequence (bsc#1169460) * grub2-once * grub2-once.service OBS-URL: https://build.opensuse.org/request/show/898233 OBS-URL: https://build.opensuse.org/package/show/Base:System/grub2?expand=0&rev=385 --- grub2-once | 11 +++++++---- grub2-once.service | 3 ++- grub2.changes | 8 ++++++++ 3 files changed, 17 insertions(+), 5 deletions(-) diff --git a/grub2-once b/grub2-once index 112f7f9..679133f 100644 --- a/grub2-once +++ b/grub2-once @@ -177,11 +177,14 @@ sub parse_menuentry($$$) { # work and function properly on lvm, md and s390. sub enable_restore_grubenv_service { - my $systemctl="/usr/bin/systemctl"; + my $systemctl = "/usr/bin/systemctl"; + my $cleanup = "/var/tmp/grub2-cleanup-once"; - if (-x $systemctl) { - system "$systemctl --no-reload enable grub2-once >/dev/null 2>&1"; - } + open(my $fh, ">", $cleanup) or die "open: $cleanup $!\n"; + close($fh); + + return 0 if (system("$systemctl --quiet is-enabled grub2-once") == 0); + system "$systemctl --no-reload enable grub2-once >/dev/null 2>&1"; } $id_name = ""; diff --git a/grub2-once.service b/grub2-once.service index c5dc48b..422a99b 100644 --- a/grub2-once.service +++ b/grub2-once.service @@ -5,11 +5,12 @@ After=local-fs.target Before=sysinit.target shutdown.target Conflicts=shutdown.target ConditionPathIsReadWrite=/boot/grub2/grubenv +ConditionPathExists=/var/tmp/grub2-cleanup-once [Service] Type=oneshot ExecStart=-/usr/bin/grub2-editenv /boot/grub2/grubenv unset next_entry -ExecStartPost=-/usr/bin/systemctl disable grub2-once.service +ExecStartPost=-/usr/bin/rm -f /var/tmp/grub2-cleanup-once StandardOutput=journal [Install] diff --git a/grub2.changes b/grub2.changes index 63c067d..31012a0 100644 --- a/grub2.changes +++ b/grub2.changes @@ -1,3 +1,11 @@ +------------------------------------------------------------------- +Mon May 31 07:18:56 UTC 2021 - Michael Chang + +- Fix running grub2-once leads to failure of starting systemd service in the + boot sequence (bsc#1169460) + * grub2-once + * grub2-once.service + ------------------------------------------------------------------- Fri May 28 15:16:37 UTC 2021 - Michael Chang