[Solved] Problem with mosquitto in raspbian

root@LightEASY-Server:~# mosquitto -v
1550205525: mosquitto version 1.4.10 (build date Wed, 06 Feb 2019 17:03:31 +0000) starting
1550205525: Using default config.
1550205525: Opening ipv4 listen socket on port 1883.
1550205525: Error: Address already in use

That error suggest there’s already something running on that port, probably another MQTT server.


sudo netstat -nlpt | grep 1883

That should give you something like this:

tcp        0      0  *               LISTEN      413/mosquitto       
tcp6       0      0 :::1883                 :::*                    LISTEN      413/mosquitto

The last column on the right will show you the process ID and name of the process.

Some of the distributions will offer to start mosquitto for you, and later OpenHAB has it built in. I don’t know if it’ll show as mosquitto or if it runs a built-in Java version.

Once you know what process it is, maybe you can tell where it came from.

You might also try:

sudo systemctl status mosquitto

That will tell you about a running service, or that it has no service with that name. If it’s listed as a running service, something has already set it up on that host for you.

thanks I go to try this solution and comment my result

That’s not right. The MQTT2 binding comes with a broker functionality but it’s not mosquitto.
So if you run openHAB >=2.4 with the mqtt binding it’ll use the same port that mosquitto would use but cannot.
openHABian on the other hand provides a mosquitto bundle.
@Ariel_Pena if you run on Raspi (I guess you do if you run Raspbian) you should consider moving to openHABian.
And please follow this on your next post

thanks yes the problem it is it eject two server with the same port , then if I stop the mosquitto services it work … how can mark it topic like solution to my problem

click the “solution” checkmark, it’s hidden behind the 3 dots

Here’s a Visual guide as well.