fireindark707
I’m currently working on a project with Nerves(Nerves Livebook) on a Raspberry Pi Zero, and I’ve encountered a recurring issue where the device spontaneously shuts down. To better understand what’s happening behind the scenes and potentially pinpoint the cause, I’m looking to dive into the system-level logs.
Could anyone guide me on how to access these logs within the Nerves environment? Specifically, I’m interested in any logs that could shed light on system events or errors that might precede these unexpected shutdowns.
Trending in Questions
I’m working on a project that simulates the bumbl example in the programming phoenix book. It acts almost like an email client. We have a...
New
Hello!
Could someone please give me a help/sample code, how to delete a file from s3 using waffle/waffle_ecto from Phoenix app.
I creat...
New
I’m seeing that a list inside a Kino.DataTable will be interpreted as a charlist, even if the Kino.configure() is set to charlists: :as_l...
New
So my question is quite simple and i have found no conclusive answer on forum, google or AI.
Should we use :erlang.float for Integer to ...
New
Hi, I’ve just set up an application with ash_authentication. There is only magic link strategy for now, so there is no confirmation add o...
New
If a change or preparation module uses Ash.Changeset.get_argument/2 or Ash.Query.get_argument/2 (or any of the other get_argument functio...
New
Hello,
I know there is an approach for handling lists that allows for optimized traversal, but I can’t recall the specific method (somet...
New
Other Trending Topics
I am happy to introduce the very α version of the new programming language compiled to BEAM.
Welcome Cure.
It has literally three kille...
New
Hi there! We created Gust: A task orchestrator inspired by Airflow.
For those who have never heard about Aiflow, it’s a Python-based wor...
New
Beam Bots (or just BB for short) is a framework for building fault-tolerant robotics applications in Elixir using familiar OTP patterns. ...
New
Xamal is a deployment tool for Elixir apps that deploys native releases to bare metal servers over SSH. It’s a port of GitHub - basecamp/...
New
Hello everyone. After busy few months I am happy to announce v0.1.0 of Emerge & Solve.
They are GUI (Emerge) and State management (S...
New
Corex is an accessible, unstyled UI component library for Phoenix that integrates Zag.js state machines using Vanilla JavaScript and Live...
New
Categories:
Sub Categories:
Forums
Popular Tags
- #ecto
- #liveview
- #troubleshooting
- #learning-elixir
- #library
- #deployment
- #erlang
- #testing
- #genserver
- #mix
- #absinthe
- #remote-other
- #otp
- #plug
- #how-to-question
- #macros
- #postgres
- #elixirconf
- #channels
- #exunit
- #discussion
- #code-sync
- #podcasts
- #javascript
- #onsite
- #dialyzer
- #docker
- #authentication
- #umbrella
- #full-time-contract
- #podcasts-by-brainlid
- #ecto-query
- #ai
- #elixirconf-us
- #blog-post
- #elixir-ls
- #phoenix_html
- #iex
- #graphql
- #genstage
- #websockets
- #supervisor
- #advent-of-code
- #distillery
- #processes
- #api
- #forms
- #hex
- #security
- #metaprogramming











Showing Posts 1 to 4- Show Best Posts
- Show All (oldest first)
- Show All (newest first)
fhunleth
Debugging spontaneous shutdowns can be hard since the key log message might not be logged.
There are a few options:
RingLogger, turn on persistence. RingLogger will write logs every so many minutes and then on graceful shutdown. Not sure if this will help given what you posted, but seems worth a try. In your config, do something like this:Use
RamoopsLogger. This backend logs to a special area of DRAM that survives reboots sometimes. Add the dependency and addRamoopsLoggerto your:logger:backendsin theconfig.exs.Enable the
:consolelogger, connect to the UART, watch messages and hope.Enable an Elixir or Erlang file logger like you would for a non-Nerves project. Configure it to log to a file in
/data. There might be asyncoption to force writes more frequently. I don’t personally use this option, but I know people coming from non-embedded backgrounds sometimes are really comfortable with this one.On Nerves, log messages from the Linux kernel and from C programs using syslog are all routed through the Elixir logger. Hopefully these aren’t your issue.
Some of the hardest bugs, imho, to debug are the ones that kill
heart. If this is your issue, then try runningNerves.Runtime.Heart.statusto see ifwdt_time_leftorheartbeat_time_leftcount down to0. When they hit0,heartthinks that something is really wrong with the BEAM or something else on the device and triggers a reboot.Hope this helps.
fireindark707
Hello @fhunleth, Thanks for your responses. I think they are really important. I have tried RingLogger but until now no error has been logged. I’m thinking the problem lies in the heart, here is my heart status after running pi zero for 24 hours:
%{
program_version: %Version{major: 2, minor: 3, patch: 0},
wdt_timeout: 15,
wdt_time_left: 11,
wdt_pre_timeout: 0,
wdt_pet_time_left: 3,
wdt_options: [:settimeout, :magicclose, :keepaliveping],
wdt_last_boot: :power_on,
wdt_identity: “Broadcom BCM2835 Watchdog timer”,
wdt_firmware_version: 0,
snooze_time_left: 0,
program_name: “nerves_heart”,
init_handshake_timeout: 0,
init_handshake_time_left: 0,
init_handshake_happened: true,
init_grace_time_left: 0,
heartbeat_timeout: 30,
heartbeat_time_left: 26
}
The wdt_pet_time_left becomes very small. I think it will trigger a reboot but dont know how to extend the timeout limit or fix this problem. Could you give me more hints? I have checked GitHub - nerves-project/nerves_heart: Erlang heartbeat support for Nerves · GitHub
fhunleth
I think the first thing to try is to just disable
heartaltogether. To do this, edit your project’srel/vm.args.eexand comment out the-heartline:I really hope that gives you time to look at log, inspect your device or do whatever to see why Erlang isn’t telling
heartthat it’s ok, and therefore not petting the hardware watchdog.As for changing the hardware watchdog timer, it’s already set to the longest time. If you trace through bcm2835_wdt.c, the max time looks like it’s just under 16 seconds and that due to truncation, it shows up as 15 seconds when asked.
Best bet is to comment out
heartlike above. I don’t know how 30 seconds could be too short on thehearttimeout, but you could also update that.Hope you find the issue.
fireindark707
Thanks @fhunleth , I have figured out the problem. It relates to a problem of Kino. I have report the issue:
https://github.com/livebook-dev/kino/issues/416