OpenBalena on macOS

I’ve found these numeric error codes in os-config source code (errors.rs):

        ErrorKind::ReadOSConfigSchema => 3,
        ErrorKind::FetchConfiguration => 4,
        ErrorKind::StartService(_) => 5,
        ErrorKind::StopService(_) => 6,
        ErrorKind::ReloadRestartService(_) => 7,
        ErrorKind::WriteFile(_) => 8,
        ErrorKind::ServiceNotFoundJSON(_) => 9,
        ErrorKind::ConfigNotFoundJSON(_, _) => 10,
        ErrorKind::MergeConfigJSON => 11,

So os-config join(....) failed with error: 4 would be FetchConfiguration error, which we assume is an error when the device tries to contact some of the openBalena endpoints:

api.mydomain.com
registry.mydomain.com
vpn.mydomain.com
s3.mydomain.com

I am not clear that it is necessarily a DNS error. I suggest decoding the base64 string provided in the error message (see example in balena-cli issue 1151) to extract the actual endpoint URLs, then test whether they are reachable on the device host OS terminal – perhaps using tools like ping, curl or nslookup.

Is there a way to make my device resolve the DNS ?

If it is indeed a DNS resolution issue, then instead of modifying the device’s host OS, it may be preferable (if possible) to use an external DNS server and edit the device’s config.json dnsServers setting to point to that DNS server: this comment from another forum thread covers some of them, the easiest probably being using a domain registrar’s web interface to modify CNAME or A records. For example, if you bought kameshs.com from GoDaddy (no affiliation!), :slight_smile: you could follow this guide.

Also note that balena-cli issue 1319 reports that balena join does not run on production balenaOS images ((see dev vs prod images), and offers a workaround which is to open a ssh terminal to the device’s host OS then directly execute the os-config leave/join command. When manually running the os-config command on the device terminal, watch out for JSON escaping – see this comment on issue 1151.