0

I am running the mosquitto broker on arch linux x64. I wanted to restart the mosquitto service by doing the following:

sudo systemctl mosquitto restart

But apparently I am prompted with

Unknown operation mosquitto.

How can I restart the mosquitto service correctly?

Kyu96
  • 173

1 Answers1

9

systemctl expects the command (start, restart, status etc.) before the unit (or units):

sudo systemctl restart mosquitto

You incorrectly used the same syntax for systemctl that you were using for service in the previous version of your question:

sudo service mosquitto restart

The reason that that did not work is that Arch Linux defaults to providing somewhat fewer compatibility and migration measures than other systemd operating systems. Debian Linux and Fedora, for example, come with a service command, compatible with the command of that name that they have had long before systemd, that invokes systemctl. You don't get such a command out of the box with Arch Linux, nor some of the "compat" parts of systemd itself (c.f. "Why does `init 0` result in "Excess Arguments" on Arch install?").

JdeBP
  • 68,745
Stephen Kitt
  • 434,908