Question

systemctl not working on a fresh Ubuntu 18.04 build

Posted November 10, 2019 3.5k views
System Tools

fresh ubuntu 18.04 build
created new user and switched to that user
installed apache2, php, mysql, essentials using sudo apt-get

Works:
sudo /etc/init.d/apache2 restart
sudo systemctl status apache2

Does not Work:
sudo systemctl restart apache2
after I hit enter nothing is executed, just another standard line(user@server:~$)

Please advise. Thanks.

These answers are provided by our Community. If you find them useful, show some love by clicking the heart. If you run into issues leave a comment, or add your own answer to help others.

×
1 answer

Hello,

It is normal for the systemctl command not to provide you with any output after executing a restart command.

To check if the restart was successful, what you could do is run:

echo $?

This would provide you with the exit code of the previous command. If you get a 0 it means that it was successful, if you get 1 then something is wrong and you need to run the systemctl status command to get some more information.

Hope that this helps!
Regards,
Bobby

Submit an Answer