address already in use error in mosquitto

andro-girl picture andro-girl · May 13, 2015 · Viewed 22.8k times · Source

I have installed mosquitto server and client packages in my ubuntu machine. When I run command "mosquitto" to run the mosquitto server I am getting an error "Error:address already in use". Why am I getting this error? How can I resolve this?

Answer

tyler.frankenstein picture tyler.frankenstein · Oct 28, 2016

I ran into the same problem, and resolved the situation by killing the process that was running mosquitto. First, locate the mosquitto process id:

ps -ef | grep mosquitto

This should reveal to you any mosquitto related process. Say for example the process id was 12345, then you could kill it with this:

sudo kill 12345

After that the Error:address already in use message was gone and mosquitto was able to run properly again.