eclipse / mosquitto

Eclipse Mosquitto - An open source MQTT broker
https://mosquitto.org
Other
8.94k stars 2.37k forks source link

restart mosquitto service failed. #1961

Open hya1711 opened 3 years ago

hya1711 commented 3 years ago
hya@hya-TianYi510Pro-18ICB:~$ sudo service mosquitto restart 
Job for mosquitto.service failed because the control process exited with error code. See "systemctl status mosquitto.service" and "journalctl -xe" for details.
hya@hya-TianYi510Pro-18ICB:~$ systemctl status mosquitto.service
● mosquitto.service - Mosquitto MQTT Broker
   Loaded: loaded (/lib/systemd/system/mosquitto.service; disabled; vendor preset: enabled)
   Active: failed (Result: start-limit-hit) since 四 2020-12-17 14:31:32 CST; 9s ago
     Docs: man:mosquitto.conf(5)
           man:mosquitto(8)
  Process: 4204 ExecStart=/usr/sbin/mosquitto -c /etc/mosquitto/mosquitto.conf (code=exited, status=1/FAILURE)
  Process: 4201 ExecStartPre=/bin/chown mosquitto: /var/log/mosquitto (code=exited, status=0/SUCCESS)
  Process: 4198 ExecStartPre=/bin/mkdir -m 740 -p /var/log/mosquitto (code=exited, status=0/SUCCESS)
 Main PID: 4204 (code=exited, status=1/FAILURE)

