Copyright ©

Mongoose OS Forum


Failed to connect to Google IoT Core MQTT bridge with CONNACK 4

dschoenerdschoener Germany
edited February 20 in Mongoose OS

Since mongoose-os verson 1.24 and 1.25 (1.23 was not tested) I am not able to connect to the Google MQTT bridge any more.
In version 1.22 it still worked fine. I always get the following error:

[Feb 20 23:00:49.678] ssl_socket_send      0x3fff2644 600 -> 600
[Feb 20 23:00:49.761] ssl_socket_recv      0x3fff2644 <- 5 
[Feb 20 23:00:49.765] ssl_socket_recv      0x3fff2644 <- 28
[Feb 20 23:00:49.773] mgos_mqtt_ev         MQTT event: 202
[Feb 20 23:00:49.773] mgos_mqtt_ev         MQTT CONNACK 4
[Feb 20 23:00:49.779] ssl_socket_send      0x3fff2644 31 -> 31
[Feb 20 23:00:49.784] mgos_mqtt_ev         MQTT Disconnect
[Feb 20 23:00:49.789] mqtt_global_reconnec MQTT connecting after 4269 ms
[Feb 20 23:00:53.595] wifi_changed_cb      WiFi event: 7
[Feb 20 23:00:54.066] mgos_mqtt_global_con MQTT connecting to


  • :45.134] ssl_socket_send 0x3ffcad54 346 -> 346
    [Feb 22 18:48:45.291] ssl_socket_recv 0x3ffcad54 <- 5 [Feb 22 18:48:45.296] ssl_socket_recv 0x3ffcad54 <- 28 [Feb 22 18:48:45.305] mgos_mqtt_ev MQTT event: 202 [Feb 22 18:48:45.305] mgos_mqtt_ev MQTT CONNACK 4 [Feb 22 18:48:45.311] ssl_socket_send 0x3ffcad54 31 -> 31
    [Feb 22 18:48:45.317] mgos_mqtt_ev MQTT Disconnect
    [Feb 22 18:48:45.326] mqtt_global_reconnec MQTT connecting after 3846 ms

    Got the exact same problem here - any advice?

  • SergeySergey Dublin, Ireland

    Looking at that, thanks. For now, please use 1.22.

  • How can i downgrade to a previous version, i'm using ubuntu 16.04 , and have the same problem

  • spidiespidie Gold Coast, Australia

    I'm getting same issue - I can't see a version 1.22 in the ppa (I am on Ubuntu too). Any ideas anyone (or any imminent fix?)

  • nliviunliviu Romania

    You need to uninstall mos, remove the reference to ppa:mongoose-os/mos and reinstall following the directions given for MacOS / Linux

    sudo apt-get remove mos --purge
    sudo add-apt-repository -r ppa:mongoose-os/mos
    sudo apt-get update
    curl -fsSL | /bin/bash
    source .bashrc
    mos --version
    The Mongoose OS command line tool
    Version: 1.26
    Build ID: 20180208-184624/1.26@ab7f50e1+
    Update channel: release

    This way you will install the newest release (1.26 now).
    To install an earlier version

    mos update 1.22
    mos --version
    First run of the version 1.22, initializing...
    Init done.
    The Mongoose OS command line tool
    Version: 1.22
    Build ID: 20171215-233850/1.22@a043b261+
    Update channel: release
  • spidiespidie Gold Coast, Australia

    Awesome - thanks - I'll give it a go.

  • jptalledojptalledo Blacksburg, VA

    It worked. Thanks for providing the instructions to roll back. Should we open a direct ticket to report this issue?

  • nliviunliviu Romania

    No, I don't think so.
    This is not an issue, it works like it is intended to. The ppa:mongoose-os/mos provides the latest release.

  • spidiespidie Gold Coast, Australia

    Tried 1.22 - sadly did not fix the problem. Will raise a ticket on latest version and see if there is a way to get this fixed in latest.

  • PeteWPeteW Bulgaria
    edited March 28

    To resolve MQTT CONNACK 4 errors you need to include sntp lib in your project.

    1. In your mos.yml libs section add 
    2. Rebuild firmware
    3. Flash new firmware
    4. Look at mos console  -  you can have several CONNACK 4 errors before sntp synchronize current time. Once the time is in sync your connection to google clod iot core will be acknowledged.
Sign In or Register to comment.