Ubuntu – No output from service start/stop/restart command

16.04command linerestartservices

I just installed Ubuntu 16.04 LTS and found that when I run

usr@server:~$ sudo service <servicename> restart

The service is restarted (I can see the status with service <servicename> status), but the shell goes directly back to the command line without the expected:

* Stopping <servicename>     [ OK ]
* Starting <servicename>     [ OK ]

Best Answer

You should not be expecting such output.

For starters, Ubuntu didn't behave this way in earlier versions. Ubuntu was an upstart system for just under a decade, and the behaviour of the service command on Ubuntu has for all those years not resembled what you are expecting. One can see the upstart behaviour of the service command in the image in How do I get service command to print output in 15.10? .

The answer is pretty much the same for you as for the people with Ubuntu version 15.10 last year:

You are using Ubuntu version 16.10, a systemd operating system. Your system service management is no longer performed by upstart (or whatever utility did it on whatever non-Ubuntu operating system you had before). It is performed by systemd.

The service command may be the same … but the Debian/Ubuntu service command is a shell script that tries to auto-detect whether upstart or systemd is the running system service manager, and run the actual native service management commands for upstart and systemd. It executes two pretty much entirely different code paths for upstart and for systemd.

upstart's native service management commands are initctl start, initctl stop, initctl status and so forth. Those print messages as they go.

systemd's native service management commands are systemctl start, systemctl stop, systemctl status and so forth. Those print no output as they operate.

Further reading

Related Question