closed noob mosquitto installation on armbian question [message #1862208] |
Fri, 17 November 2023 10:17  |
Eclipse User |
|
|
|
I'm trying to make a server for all the sensors on my boat.
To do this I installed armbian on a solar powered bananapi m2 zero. And installed mosquito with the following commands:
wget (I'm not allowed to use links because I'm a new user) link to mosquito-repo. Gpg. Key
sudo apt-key add mosquitto-repo.gpg.key
cd /etc/apt/sources.list.d/
sudo wget (I'm not allowed to use links because I'm a new user), repo.mosquitto.org/debian/mosquitto-bookworm.list
apt-get update
sudo apt install mosquitto mosquitto-clients
It gave a warning about apt.key being depreciated but installed ok.
Once this was done, I tested it and it worked.
then I tried to secure my mosquitto broker following information on a digitalOcean site (Suggested by google)
I executed the following commands:
sudo mosquitto_passwd -c /etc/mosquitto/passwd bert
And made a default.conf file with:
sudo nano /etc/mosquitto/conf.d/default.conf
containing the following:
allow_anonymous false
password_file /etc/mosquitto/passwd
With a trailing newline, (which I think is a enter after the last command?)
Following this, I attempted to restart the broker using:
sudo systemctl restart mosquitto
Witch didn't work and gave the following error:
Job for mosquitto.service failed because the control process exited with error code.
See "systemctl status mosquitto.service" and "journalctl -xeu mosquitto.service" for details.
I tried "systemctl status mosquitto.service":
× mosquitto.service - Mosquitto MQTT Broker
Loaded: loaded (/lib/systemd/system/mosquitto.service; enabled; preset: enabled)
Active: failed (Result: exit-code) since Fri 2023-11-17 13:51:30 UTC; 23s ago
Duration: 5min 51.900s
Docs: man:mosquitto.conf(5)
man:mosquitto(8)
Process: 2887 ExecStartPre=/bin/mkdir -m 740 -p /var/log/mosquitto (code=exited, status=0/SUCCESS)
Process: 2888 ExecStartPre=/bin/chown mosquitto:mosquitto /var/log/mosquitto (code=exited, status=0/SUCCESS)
Process: 2889 ExecStartPre=/bin/mkdir -m 740 -p /run/mosquitto (code=exited, status=0/SUCCESS)
Process: 2890 ExecStartPre=/bin/chown mosquitto:mosquitto /run/mosquitto (code=exited, status=0/SUCCESS)
Process: 2891 ExecStart=/usr/sbin/mosquitto -c /etc/mosquitto/mosquitto.conf (code=exited, status=13)
Main PID: 2891 (code=exited, status=13)
CPU: 78ms
Nov 17 13:51:30 bananapim2zero systemd[1]: mosquitto.service: Scheduled restart job, restart counter is at 5.
Nov 17 13:51:30 bananapim2zero systemd[1]: Stopped mosquitto.service - Mosquitto MQTT Broker.
Nov 17 13:51:30 bananapim2zero systemd[1]: mosquitto.service: Start request repeated too quickly.
Nov 17 13:51:30 bananapim2zero systemd[1]: mosquitto.service: Failed with result 'exit-code'.
Nov 17 13:51:30 bananapim2zero systemd[1]: Failed to start mosquitto.service - Mosquitto MQTT Broker.
and "journalctl -xeu mosquitto.service" :
Journal file /var/log/journal/328157c716ca4f31b87372199f6889af/system@7c838c84ba3a4aaa9397b855e925ae88-0000000000000001-000604394ba7f577.journal is truncated, ignoring file.
░░ Automatic restarting of the unit mosquitto.service has been scheduled, as the result for
░░ the configured Restart= setting for the unit.
Nov 17 13:51:30 bananapim2zero systemd[1]: Stopped mosquitto.service - Mosquitto MQTT Broker.
░░ Subject: A stop job for unit mosquitto.service has finished
░░ Defined-By: systemd
░░ Support:(I'm not allowed to use links because I'm a new user) debian.org/support
░░
░░ A stop job for unit mosquitto.service has finished.
░░
░░ The job identifier is 1605 and the job result is done.
Nov 17 13:51:30 bananapim2zero systemd[1]: mosquitto.service: Start request repeated too quickly.
Nov 17 13:51:30 bananapim2zero systemd[1]: mosquitto.service: Failed with result 'exit-code'.
░░ Subject: Unit failed
░░ Defined-By: systemd
░░ Support: (I'm not allowed to use links because I'm a new user).debian.org/support
░░
░░ The unit mosquitto.service has entered the 'failed' state with result 'exit-code'.
Nov 17 13:51:30 bananapim2zero systemd[1]: Failed to start mosquitto.service - Mosquitto MQTT Broker.
░░ Subject: A start job for unit mosquitto.service has failed
░░ Defined-By: systemd
░░ Support: (I'm not allowed to use links because I'm a new user).debian.org/support
░░
░░ A start job for unit mosquitto.service has finished with a failure.
░░
░░ The job identifier is 1605 and the job result is failed.
I feel like it's something simple, but I'm not sure what it is.
Can somebody please help me so I can move on to enable SSL encryption, install nodejs and node-red and start playing around with the sensors I have.
Help would be greatly appreciated
[Updated on: Sun, 26 November 2023 15:55] by Moderator
|
|
|
|
Re: noob mosquitto installation on armbian question [message #1862229 is a reply to message #1862219] |
Sun, 19 November 2023 05:10  |
Eclipse User |
|
|
|
Small update
I found out how to find the owner of a process in Linux, which was 'mosquitto' and changed the ownership of the password file to that.
Restarted mosquito and all went well.
'Systemctl status mosquito. Service' said that all was running nicely, and 'journalist -Xe mosquito. Service' that it loaded '/etc./mosquito/conf.d/default. conf' as far as I can see without problems.
So I started testing it with:
mosquitto_pub -h localhost -t "test" -m "hello world"
And it gave no errors, which I found strange because I thought that the line
in default.conf would disable all non-authenticated connections.
then i tested it with
mosquitto_sub -h localhost -t test -u "bert" -P "password"
(where password is substituted with the real password) and it worked also
so I'm a step further than I was, but I'm still not there, I want mosquitto to refuse connections without user and password.
If someone can lend me a hand in getting this done, I would appreciate it
|
|
|
Powered by
FUDForum. Page generated in 0.04641 seconds