I have a complete new installation on a Raspberry Pi 3b, where i have only Raspbian 4.14 and mosquito + mosquito-clinets. I upgraded after I got the error to mosquitto 1.5.3. But this did not solve my problem. Upgrade to mosquitto 1.5
I have for each task in my smarthome one Raspberry Pi 3b:
openhab2 with Openhabian
influxdb with Raspbian
grafana with Raspbian
mqtt with Raspbian
OS: Raspian
pi@mqtt:~ $ uname -a
Linux mqtt 4.14.70-v7+ #1144 SMP Tue Sep 18 17:34:46 BST 2018 armv7l GNU/Linux
HW:
pi@mqtt:~ $ cat /proc/device-tree/model
Raspberry Pi 3 Model B Rev 1.2
My Error:
pi@mqtt:~ $ mosquitto -v
1539077460: mosquitto version 1.5.3 starting
1539077460: Using default config.
1539077460: Opening ipv4 listen socket on port 1883.
1539077460: Error: Address already in use
Mosquitto Config:
pi@mqtt:~ $ ls /etc/mosquitto/
ca_certificates certs conf.d mosquitto.conf
pi@mqtt:~ $ ls /etc/mosquitto/conf.d/
README
pi@mqtt:~ $ cat /etc/mosquitto/mosquitto.conf
# Place your local configuration in /etc/mosquitto/conf.d/
#
# A full description of the configuration file is at
# /usr/share/doc/mosquitto/examples/mosquitto.conf.example
pid_file /var/run/mosquitto.pid
persistence true
persistence_location /var/lib/mosquitto/
log_dest file /var/log/mosquitto/mosquitto.log
include_dir /etc/mosquitto/conf.d
pi@raspberrypi:~ $ netstat -anp | grep 1883
(Not all processes could be identified, non-owned process info
will not be shown, you would have to be root to see it all.)
tcp 0 0 0.0.0.0:1883 0.0.0.0:* LISTEN -
tcp6 0 0 :::1883 :::* LISTEN -
1539079649: Error in poll: Interrupted system call.
log:
pi@raspberrypi:~ $ cat /var/log/mosquitto/mosquitto.log
1539079636: mosquitto version 1.4.10 (build date Fri, 22 Dec 2017 08:19:25 +0000) starting
1539079636: Config loaded from /etc/mosquitto/mosquitto.conf.
1539079636: Opening ipv4 listen socket on port 1883.
1539079636: Opening ipv6 listen socket on port 1883.
1539079649: Error in poll: Interrupted system call.
1539079649: mosquitto version 1.4.10 terminating
1539079654: mosquitto version 1.4.10 (build date Fri, 22 Dec 2017 08:19:25 +0000) starting
1539079654: Config loaded from /etc/mosquitto/mosquitto.conf.
1539079654: Opening ipv4 listen socket on port 1883.
1539079654: Opening ipv6 listen socket on port 1883.
1539081462: Saving in-memory database to /var/lib/mosquitto/mosquitto.db.
1539081987: New connection from 192.168.178.70 on port 1883.
1539081987: New client connected from 192.168.178.70 as MQTT_FX_Client (c1, k60).
1539083263: Saving in-memory database to /var/lib/mosquitto/mosquitto.db.
1539083657: Error in poll: Interrupted system call.
1539083657: mosquitto version 1.4.10 terminating
1539083657: mosquitto version 1.5.3 starting
1539083657: Config loaded from /etc/mosquitto/mosquitto.conf.
1539083657: Opening ipv4 listen socket on port 1883.
1539083657: Opening ipv6 listen socket on port 1883.
1539083700: mosquitto version 1.5.3 terminating
1539083704: mosquitto version 1.5.3 starting
I killed the mosquitto process and without reboot or restarting the process:
pi@raspberrypi:~ $ mosquitto -v
1539084842: mosquitto version 1.5.3 starting
1539084842: Using default config.
1539084842: Opening ipv4 listen socket on port 1883.
1539084842: Opening ipv6 listen socket on port 1883.
No Error. But after reboot i get the same error again.
pi@raspberrypi:~ $ mosquitto -v
1539084974: mosquitto version 1.5.3 starting
1539084974: Using default config.
1539084974: Opening ipv4 listen socket on port 1883.
1539084974: Error: Address already in use
Hm, are you trying to start the mosquitto process manually each time? You’re not supposed to, the mosquitto service starts by itself on boot (daemonizing).
The correct way to stop/start the mosquitto service is by:
service mosquitto status ; gets currents status
service mosquitto stop
service mosquitto start
Thanks alot for your help, this is maybe my tenth setup.
At this point I did not stop, start, restart the service manualy, neither bey service nor by systemctl
after changing something i always performed a reboot.
[14:23:27] openhabian@openHABianPi:~$ mosquitto -v
1539087812: mosquitto version 1.4.10 (build date Fri, 22 Dec 2017 08:19:25 +0000) starting
1539087812: Using default config.
1539087812: Opening ipv4 listen socket on port 1883.
1539087812: Error: Address already in use