No output from service start/stop/restart command

31,647

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

Share:
31,647

Related videos on Youtube

Eduardo Coria
Author by

Eduardo Coria

Updated on September 18, 2022

Comments

  • Eduardo Coria
    Eduardo Coria over 1 year

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

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

    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 ]
    
    • Admin
      Admin almost 8 years
      Did you take a look at the logs to see if there are any information that could help diagnose the problem? It should be in /var/log/
    • Admin
      Admin almost 8 years
      There is no problem with the service itself. It's the command prompt returning without output that baffles me. It happens with every service. The command does what is expected (start/stop/restart the service), but there is no output
  • bobpaul
    bobpaul over 5 years
    "You should not be expecting such output." is not a great place to start an answer. You're basically saying, "Your opinion is wrong". What you meant to say, I think, is "this is not possible with systemd". During the upstart days, Ubuntu DID output... it's in the question for "How do I get service command to print output in 15.10". Prior to 15.10, Ubuntu used upstart and upstart (like sysvinit) was verbose. So please don't say, "It's been like this for a decade". It hasn't. It changed in 15.10. Systemd is not verbose and that's been super irritating ever since distros started deploying it.
  • JdeBP
    JdeBP about 5 years
    The questioner quite clearly told you what xe was expecting, and the upstart output does not resemble that. You are confused, or did not read the question.