12月 17 14:31:31 hya-TianYi510Pro-18ICB systemd[1]: Failed to start Mosquitto MQTT Broker.
12月 17 14:31:31 hya-TianYi510Pro-18ICB systemd[1]: mosquitto.service: Unit entered failed state.
12月 17 14:31:31 hya-TianYi510Pro-18ICB systemd[1]: mosquitto.service: Failed with result 'exit-code'.
12月 17 14:31:32 hya-TianYi510Pro-18ICB systemd[1]: mosquitto.service: Service hold-off time over, scheduling restart.
12月 17 14:31:32 hya-TianYi510Pro-18ICB systemd[1]: Stopped Mosquitto MQTT Broker.
12月 17 14:31:32 hya-TianYi510Pro-18ICB systemd[1]: mosquitto.service: Start request repeated too quickly.
12月 17 14:31:32 hya-TianYi510Pro-18ICB systemd[1]: Failed to start Mosquitto MQTT Broker.
12月 17 14:31:32 hya-TianYi510Pro-18ICB systemd[1]: mosquitto.service: Unit entered failed state.
12月 17 14:31:32 hya-TianYi510Pro-18ICB systemd[1]: mosquitto.service: Failed with result 'start-limit-hit'.
hya@hya-TianYi510Pro-18ICB:~$ journalctl -xe
12月 17 14:31:31 hya-TianYi510Pro-18ICB systemd[1]: Starting Mosquitto MQTT Broker...
-- Subject: Unit mosquitto.service has begun start-up
-- Defined-By: systemd
-- Support: http://lists.freedesktop.org/mailman/listinfo/systemd-devel
-- 
-- Unit mosquitto.service has begun starting up.
12月 17 14:31:31 hya-TianYi510Pro-18ICB mosquitto[4196]: 1608186691: Error: Unable to write pid file.
12月 17 14:31:31 hya-TianYi510Pro-18ICB systemd[1]: mosquitto.service: Main process exited, code=exited, status=1/FAILURE
12月 17 14:31:31 hya-TianYi510Pro-18ICB systemd[1]: Failed to start Mosquitto MQTT Broker.
-- Subject: Unit mosquitto.service has failed
-- Defined-By: systemd
-- Support: http://lists.freedesktop.org/mailman/listinfo/systemd-devel
-- 
-- Unit mosquitto.service has failed.
-- 
-- The result is failed.
12月 17 14:31:31 hya-TianYi510Pro-18ICB systemd[1]: mosquitto.service: Unit entered failed state.
12月 17 14:31:31 hya-TianYi510Pro-18ICB systemd[1]: mosquitto.service: Failed with result 'exit-code'.
12月 17 14:31:31 hya-TianYi510Pro-18ICB systemd[1]: mosquitto.service: Service hold-off time over, scheduling restart.
12月 17 14:31:31 hya-TianYi510Pro-18ICB systemd[1]: Stopped Mosquitto MQTT Broker.
-- Subject: Unit mosquitto.service has finished shutting down
-- Defined-By: systemd
-- Support: http://lists.freedesktop.org/mailman/listinfo/systemd-devel
-- 
-- Unit mosquitto.service has finished shutting down.
12月 17 14:31:31 hya-TianYi510Pro-18ICB systemd[1]: Starting Mosquitto MQTT Broker...
-- Subject: Unit mosquitto.service has begun start-up
-- Defined-By: systemd
-- Support: http://lists.freedesktop.org/mailman/listinfo/systemd-devel
-- 
-- Unit mosquitto.service has begun starting up.
12月 17 14:31:31 hya-TianYi510Pro-18ICB mosquitto[4204]: 1608186691: Error: Unable to write pid file.
12月 17 14:31:31 hya-TianYi510Pro-18ICB systemd[1]: mosquitto.service: Main process exited, code=exited, status=1/FAILURE
12月 17 14:31:31 hya-TianYi510Pro-18ICB systemd[1]: Failed to start Mosquitto MQTT Broker.
-- Subject: Unit mosquitto.service has failed
-- Defined-By: systemd
-- Support: http://lists.freedesktop.org/mailman/listinfo/systemd-devel
-- 
-- Unit mosquitto.service has failed.
-- 
-- The result is failed.
12月 17 14:31:31 hya-TianYi510Pro-18ICB systemd[1]: mosquitto.service: Unit entered failed state.
12月 17 14:31:31 hya-TianYi510Pro-18ICB systemd[1]: mosquitto.service: Failed with result 'exit-code'.
12月 17 14:31:32 hya-TianYi510Pro-18ICB systemd[1]: mosquitto.service: Service hold-off time over, scheduling restart.
12月 17 14:31:32 hya-TianYi510Pro-18ICB systemd[1]: Stopped Mosquitto MQTT Broker.
-- Subject: Unit mosquitto.service has finished shutting down
-- Defined-By: systemd
-- Support: http://lists.freedesktop.org/mailman/listinfo/systemd-devel
-- 
-- Unit mosquitto.service has finished shutting down.
12月 17 14:31:32 hya-TianYi510Pro-18ICB systemd[1]: mosquitto.service: Start request repeated too quickly.
12月 17 14:31:32 hya-TianYi510Pro-18ICB systemd[1]: Failed to start Mosquitto MQTT Broker.
-- Subject: Unit mosquitto.service has failed
-- Defined-By: systemd
-- Support: http://lists.freedesktop.org/mailman/listinfo/systemd-devel
-- 
-- Unit mosquitto.service has failed.
-- 
-- The result is failed.
12月 17 14:31:32 hya-TianYi510Pro-18ICB systemd[1]: mosquitto.service: Unit entered failed state.
12月 17 14:31:32 hya-TianYi510Pro-18ICB systemd[1]: mosquitto.service: Failed with result 'start-limit-hit'.
hya@hya-TianYi510Pro-18ICB:~$ 
sectokia commented 3 years ago

Please run this command and post the output:

/usr/sbin/mosquitto -c /etc/mosquitto/mosquitto.conf -v

partofthething commented 3 years ago

I had a similar issue after my ubuntu install auto-updated to 2.0 and if I had to guess this would be because of the change in how letsencrypt certificates are accessed in 2.0. This is helpful: https://mosquitto.org/documentation/migrating-to-2-0/

chanddavid commented 2 years ago

just go on etc/mosquito file open terminal from that location sudo systemctl start mosquitto.service or sudo systemctl start mosquito sudo systemctl status mosquitto.service
this works for me and hope it works for you guys

jerrychong25 commented 1 year ago

sudo systemctl status mosquitto.service

Thanks for suggestion, unfortunately not working for my end.

Log Output:

