Can't see logs in `balena logs` unless not using `.local`

Hey all. New Balena user here :wave:

I have a balena device running a slightly customized version of balena-sound (just a few services removed). I followed the balena-cli guide and I got most of the local mode functionality working (I think). For instance:

  1. sudo balena scan returns me a real device on my home network,
  2. I ran a balena push and it succeeded with the unicorn at the end.
  3. After the balena push, I think I recall the device rebooted.

But, I think there’s something wrong and I’m having trouble diagnosing the issue. If I run balena logs <id>.local, I get no output and the command just hangs. If I run balena logs <id> I do see some output, but the log entries are from quite a while ago and they won’t update as they keep flooding constantly at the web interface. This, plus these fishy log messages:

[Logs]    [9/2/2020, 7:34:38 PM] Downloading image 'registry2.balena-cloud.com/v2/ea53ff66c53f036f1d748f373e017c99@sha256:5decc7263458d4d48061c4ab20d717819fc64b513d1f34e3cb7ef8ada0471859'
[Logs]    [9/2/2020, 7:34:38 PM] Downloading image 'registry2.balena-cloud.com/v2/7105c2ff6c52376a7128868c60d7459a@sha256:837f238a33cafe5b9941356e0d695478e8ce64981ad56a6aa9b529be5b5fc828'
[Logs]    [9/2/2020, 7:34:38 PM] Downloading image 'registry2.balena-cloud.com/v2/75ec177589474d128ee2d15bcccd1fa7@sha256:cdb5b621cc044e6fec544d6e89edef25ffed60ded67a49ef2a2d39c113784e00'
[Logs]    [9/2/2020, 7:34:38 PM] Downloading image 'registry2.balena-cloud.com/v2/21f16c6c89276650cf9ccc4d1c3cb492@sha256:f4a0db8b99cd830e6236a9ef8e1d41d0ab2225079931acf42fa8d4737ef1642e'
[Logs]    [9/2/2020, 7:34:38 PM] Downloading image 'registry2.balena-cloud.com/v2/75de6ff2a36c7966266c0994bb6ecc66@sha256:c697ec4f3f90fdad5aa0d1ad0f815daa997875a85da7595589e62e9ee0e78996'
[Logs]    [9/2/2020, 7:34:38 PM] Downloading image 'registry2.balena-cloud.com/v2/eadd0eccfa0dad7b3698b3aaf1c27301@sha256:e2ec6e62a848372d7def92890c5b7624d4a00dd8f93b5bc101d1ceb1c7e746a7'
[Logs]    [9/2/2020, 7:34:38 PM] Downloading image 'registry2.balena-cloud.com/v2/587125706aa833a5d068216a2bd4db27@sha256:1acbcd9f69a594bc794dbaac75c44ccebd051aa7a0839447410ad46c5a2a11fa'
[Logs]    [9/2/2020, 7:45:19 PM] Failed to download image 'registry2.balena-cloud.com/v2/587125706aa833a5d068216a2bd4db27@sha256:1acbcd9f69a594bc794dbaac75c44ccebd051aa7a0839447410ad46c5a2a11fa' due to 'connect ECONNREFUSED /var/run/balena-engine.sock'
[Logs]    [9/2/2020, 7:45:19 PM] Failed to download image 'registry2.balena-cloud.com/v2/7105c2ff6c52376a7128868c60d7459a@sha256:837f238a33cafe5b9941356e0d695478e8ce64981ad56a6aa9b529be5b5fc828' due to 'connect ECONNREFUSED /var/run/balena-engine.sock'
[Logs]    [9/2/2020, 7:45:19 PM] Failed to download image 'registry2.balena-cloud.com/v2/75ec177589474d128ee2d15bcccd1fa7@sha256:cdb5b621cc044e6fec544d6e89edef25ffed60ded67a49ef2a2d39c113784e00' due to 'connect ECONNREFUSED /var/run/balena-engine.sock'
[Logs]    [9/2/2020, 7:45:19 PM] Failed to download image 'registry2.balena-cloud.com/v2/ea53ff66c53f036f1d748f373e017c99@sha256:5decc7263458d4d48061c4ab20d717819fc64b513d1f34e3cb7ef8ada0471859' due to 'connect ECONNREFUSED /var/run/balena-engine.sock'
[Logs]    [9/2/2020, 7:45:19 PM] Failed to download image 'registry2.balena-cloud.com/v2/21f16c6c89276650cf9ccc4d1c3cb492@sha256:f4a0db8b99cd830e6236a9ef8e1d41d0ab2225079931acf42fa8d4737ef1642e' due to 'connect ECONNREFUSED /var/run/balena-engine.sock'
[Logs]    [9/2/2020, 7:45:19 PM] Failed to download image 'registry2.balena-cloud.com/v2/75de6ff2a36c7966266c0994bb6ecc66@sha256:c697ec4f3f90fdad5aa0d1ad0f815daa997875a85da7595589e62e9ee0e78996' due to 'connect ECONNREFUSED /var/run/balena-engine.sock'
[Logs]    [9/2/2020, 7:45:19 PM] Failed to download image 'registry2.balena-cloud.com/v2/eadd0eccfa0dad7b3698b3aaf1c27301@sha256:e2ec6e62a848372d7def92890c5b7624d4a00dd8f93b5bc101d1ceb1c7e746a7' due to 'connect ECONNREFUSED /var/run/balena-engine.sock'

What have I done wrong?

Doesn’t look like the device is in local mode. Could you try following the guide again from the start, making sure that:

  • After enabling local mode, the log window shows the following message: “Logs are not available when your device is running in local mode.”
  • sudo balena scan lists your device
  • balena push <device>.local (note the device’s address) does not show the unicorn and instead you get a live feed of the service’s logs after the build phase

All of these requirements are check. As for:

  • balena push <device>.local (note the device’s address) does not show the unicorn and instead you get a live feed of the service’s logs after the build phase

I haven’t checked that, but I tried to disable local mode, and the same errors appeared in the web interface’ log. I suspect it’s the SD card that’s is faulty (according to this. I’m checking now a different, sandisk (vs Samsung), 32Gb SD card, that is a bit newer and I don’t experience the issue.

balena push <ip-address> did work. As well as with <id>.local, with the new SD card.

As for my original complaint:

If I run balena logs <id>.local , I get no output and the command just hangs

The command doesn’t hang - it’s just there’s nothing for it to output. Even if I use --tail or not it wouldn’t make a difference.

Do you get live logs from balena push?

Yes, and while I had 1 terminal open with a balena logs, I saw exactly the same lines printed from both terminals. What worried me was the fact that logs weren’t printing at all, but that was because all services were down, and this was because the SD card failed to load the updated containers I guess.

It may worth noting a UX issue with balena-cli from this. I mean, usually you’d expect to see some logs constantly printing, but if no services are running, it could be nice if balena logs would warn that no services are running, and list their status, or at least print that it successfully connected to the device. Never the less, so far I’m sufficiently satisfied from the whole ecosystem :).

Hi Doron, I’m glad you got it to work!

Regarding adding additional info to the logs, it’s a bit tricky since some users pipe the output of logs to other commands for parsing. I’d agree that having a way to check success of the connection or status of the services would be a good addition. Thanks for your feedback!

1 Like