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

Mosquitto not working anymore after Synology update #2866

Open
AlbertHoevenaars opened this issue Aug 7, 2023 · 14 comments
Open

Mosquitto not working anymore after Synology update #2866

AlbertHoevenaars opened this issue Aug 7, 2023 · 14 comments

Comments

@AlbertHoevenaars
Copy link

AlbertHoevenaars commented Aug 7, 2023

After updating my Synology NAS DS1019+ last week, Mosquitto will not start anymore. Before the update Mosquitto was working (within Docker) without any problem. The message I get is "driver failed programming external connectivity on endpoint mosquitto (178c4e06e5edb9aad649bc2789e5ce7c160fd2b85daaae5b599cebd22a0950a6): Error starting userland proxy: listen tcp4 0.0.0.0:1883: bind: address already in use"
my mosquitto.conf file holds:

allow_anonymous false
listener 1883 192.168.2.160

persistence true
persistence_location /mosquitto/data/
log_dest file /mosquitto/log/mosquitto.log

password_file /mosquitto/config/password_file

No log file is created. By the way I have never seen something in the log directory.

How to solve this problem and get Mosquitto working again?

@AlbertHoevenaars
Copy link
Author

Untitled
When I start Mosquitto in Docker this is the message I got

@NorbertHeusser
Copy link
Contributor

From the error message
Error starting userland proxy: listen tcp4 0.0.0.0:1883: bind: address already in use
it sounds like docker is not even be able to start the container. This is an error message from docker and not from the mosquitto running inside the container. The userland proxy is part of docker used to forward incoming connections into the container. On a linux system user land proxy are most times not really required, because network forwarding for the docker containers is achieved using the iptables kernel module.

But anyway this message means the is still a different process listening to the port 1883, which docker would like to bind for the Mosquitto broker. Not sure, which tools are installed in the NAS and if you are able to log into it. Easiest way to find out the process would be using a netstat -nap | grep 1883 executed as root. Alternative would be to use a lsof command.

My best guess would be something went wrong with the docker update/config. I have seen problems with containers not really being stopped (reboot should fix that). Or problems with different docker installation existing at the same time (as there are most times different ways to install docker).

@AlbertHoevenaars
Copy link
Author

Norbert, thanks for the message. I executed the command and the result is attached.
Screenshot 2023-08-28 112140. Because I am not experienced in these things, maybe you can tell me what's wrong and how to correct it.

@Sir-Bacon
Copy link

Any update on this? I have the same issue on my Synology DS918+ running DSM 7.2.1 Update 3.
@AlbertHoevenaars did you solve it?

@Daedaluz
Copy link
Contributor

@Sir-Bacon, I'm not familiar with synology in general but if you run sudo netstat -lntp | grep 1883 you should see what is listening on port 1883 - preventing the mosquitto container from starting.

If it happens to be "docker-proxy", there should be another process in docker occupying the port;

If you are able to run docker commands from cli, then you can try docker ps -a or sudo docker ps -a to get a list of containers and what ports they listen on.

Did mosquitto update in this process as well, by any chanse?

I have a hunch that it's going to be a mosqutto (stopped or started), that is listening on it, but with a bad configuration.

  • just a guess.

@AlbertHoevenaars problem is probably due to the fact listener 1883 192.168.2.160 specifies an ip - most likely not used by the container, rather the host.

just listener 1883 should do fine.

I would also reorder the config to look more like:

persistence true
persistence_location /mosquitto/data/
log_dest file /mosquitto/log/mosquitto.log

listener 1883
allow_anonymous false
password_file /mosquitto/config/password_file

given that some options are listener specific thus can start the "default listener", which is not what you want to do here.

@Sir-Bacon
Copy link

@Daedaluz : Thanks for the help. I run the command, check the screenshot below.
image

There is no Docker active on port 1883. It is listed as nginx.
I am not aware of any nginx running on my Docker. I do not use reverse proxy, don't have any other docker running, so have no clue what this is.

@Daedaluz
Copy link
Contributor

What on earth is a nginx doing on port 1883?!
Some websocket mqtt attempt perhaps?

@Sir-Bacon
Copy link

Sir-Bacon commented Apr 23, 2024

Perhaps this was a left-over from an earlier attempt to install the Eclipse docker. In the new Synology Container Manager the first selection you can do is to setup a web portal:
image

I may have done this on an earlier attempt. I have now deleted that in the Web Station web portal, no more ports in use there. Checked with Putty netstat, nothing on 1883.

Did a new mqtt container without webstation but with normal port settings:
image

When I start the container, it still immediately stops. This is the log:
image

@Daedaluz
Copy link
Contributor

now, how does your mosquitto config look like?

@Sir-Bacon
Copy link

Sir-Bacon commented Apr 23, 2024

persistence true
persistence_location /mosquitto/data
log_dest file /mosquitto/log/mosquitto.log
#password_file /mosquitto/config/pwfile
allow_anonymous true
listener 1883 192.168.2.31

@Daedaluz
Copy link
Contributor

Daedaluz commented Apr 23, 2024

Can you try the config file i provided previously?

192.168.2.31 is not available inside the container

@Sir-Bacon
Copy link

Yep, that worked! Thanks so much!
(Only little change I have is that allow_anonymous true is used)

@Daedaluz
Copy link
Contributor

just keep that one under the listener part.

@Sir-Bacon
Copy link

I did. Thanks again!

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

4 participants