peca@peca-OptiPlex-3050:/etc/mosquitto$ sudo systemctl start mosquitto.service
Job for mosquitto.service failed because the control process exited with error code.
See "systemctl status mosquitto.service" and "journalctl -xe" for details.
peca@peca-OptiPlex-3050:/etc/mosquitto$ sudo systemctl start mosquito
Failed to start mosquito.service: Unit mosquito.service not found.
peca@peca-OptiPlex-3050:/etc/mosquitto$ sudo systemctl status mosquitto.service
● mosquitto.service - Mosquitto MQTT Broker
     Loaded: loaded (/lib/systemd/system/mosquitto.service; enabled; vendor preset: enabled)
     Active: failed (Result: exit-code) since Mon 2023-01-16 00:47:44 +08; 21s ago
       Docs: man:mosquitto.conf(5)
             man:mosquitto(8)
    Process: 13255 ExecStartPre=/bin/mkdir -m 740 -p /var/log/mosquitto (code=exited, status=0/SUCCESS)
    Process: 13256 ExecStartPre=/bin/chown mosquitto:mosquitto /var/log/mosquitto (code=exited, status=0/SUCCESS)
    Process: 13257 ExecStartPre=/bin/mkdir -m 740 -p /run/mosquitto (code=exited, status=0/SUCCESS)
    Process: 13258 ExecStartPre=/bin/chown mosquitto:mosquitto /run/mosquitto (code=exited, status=0/SUCCESS)
    Process: 13259 ExecStart=/usr/sbin/mosquitto -c /etc/mosquitto/mosquitto.conf (code=exited, status=1/FAILURE)
   Main PID: 13259 (code=exited, status=1/FAILURE)

Jan 16 00:47:44 peca-OptiPlex-3050 systemd[1]: mosquitto.service: Scheduled restart job, restart counter is at 5.
Jan 16 00:47:44 peca-OptiPlex-3050 systemd[1]: Stopped Mosquitto MQTT Broker.
Jan 16 00:47:44 peca-OptiPlex-3050 systemd[1]: mosquitto.service: Start request repeated too quickly.
Jan 16 00:47:44 peca-OptiPlex-3050 systemd[1]: mosquitto.service: Failed with result 'exit-code'.
Jan 16 00:47:44 peca-OptiPlex-3050 systemd[1]: Failed to start Mosquitto MQTT Broker.

Screenshot: image

Jai123-Jai commented 1 year ago

sudo systemctl status mosquitto.service

Thanks for suggestion, unfortunately not working for my end.

Log Output:

peca@peca-OptiPlex-3050:/etc/mosquitto$ sudo systemctl start mosquitto.service
Job for mosquitto.service failed because the control process exited with error code.
See "systemctl status mosquitto.service" and "journalctl -xe" for details.
peca@peca-OptiPlex-3050:/etc/mosquitto$ sudo systemctl start mosquito
Failed to start mosquito.service: Unit mosquito.service not found.
peca@peca-OptiPlex-3050:/etc/mosquitto$ sudo systemctl status mosquitto.service
● mosquitto.service - Mosquitto MQTT Broker
     Loaded: loaded (/lib/systemd/system/mosquitto.service; enabled; vendor preset: enabled)
     Active: failed (Result: exit-code) since Mon 2023-01-16 00:47:44 +08; 21s ago
       Docs: man:mosquitto.conf(5)
             man:mosquitto(8)
    Process: 13255 ExecStartPre=/bin/mkdir -m 740 -p /var/log/mosquitto (code=exited, status=0/SUCCESS)
    Process: 13256 ExecStartPre=/bin/chown mosquitto:mosquitto /var/log/mosquitto (code=exited, status=0/SUCCESS)
    Process: 13257 ExecStartPre=/bin/mkdir -m 740 -p /run/mosquitto (code=exited, status=0/SUCCESS)
    Process: 13258 ExecStartPre=/bin/chown mosquitto:mosquitto /run/mosquitto (code=exited, status=0/SUCCESS)
    Process: 13259 ExecStart=/usr/sbin/mosquitto -c /etc/mosquitto/mosquitto.conf (code=exited, status=1/FAILURE)
   Main PID: 13259 (code=exited, status=1/FAILURE)

