Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Stopped working on Pi when running via systemctl #825

Open
TotallyInformation opened this issue May 20, 2018 · 10 comments
Open

Stopped working on Pi when running via systemctl #825

TotallyInformation opened this issue May 20, 2018 · 10 comments

Comments

@TotallyInformation
Copy link

I've just updated my Pi which is running Rasbian Jesse. I guess I got v1.5 at that point.

However, I now always get the following error when booting the Pi:

[Sun May 20 10:56:19 2018]: mosquitto version 1.5 starting
[Sun May 20 10:56:19 2018]: Config loaded from /etc/mosquitto/mosquitto.conf.
[Sun May 20 10:56:19 2018]: Opening ipv4 listen socket on port 1883.
[Sun May 20 10:56:19 2018]: Opening ipv6 listen socket on port 1883.
[Sun May 20 10:56:19 2018]: Opening websockets listen socket on port 9001.
[Sun May 20 10:56:19 2018]: Opening ipv4 listen socket on port 1883.
[Sun May 20 10:56:19 2018]: Error: Address already in use

As you can see, it appears to be trying to open twice. The result is that no connections are possible.

I removed Mosquitto and reinstalled after manually deleting /etc/mosquitto and weirdly, I still get the same problem even though I now have no config file at all.

When I run it manually from the command line, everything works as expected. Importantly, running without a config file means that I don't get websockets on port 9001 which is what I expect so I can't work out what is causing that configuration to still be active when running via systemctl.

Confused!! Can anyone help? Thanks.

@jorgebnunes
Copy link

Hi, I have this problem too!
Thanks for posting

@TotallyInformation
Copy link
Author

TotallyInformation commented May 20, 2018

It looks as though a default has changed. Previously, I specified the settings for the standard listener in my local config file. Now, when that happen, it tries to reopen the default listener. If I disable the local config, it works.

/etc/mosquitto/mosquitto.conf

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

/etc/mosquitto/conf.d/pi.conf

# Standard Listener
listener 1883
protocol mqtt
log_type error
log_type warning
log_type notice
log_type information

# Websockets Listener
listener 9001
protocol websockets

As a work around, comment out the listener 1883 section.

I think this is going to cause issues for people.

@jorgebnunes
Copy link

Thanks man! This fixes it for now.

@guibom
Copy link

guibom commented May 21, 2018

I've got the same problem while updating my Armbian Jessie server; it was trying to open another server at 1883. Commenting out the listener as mentioned by @TotallyInformation works

Unfortunately that's not the only problem I had. I had the following other issues after the update:

  • Node-red instance was getting disconnected over socket errors -- Purging mosquitto and installing again seemed to have fixed it.
  • esp8266 with Homie cannot properly connect to broker, and keeps getting disconnected.
  • Web page using mqttws31.js and websocket connects to broker, but does not receive any messages. (it looks like it keeps receiving the onConnect event constantly)

@idcrook
Copy link

idcrook commented May 24, 2018

In mosquitto 1.5 on a Pi, I don´t specify a listener on port 1883 in my config (since I instead configure WS, WSS, and TLS).

in version 1.4.15 this worked as expected
in version 1.5 there are now listeners launched on port 1883 (and I don’t know how to turn them “off”)

1527190660: Opening ipv4 listen socket on port 1883.
1527190660: Opening ipv6 listen socket on port 1883.

So it appears that, as theorized above, some default settings got changed, that auto-specify a standard MQTT port listener... Should a separate issue be filed, or is this existing one good enough?

@valdragas
Copy link

I also have this problem, as a result of the update I have problems between my raspberry and arduinos (esp8266 and mega).

Is there any way to remove it and go back to the previous version?

Can someone describe how to install a specific version manually?

regards

@DarkCompiled
Copy link

I had the same trouble.
It also seems to me that a default listener on 1883 tcp port (ipv4 and ipv6) is always started, even if we have defined the same listener on 1883 already, or other default listener on another port.
It would be great if mosquitto could check if a default listener was already set, so it would not try to setup the same twice, otherwise we cannot disable the default listener on 1883.

@illnr
Copy link

illnr commented Apr 19, 2019

I was stuck on the same problem. But the docs say:

port port number
Set the network port for the default listener to listen on. Defaults to 1883.

So it looks like there will always be this default port for the default listener. But you can change it or only allow localhost on it.

And with the help of google groups:

# default listener only on localhost
bind_address localhost # or 127.0.0.1

port 1883 # default port, could be omitted or changed to another port.

# TLS listener
listener 8883
...

So as @TotallyInformation wrote: commenting out listener 1883 is not only a work around but the solution. First the config for the default listener (listener 1883), after that config for other listeners.

@ralight
Copy link
Contributor

ralight commented Apr 25, 2019

This should have been fixed in version 1.5.1. @iBaff , could you check which version you were using?

@Omni-star
Copy link

Omni-star commented Jun 3, 2022

I've just updated my Pi which is running Rasbian Jesse. I guess I got v1.5 at that point.

However, I now always get the following error when booting the Pi:

[Sun May 20 10:56:19 2018]: mosquitto version 1.5 starting
[Sun May 20 10:56:19 2018]: Config loaded from /etc/mosquitto/mosquitto.conf.
[Sun May 20 10:56:19 2018]: Opening ipv4 listen socket on port 1883.
[Sun May 20 10:56:19 2018]: Opening ipv6 listen socket on port 1883.
[Sun May 20 10:56:19 2018]: Opening websockets listen socket on port 9001.
[Sun May 20 10:56:19 2018]: Opening ipv4 listen socket on port 1883.
[Sun May 20 10:56:19 2018]: Error: Address already in use

As you can see, it appears to be trying to open twice. The result is that no connections are possible.

I removed Mosquitto and reinstalled after manually deleting /etc/mosquitto and weirdly, I still get the same problem even though I now have no config file at all.

When I run it manually from the command line, everything works as expected. Importantly, running without a config file means that I don't get websockets on port 9001 which is what I expect so I can't work out what is causing that configuration to still be active when running via systemctl.

Confused!! Can anyone help? Thanks.

to solve this problem you need terminate mosquitto that maybe you suspend only. To terminate mosquitto you should open activity monitor and find mosquitto among processes in the disk. finally you should doing double click on mosquitto(among processes) and click on exit.
In alternative you can write fg in your terminal for resume mosquitto process and teminate it with ctr+c.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

9 participants