I’m evaluating Balena as an IoT fleet manager for our connected fridges, and I literally spent an entire day trying to figure out why our software doesn’t work correctly on Balena Engine. We are using the Raspberry PI 4 Serial Port (GPIO 14+15) to read data from a QR Code scanner (using /dev/serial0 with enable_uart=1 in config.txt).
When running on Balena developement OS (as recommended for… developing !) using local mode I had some random errors (“bad file descriptor” after opening…) and data loss.
After hours of debugging all our stack it seems that Balena OS automatically enable console output on serial port by default, and you don’t have any way to disable it… At least this is my understanding because I don’t have the issue on production builds.
Do you confirm this behavior ? How can I disable it to be able to develop ?
Hi there, I can appreciate the frustration! Yes, you are right, the development OS’s make use of the serial0 port. To disable this, you should be able to run:
mount -o remount,rw /
systemctl mask serial-getty@serial0.service
reboot
Please let us know if this works for you. I can imagine how this would have been a pain to get to the bottom of, so I want to make sure we consider opportunities to avoid the pain in the future!
I and others have definitely been caught out by this issue in the past. Our docs currently say ’ Note: Raspberry Pi devices don’t have Getty attached to serial by default, but they can be configured to enable serial in the balenaCloud Dashboard via configuration variables.’ so I wonder if that is still the case or not.