K3s Launch Error

Hi! I recently built a custom version of Torizon with yocto. Now, I’m trying to get K3s to work following this guide link. However, when I run the command systemctl status k3s it only says it’s activating and never changes:

Active: activating (start) since Sat 2024-05-18 17:36:35 UTC; 13s ago

So, I tried running sudo k3s server. The program arrives here:

INFO[0030] Node token is available at /var/lib/rancher/k3s/server/token
INFO[0030] To join node to cluster: k3s agent -s https://IP:6443 -t ${NODE_TOKEN}

And then it throws this error:

panic: runtime error: invalid memory address or nil pointer dereference
[signal SIGSEGV: segmentation violation code=0x1 addr=0x8 pc=0x55f002162c66]

The last line from the debugger indicates that the error is in line 72 of a file named main.go:

/home/USER/yocto/oe-core/build/tmp/work/core2-64-tdx-linux/k3s/v1.22.6+k3s1+git4262c6b91a43ef8411870f72ff8b8715949f90e2-r0/k3s-v1.22.6+k3s1+git4262c6b91a43ef8411870f72ff8b8715949f90e2/src/import/cmd/server/main.go:72 +0xcbe

Have you tried adding K3s to Torizon?

Hi, I’m the Toradex AI Assistant. I’m in early beta, and I would appreciate your feedback.
The Toradex Support team will follow up with you shortly!

Did you like my answer?

:+1: :-1:


Integrating K3s into a custom Torizon build with Yocto presents a unique set of challenges, particularly when encountering issues like the one you’ve described. The error message you’re seeing, specifically the segmentation violation, suggests there’s a problem in the K3s binary or a related component that’s not handling memory correctly. This could be due to a variety of reasons, such as compatibility issues with the underlying hardware, misconfigurations in the build process, or even bugs within the specific version of K3s you’re using.

Given the complexity of the error and the custom nature of your build, here are a few steps you can take to troubleshoot and potentially resolve the issue:

  1. Verify Compatibility: Ensure that the version of K3s you’re trying to integrate is compatible with the version of Torizon and the hardware you’re using. Sometimes, newer versions of K3s might introduce changes that are not fully compatible with your current setup.

  2. Review Yocto Configuration: Double-check your Yocto recipes and configurations to ensure that all dependencies required by K3s are correctly included and configured. Missing or incorrectly configured dependencies could lead to runtime errors.

  3. Debugging: Utilize the debugging tools available in your development environment to trace the execution of the K3s server command. This might provide more insight into what exactly is causing the segmentation fault. Pay close attention to the initialization steps before the crash occurs.

  4. Check Logs and System Resources: Examine system logs for any messages that might indicate what’s going wrong. Also, ensure that your system has sufficient memory and CPU resources available, as resource constraints could potentially lead to issues during the K3s server startup.

  5. K3s Version: Consider testing with a different version of K3s, if possible. It’s not uncommon for certain releases to have bugs that could cause the issues you’re experiencing. Switching to a stable or different version might help circumvent the problem.

  6. Community and Support Channels: While direct support channels are not recommended here, engaging with communities and forums focused on Yocto, K3s, and Torizon can be invaluable. Other developers might have encountered similar issues and could offer insights or solutions.

  7. Isolation of the Issue: Try to isolate the issue by running K3s on a minimal setup or even on a different machine if possible. This can help determine if the issue is specific to your current environment or a more general problem with the

Please, also check if these links can help you solve your problem:

AI at the Edge, Pasta Detection Demo with AWS | Toradex Developer Center.

Hello @vick,

Which hardware are you targeting with your custom build?
Is it Toradex hardware or are you using Common Torizon?

This error shows core2-64-tdx-linux, is a custom machine being used as well?
If yes, which machine is it based on?

Best Regards,

Hi Bruno,

I tried installing K3s on Torizon for an Apalis iMX8, but I couldn’t get it to launch. So I tried generating an x86_64 image and when I run it I get the error above.



Hello @vick,

What is the problem which you encountered with the Apalis iMX8 image?

We can try to help you with your customization of Torizon or when using Toradex Hardware, but, if you are using other platforms or other operating systems not provided by Toradex, there is not a lot we can do.

Best Regards,