k9s: k9s fails to start (arm64/M1) with `app run failed exit status 1`




Describe the bug k9s started to crash on start on my M1 Mac.

k9s
 ____  __.________
|    |/ _/   __   \______
|      < \____    /  ___/
|    |  \   /    /\___ \
|____|__ \ /____//____  >
        \/            \/

Boom!! app run failed exit status 1.

From the log file, I can see the following:

1:36PM ERR Boom! app run failed exit status 1
1:36PM ERR goroutine 1 [running]:
runtime/debug.Stack()
        runtime/debug/stack.go:24 +0x88
github.com/derailed/k9s/cmd.run.func2()
        github.com/derailed/k9s/cmd/root.go:69 +0xd8
panic({0x104914060, 0x140012203d0})
        runtime/panic.go:1038 +0x21c
github.com/derailed/k9s/cmd.run(0x106056a80, {0x1060b5be0, 0x0, 0x0})
        github.com/derailed/k9s/cmd/root.go:84 +0x4cc
github.com/spf13/cobra.(*Command).execute(0x106056a80, {0x1400019a1e0, 0x0, 0x0})
        github.com/spf13/cobra@v1.2.1/command.go:860 +0x640
github.com/spf13/cobra.(*Command).ExecuteC(0x106056a80)
        github.com/spf13/cobra@v1.2.1/command.go:974 +0x410
github.com/spf13/cobra.(*Command).Execute(...)
        github.com/spf13/cobra@v1.2.1/command.go:902
github.com/derailed/k9s/cmd.Execute()
        github.com/derailed/k9s/cmd/root.go:49 +0x30
main.main()
        github.com/derailed/k9s/main.go:29 +0x20

Interestingly, it starts fine if I use docker image (even though it’s of mismatching architecture):

docker run --rm -it -v ~/.kube/config:/root/.kube/config quay.io/derailed/k9s

Versions (please complete the following information):

  • OS: macOS 12.3.1 (21E258)
  • K9s: 0.25.18
  • K8s: v1.24.1

Additional context

This happens with the “clean” setup, when I have no kubernetes contexts apart from the one that Docker for Mac creates.

About this issue

  • Original URL
  • State: open
  • Created 2 years ago
  • Reactions: 2
  • Comments: 15 (1 by maintainers)

Most upvoted comments

Getting the same error here, nothing I have tried worked so far. Issue might be active still. Exactly same stack trace.

First and foremost I’m not entirely sure the goroutine crash/stack trace is the same issue as the mkdir permission denied one.

In any case, I was also experiencing FTL Unable to create dir "/var/folders/c5/w5z8r6y928x5twd6z3c997rc0000gn/T" mkdir /var/folders/c5: permission denied type error in the logs so I forked this and used a Go debugger to step through the code.

In my case, I migrated from an Intel Mac to an M1 Mac and restored a backup; because of this I had any old files that were persisted previously. While the user configuration YAML is stored at ~/Library/Preferences/k9s/config.yml, K9s also appears to persist configuration state at ~/Library/Application\ Support/k9s/config.yml.

grep '/var/folders' ~/Library/Application\ Support/k9s/config.yml found a screenDumpDir YAML key which points to a temporary directory path that no longer exists on my system and /var/folders is only writable by root so when k9s tries to create the directory path there, it fails given the permissions. Deleting this key from the config YAML fixed the problem and k9s launches as expected now. If I grep again I can confirm the screenDumpDir key has been added again but with a value for a path that actually exists now.

I can’t help but wonder if others with this issue also migrated files from an older system? @kblcuk Were you already on an M1 BEFORE you started seeing the crashing or did you migrate from an Intel system as well?

Cheers!

Upon checking the logs its have issue creating a directory

k9s info Collect logs path

cat /var/folders/xs/q_hxf7qj3xj_x225q931394c0000gp/T/k9s-manusharma.log
4:56PM INF 🐶 K9s starting up...
4:56PM FTL Unable to create dir "/var/folders/c5/w5z8r6y928x5twd6z3c997rc0000gn/T" mkdir /var/folders/c5: permission denied
10:23AM INF 🐶 K9s starting up...
10:23AM FTL Unable to create dir "/var/folders/c5/w5z8r6y

same issue for me. If I create the folder (sudo needed!) and assign proper r/w access for my user, k9s starts fine.

PS: The logs are also located in /var/folders/ but inside another directory. This seems to work fine…

Upon checking the logs its have issue creating a directory

k9s info Collect logs path

cat /var/folders/xs/q_hxf7qj3xj_x225q931394c0000gp/T/k9s-manusharma.log
4:56PM INF 🐶 K9s starting up...
4:56PM FTL Unable to create dir "/var/folders/c5/w5z8r6y928x5twd6z3c997rc0000gn/T" mkdir /var/folders/c5: permission denied
10:23AM INF 🐶 K9s starting up...
10:23AM FTL Unable to create dir "/var/folders/c5/w5z8r6y

yes, I’m running brew update regularly. So dependencies should be up to date. But it is still not working