Jan 16 00:47:44 peca-OptiPlex-3050 systemd[1]: mosquitto.service: Scheduled restart job, restart counter is at 5.
Jan 16 00:47:44 peca-OptiPlex-3050 systemd[1]: Stopped Mosquitto MQTT Broker.
Jan 16 00:47:44 peca-OptiPlex-3050 systemd[1]: mosquitto.service: Start request repeated too quickly.
Jan 16 00:47:44 peca-OptiPlex-3050 systemd[1]: mosquitto.service: Failed with result 'exit-code'.
Jan 16 00:47:44 peca-OptiPlex-3050 systemd[1]: Failed to start Mosquitto MQTT Broker.

Screenshot: image

Hi Guys, I too face this same Issue can anyone help on this.

RicGarCre commented 1 year ago

Me ocurre exactamente lo mismo que a "jai123-jai". Existe alguna solución?

Gracias.

jerrychong25 commented 1 year ago

sudo systemctl status mosquitto.service

Thanks for suggestion, unfortunately not working for my end. Log Output:

peca@peca-OptiPlex-3050:/etc/mosquitto$ sudo systemctl start mosquitto.service
Job for mosquitto.service failed because the control process exited with error code.
See "systemctl status mosquitto.service" and "journalctl -xe" for details.
peca@peca-OptiPlex-3050:/etc/mosquitto$ sudo systemctl start mosquito
Failed to start mosquito.service: Unit mosquito.service not found.
peca@peca-OptiPlex-3050:/etc/mosquitto$ sudo systemctl status mosquitto.service
● mosquitto.service - Mosquitto MQTT Broker
     Loaded: loaded (/lib/systemd/system/mosquitto.service; enabled; vendor preset: enabled)
     Active: failed (Result: exit-code) since Mon 2023-01-16 00:47:44 +08; 21s ago
       Docs: man:mosquitto.conf(5)
             man:mosquitto(8)
    Process: 13255 ExecStartPre=/bin/mkdir -m 740 -p /var/log/mosquitto (code=exited, status=0/SUCCESS)
    Process: 13256 ExecStartPre=/bin/chown mosquitto:mosquitto /var/log/mosquitto (code=exited, status=0/SUCCESS)
    Process: 13257 ExecStartPre=/bin/mkdir -m 740 -p /run/mosquitto (code=exited, status=0/SUCCESS)
    Process: 13258 ExecStartPre=/bin/chown mosquitto:mosquitto /run/mosquitto (code=exited, status=0/SUCCESS)
    Process: 13259 ExecStart=/usr/sbin/mosquitto -c /etc/mosquitto/mosquitto.conf (code=exited, status=1/FAILURE)
   Main PID: 13259 (code=exited, status=1/FAILURE)

Jan 16 00:47:44 peca-OptiPlex-3050 systemd[1]: mosquitto.service: Scheduled restart job, restart counter is at 5.
Jan 16 00:47:44 peca-OptiPlex-3050 systemd[1]: Stopped Mosquitto MQTT Broker.
Jan 16 00:47:44 peca-OptiPlex-3050 systemd[1]: mosquitto.service: Start request repeated too quickly.
Jan 16 00:47:44 peca-OptiPlex-3050 systemd[1]: mosquitto.service: Failed with result 'exit-code'.
Jan 16 00:47:44 peca-OptiPlex-3050 systemd[1]: Failed to start Mosquitto MQTT Broker.

Screenshot: image

Hi Guys, I too face this same Issue can anyone help on this.

Hi @Jai123-Jai ,

I sovled my case by deleting extra .conf files under /etc/mosquitto/ folder.

Not sure if that works for your case.

Thanks.

Electroscience commented 1 year ago

sudo systemctl status mosquitto.service

Thanks for suggestion, unfortunately not working for my end. Log Output:

