Mosquitto problem

Hi, thank you for your reply.
I did the sequence you told me to do but the result was the same.
I’m not able to do the following command:

mosquitto_sub -d -u username -P password -t “dev/test”
mosquitto_pub -d -u username -P password -t “dev/test” -m “Hello world”

The feedback I get is “connection refused”.

What shall I do?

What is the status of the mosquitto server when this happens?

Can you execute this?

sudo systemctl status mosquitto

1 Like

Hi!
I used the status command and it seems that Mosquitto it is not even alive!
Weird…
I have followed all the steps with the help of Bruh but I can’t put Mosquitto to work.
I followed from this video:

Could it be the same issue I had and found a fix for in this thread?

1 Like

There was an error in mosquitto that caused it not to reboot automatically.
You can either do as stated by @ZyberSE or update raspbian (I think a fix has been introduced since)

1 Like

Thank you for your fast reply! I did what you described when you had the same problem but… no matter what i do (restart HA, start manually Mosquitto) but the status gets offline all the time.
I will update Home assistant now and see if this error got away… I will get back to you later.

check this out, it did the trick for me… Do not forget to start the service or reboot you pi after enable it

2 Likes

hi all! Thank you again for the best follow up you do.
So I did the upgrade of Home Assistant to the version 0.46.0 and after, I have rebooted it.
I did the sequence sudo systemctl enable mosquitto.service + sudo systemctl start mosquitto.service + sudo systemctl status mosquitto.service and I can not run Mosquitto.
Please take a look on the picture attached.

What shall I do?

You should type “sudo systemctl status mosquitto -l” to see if you can get any more information (it is truncated).

1 Like

Hi! Here is the status as you have requested

It seems it is Mosquitto not to work only because at the moment I’m using https://www.cloudmqtt.com/ and I don’t have any problems.
As you can understand I want to use Mosquitto but I can’t make it to work…

Please help me!

It says it cannot open the mosquitto.conf file.

Type “ls /etc/mosquitto” and see if the mosquitto configuration file (mosquitto.conf) file even exists or it might have the wrong permissions…

1 Like

that is a very good point what you refer, check both pictures…

Try typing "ls /etc/mosquitto -l to see the permissions.

Did you ever set a password on your mosquitto broker?

1 Like

yes I have register a username and password.
please take a look on the pictures…

What I’m I missing to have Mosquitto to work on the raspberry PI?

Hi mate,
I had the same problem this morning. Resolved by removing mosquito (because I missed some files in mosquito rep),then reinstalled-rebooted rpi-checked mosquito status (not enabled) and did the trick described by lamtho.
Try it

1 Like

I have removed now the app Mosquitto by using this command: sudo apt-get remove mosquitto
I have re-installed Mosquitto but it is still with the same problem.
Is there other way to uninstall Mosquitto because the file was still with all information inside?

Try with ‘sudo apt-get purge mosquitto’, this will erase also config files

1 Like

So… Great news!!!
After I use the command “sudo apt-get purge mosquitto”, I have re-installed Mosquitto, configured it and boom!!! it is working!!!
So the problem is on Hassbian or on “all in one installation” because after I removed Mosquitto and re-installed finally it is working!!!
Thank you all so much for your help! I will definitely start following this community every day!

1 Like

this did it for me if you installed via Hassbian. Thank you!

2 Likes