No output from service start/stop/restart command
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
- https://unix.stackexchange.com/a/233840/5132
- https://askubuntu.com/a/621209/43344
- https://askubuntu.com/a/613814/43344
- `service` no longer gives useful output (except with status) in 15.04?
Related videos on Youtube
Eduardo Coria
Updated on September 18, 2022Comments
-
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 almost 8 yearsDid 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 almost 8 yearsThere 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 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 about 5 yearsThe 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.