peca@peca-OptiPlex-3050:/etc/mosquitto$ sudo systemctl start mosquitto.service
Job for mosquitto.service failed because the control process exited with error code.
See "systemctl status mosquitto.service" and "journalctl -xe" for details.
peca@peca-OptiPlex-3050:/etc/mosquitto$ sudo systemctl start mosquito
Failed to start mosquito.service: Unit mosquito.service not found.
peca@peca-OptiPlex-3050:/etc/mosquitto$ sudo systemctl status mosquitto.service
● mosquitto.service - Mosquitto MQTT Broker
     Loaded: loaded (/lib/systemd/system/mosquitto.service; enabled; vendor preset: enabled)
     Active: failed (Result: exit-code) since Mon 2023-01-16 00:47:44 +08; 21s ago
       Docs: man:mosquitto.conf(5)
             man:mosquitto(8)
    Process: 13255 ExecStartPre=/bin/mkdir -m 740 -p /var/log/mosquitto (code=exited, status=0/SUCCESS)
    Process: 13256 ExecStartPre=/bin/chown mosquitto:mosquitto /var/log/mosquitto (code=exited, status=0/SUCCESS)
    Process: 13257 ExecStartPre=/bin/mkdir -m 740 -p /run/mosquitto (code=exited, status=0/SUCCESS)
    Process: 13258 ExecStartPre=/bin/chown mosquitto:mosquitto /run/mosquitto (code=exited, status=0/SUCCESS)
    Process: 13259 ExecStart=/usr/sbin/mosquitto -c /etc/mosquitto/mosquitto.conf (code=exited, status=1/FAILURE)
   Main PID: 13259 (code=exited, status=1/FAILURE)

Jan 16 00:47:44 peca-OptiPlex-3050 systemd[1]: mosquitto.service: Scheduled restart job, restart counter is at 5.
Jan 16 00:47:44 peca-OptiPlex-3050 systemd[1]: Stopped Mosquitto MQTT Broker.
Jan 16 00:47:44 peca-OptiPlex-3050 systemd[1]: mosquitto.service: Start request repeated too quickly.
Jan 16 00:47:44 peca-OptiPlex-3050 systemd[1]: mosquitto.service: Failed with result 'exit-code'.
Jan 16 00:47:44 peca-OptiPlex-3050 systemd[1]: Failed to start Mosquitto MQTT Broker.

Screenshot: image

Hi Guys, I too face this same Issue can anyone help on this.

sensir233 commented 1 year ago

image I open another terminal, log in with the same identity, and use systemctl status mosquitto to view the status, and the same situation occurs. At this time, I use ststemctl start mosquitto to display the error of Jop for mosquitto.service failed beacuse... image At this time, I use ps -aux |grep mosquitto to find the corresponding PID value, kill it, and re-enter systemctl start mosquitto to start normally image

Bobo-bug-lab commented 1 year ago

If another process is using the default MQTT port for Mosquitto (typically 1883), the Mosquitto service will fail to start. Try editing the "mosquitto.conf" sudo nano mosquitto.conf If "listener 1883" exists, try change it to other ports and save.

In my case I deployed Azure iot on my devices so there were ports conflits

shubhamnodered commented 6 months ago

How did i solve it in my case!!!!

Problem: image

mosquitto.conf file: image

Steps, i took:

  1. I started with first checking the log file [/var/log/mosquitto/mosquitto.log] using winscp software text editor. Here, i found "server.key" file is creating problem resulting in permission denied [permission error] image

  2. To resolve it, i checked server.key file permission using ls -l command. It was not the issue: image

  3. Next i used, chown command to check and change ownership image

  4. Next i visited mosquitto.conf file to cross-check for server.key path and deleted any extra lines and spaces after server.key path.

  5. Once done, i saved the mosquitto.conf file and restarted mosquitto. To my wonder it worked this time and mosquitto successfully restarted. image

  6. I checked for the mosquitto status: image

Regretfully, i failed during the testing. So, any help would be appreciated. [I am attaching the error and log file] image

image

Peace - Shubham [India]

shubhamnodered commented 6 months ago

I also would like to point towards this website: http://maulwuff.de/research/ssl-debugging.html.

At current, its above my pay grade. But it can be useful for you guys.

image