From 6c677ec9d349e6f606e0de515a749f344586550e Mon Sep 17 00:00:00 2001 From: AtomicFS Date: Mon, 2 Dec 2024 20:14:01 +0100 Subject: [PATCH] chore(action): on dagger error check of kernel module - this specific problem can be difficult to diagnose - add check for missing kernel module - into general error add link to dagger troubleshooting guide Signed-off-by: AtomicFS --- .cspell.json | 1 + action/container/container.go | 26 +++++++++++++++++++++----- 2 files changed, 22 insertions(+), 5 deletions(-) diff --git a/.cspell.json b/.cspell.json index da665cc0..d5cb1377 100644 --- a/.cspell.json +++ b/.cspell.json @@ -94,6 +94,7 @@ "iasl", "ifdtool", "inargs", + "iptable", "iucode", "kbuild", "kconfig", diff --git a/action/container/container.go b/action/container/container.go index 9af8acbb..6f29d261 100644 --- a/action/container/container.go +++ b/action/container/container.go @@ -10,6 +10,8 @@ import ( "log/slog" "os" "path/filepath" + "regexp" + "runtime" "strings" "dagger.io/dagger" @@ -189,12 +191,26 @@ func Setup(ctx context.Context, client *dagger.Client, opts *SetupOpts, dockerfi slog.String("suggestion", "try this: https://archive.docs.dagger.io/0.9/235290/troubleshooting/#dagger-pipeline-is-unable-to-resolve-host-names-after-network-configuration-changes"), slog.Any("error", err), ) - } else { - slog.Error( - message, - slog.Any("error", err), - ) } + if strings.Contains(err.Error(), "timed out waiting for session params") && runtime.GOOS == "linux" { + // On Linux, check if 'iptable_nat' kernel module is loaded + content, err := os.ReadFile("/proc/modules") + if err != nil { + pattern := regexp.MustCompile(`^iptable_nat`) + if pattern.FindString(string(content)) == "" { + slog.Error( + message, + slog.String("suggestion", "dagger requires the 'iptable_nat' Linux kernel module in order to function properly, https://docs.dagger.io/troubleshooting#dagger-restarts-with-a-cni-setup-error"), + slog.Any("error", err), + ) + } + } + } + slog.Error( + message, + slog.String("suggestion", "something is wrong with dagger, please check dagger troubleshooting guide at: https://docs.dagger.io/troubleshooting"), + slog.Any("error", err), + ) } return container, err