Interrogate Persistant Logs from an SD Card After Disconnect

One of my devices is unable to connect to the balena platform and the general outernet even though the router reports that it is connected to the network (and the network is connected to the internet, as evidenced by other devices). This specific device continues to have this issue regardless of being unplugged and plugged back in. The light patterns on the device and wifi connections (as reported by router) seem to imply that all of the services are running.

This device has persistent logging turned on so I want to few those logs. When I take the SD Card out of the device and plug it into my Mac, I see a bunch of files including the config.json.
The disc space used by these devices adds up to around 8MB when my image is about 5GB. I am a bit confused at this point. Is this the cause of the issue?

How can I view the persistent logs on the device as plaintext?


Hello Jack,

The existing way to access the persistent logs would be to access the running device locally. The persistent logs are stored at a specific location in the hostOS filesystem, please check the documentation here Device Logs - Balena Documentation , that is not natively mounted when checking the SD card from a Windows or MacOS computer.

I suggest that you try to connect to the device locally via SSH following this guide: SSH access - Balena Documentation with the user root.

  1. Option: This works straight away when the device is running a development balenaOS image.
  2. Option: When the device runs on a production balenaOS image you have to add your SSH public key to the config.json, that you can access from the mounted boot partition from your MacOS computer.
    Please check this example config.json: Configuration - Balena Documentation and add your public ssh key to the os->sshkeys property Configuration - Balena Documentation .
    When the public SSH key is located in the config.json you can access the device locally via SSH with user root and the device IP. Then you can navigate to the devices persistent logging section or directly check the network connection issues from the running device.

To access the persistent logs you may want to check journalctl -D /var/log/journal/ from the hostOS ssh session.

To answer the other question about the mounted boot partition in relation to the full image size: Your operating system, which I understand is MacOS can only mount the boot partition. The other hostOS partitions existing on the SD card are formated in a filesystem (ext4) that is not natively supported by MacOS, thus your computer cannot mount them and cannot read the files. If you happen to have a Linux operating system you could try to mount the filesystem form the SD there.
I’m linking you the documentation about the balenaOS image layout: What is balenaOS? - Balena Documentation

Best Regards

You may also need to revise your network infrastructure to fulfil our network requirements: Network Setup on balenaOS - Balena Documentation