Login to mosquitto-broker fails after last update

Hi folks,

after my last update of the mosquitto broker to the latest version (6.1.1) I don’t receive any value.
A look into the log sais to me that my login fails.

Fatal error: Uncaught PhpMqtt\Client\Exceptions\ConnectingToBrokerFailedException: [6] Establishing a connection to the MQTT broker failed: The configured broker responded with unauthorized.

1651901465: Client <unknown> closed its connection.
1651901521: New connection from 192.168.178.7:40683 on port 1883.
error: received null username or password for unpwd check
1651901521: Client <unknown> disconnected, not authorised.

I made noch changes in configuration of server or client and before that everything worked perfect.

Is somebody able to help me?

regards,
Bernd

PS: her is the start-log of mosquitto-broker:

[s6-init] making user provided files available at /var/run/s6/etc...exited 0.
[s6-init] ensuring user provided files have correct perms...exited 0.
[fix-attrs.d] applying ownership & permissions fixes...
[fix-attrs.d] done.
[cont-init.d] executing container initialization scripts...
[cont-init.d] mosquitto.sh: executing... 
[07:57:03] INFO: SSL is not enabled
[cont-init.d] mosquitto.sh: exited 0.
[cont-init.d] nginx.sh: executing... 
[cont-init.d] nginx.sh: exited 0.
[cont-init.d] done.
[services.d] starting services
[services.d] done.
[07:57:04] INFO: Starting NGINX for authentication handling...
[07:57:05] INFO: Starting mosquitto MQTT broker...
1651903025: Warning: Mosquitto should not be run as root/administrator.
[07:57:06] INFO: Successfully send discovery information to Home Assistant.
[07:57:06] INFO: Successfully send service information to the Supervisor.
1651903025: mosquitto version 2.0.11 starting
1651903025: Config loaded from /etc/mosquitto/mosquitto.conf.
1651903025: Loading plugin: /usr/share/mosquitto/go-auth.so
1651903025:  ├── Username/password checking enabled.
1651903025:  ├── TLS-PSK checking enabled.
1651903025:  └── Extended authentication not enabled.
1651903025: Opening ipv4 listen socket on port 1883.
1651903025: Opening ipv6 listen socket on port 1883.
1651903025: Opening websockets listen socket on port 1884.
1651903025: mosquitto version 2.0.11 running
1651903025: New connection from 127.0.0.1:34384 on port 1883.
1651903025: Client <unknown> closed its connection.
1651903025: New connection from 172.30.32.2:34300 on port 1883.
1651903025: Client <unknown> closed its connection.
1651903027: New connection from 172.30.32.1:47629 on port 1883.
1651903027: New client connected from 172.30.32.1:47629 as 5e2fpUC8OJ3MbYQ0Rz2lhO (p2, c1, k60, u'mqtt').
1651903081: New connection from 192.168.178.7:42420 on port 1883.
error: received null username or password for unpwd check

Did 6.1.0 work? If you skipped it, it’s release notes said

  • Update mosquitto to 2.0.11
  • Remove mosquitto-auth-plug and replace with mosquitto-go-auth 1.8.2
  • Change base image from Alpine to Debian (required for mosquitto-go-auth)

Note: Mosquitto 2.0.0 did contain some breaking changes. We don’t anticipate most users to be affected by them but if you have a heavily customized mosquitto config we would advise reviewing their changelog.

I didn’t need to change anything, but you may want to check it out.

After the update on 4.5.2022 the issue began.
I think it was the update fom 6.1.0 tu 6.1.1
there were some more updates an this day

has anybody got this working yet as I to have the error: received null username or password for unpwd check problem with mqtt?

Which integration is giving that error?

It is seen in the MQTT addon since the recent updates of this addon. All my mqtt sensors have stopped with this error.
All my MQTT sensors from TTN have stopped too but there iare no error messages about these that I can see in the logs.

What is ttn?

There is an issue opened in git, seems that downgrading fixes the problem for now.

1 Like

How can I downgrade the mosquitto-broker-addon?

Restore the backup that you made when you installed the update.

…but then all the collected data is lost
no other way?

What collected data?

…all the other modifications I did since this update

But you only need to restore the addon. Not the complete system and database.

1 Like

…but this can’t be the solution

You asked how to downgrade the addon. You got the correct answer. Still you argue.

the downgrade isn’t the solution for the issue.
why does the mosqitto-broker-plugin not accept the login from other instances?

Mine does so it is hard for me to diagnose.

The latest release of mosquitto does not allow anonymous logins, so if you’ve previously configured the mqtt integration without a login, you’ll need to set up an mqtt user and reconfigure the integration with this user info.
You may also need to alter your external devices that use mqtt to use this username/password if they’re currently connecting anonymously.

To clarify, “mosquitto” will have a user setup (possibly called mqtt). The mqtt integration will also need this same info in order to read from the mosquitto broker.

Good catch, it never occurred to me that people were actually running without auth. I didn’t realse that was even possible with the addon.