From 4c4801cde3d38bd4198f63fa2bda69bf49bb147b Mon Sep 17 00:00:00 2001 From: Itxaka Date: Tue, 11 Jun 2024 16:51:33 +0200 Subject: [PATCH] Exit properly if we cannot unlock partitions (#334) --- pkg/state/steps_uki.go | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/pkg/state/steps_uki.go b/pkg/state/steps_uki.go index 2a44ba6..7467f4e 100644 --- a/pkg/state/steps_uki.go +++ b/pkg/state/steps_uki.go @@ -394,7 +394,15 @@ func (s *State) UKIUnlock(g *herd.Graph, opts ...herd.OpOption) error { } _ = os.Setenv("PATH", "/usr/bin:/usr/sbin:/bin:/sbin") internalUtils.Log.Debug().Msg("Will now try to unlock partitions") - return kcrypt.UnlockAllWithLogger(true, internalUtils.Log) + err := kcrypt.UnlockAllWithLogger(true, internalUtils.Log) + if err != nil { + internalUtils.Log.Info().Msg(s.WriteDAG(g)) + internalUtils.Log.Err(err).Msg("Unlocking partitions") + internalUtils.Log.Warn().Msg("Unlocking partitions failed, waiting 10 seconds and rebooting") + time.Sleep(10 * time.Second) + return syscall.Reboot(syscall.LINUX_REBOOT_CMD_RESTART) + } + return nil }))...) }