(Sorry for messing up last time.)
I enabled remote access as on p.112 & 113 of the Smart Home book. Then I tried to test it as on p.114. sudo systemctl restart mosquitto fails with a message in sudo systemctl status mosquitto “Service request repeated too quickly”.
Can you help me figure out what I’m doing wrong? I was making good progress until this.
Thanks, -jim
Hi.
You can try to restart the Raspberry Pi with
sudo reboot
Then continue with the other instructions.
Let me know if this works.
Regards,
Sara
Thanks for the suggestion.
I shutdown completely and restarted. Checking mosquitto status showed the same failure. Restarting mosquitto and checking status showed the same error.
What should I try next?
Thanks!
-jim
Hi again.
I’m not sure exactly what caused the issue, but I suspect it might be because you edited something wrong by mistake on the mosquitto.conf file.
Run the following command
sudo nano /etc/mosquitto/mosquitto.conf
Then, take a printscreen to the file and share it with me.
To share a picture, upload it to Google Drive or Imgur and then share a link to the file.
Regards,
Sara
I didn’t want to just dump this in your lap, Sara. So I did some Googling (which didn’t help) and some experimenting (which did help).
After groping about a bit, I finally looked in the /var/log/mosquitto/mosquitto.log file. I noticed several lines that said unable to open password “/etc/mosquitto/pwd”. (That’s the name I gave the password file.) So I looked at permissions for the files in /etc/mosquitto. Most had permission 0644, but pwd only had 0600. I changed the permissions to 0644 and no more errors when restarting mosquitto.
I then had another look at the log file. In it, I saw that what I had done was deprecated. According to the messages, I needed to change the owner and group to mosquitto:mosquitto and the permissions to 0700. I did that and restarted mosquitto with no problems.
Then I added another user to the password file using mosquitto_passwd. When I did this, I got the message the the password file (pwd) should be owned by root – exactly the opposite of the instructions in the log file! There is an obvious BUG here! I left the owner and group as mosquitto.
Then I tried the subscribe and publish test using the user and password. Didn’t work! So I changed the group and owner back to root, set permission to 0644, and tried again. It now works! So this gets me going again with the course!
Perhaps you want to verify this and file a bug report with mosquitto to straighten this out before the next release come along and hoses things up again.
-jim
Hi.
Thanks for letting me know.
It’s weird that we need to do all that procedure now… but, I’ll test the instructions from the beginning and I’ll report back.
Regards,
Sara
Hi again.
I just tested the installation and creating a psswrod and enabling remote access.
Everything seems to be working as expected by following the instructions in the eBook.
I’m not sure exactly what happened with your installation that caused that issue.
Maybe you didn’t start with a fresh installation of the RPI OS? Maybe there was something wrong with your password file? I’m not sure. But the instructions are working as expected on my side.
Either way, I’ll look out for other users’ experiences to see if they are facing similar issues.
Let me know if you need further help.
Regards,
Sara
I’ll try and figure this out also, Sara. I pretty carefully followed the directions in the book, so I don’t know what’s wrong. One thing I thought of: I’m using a Pi 4, nor a Pi 5. Not sure if that matters.
-jim