How can I solve this? (Ubuntu 16.04.1 LTS)

sudo service postgresql restart 
Failed to restart postgresql.service: Unit postgresql.service is masked.
  • Did this fix your problem? Jul 21, 2016 at 15:16
  • I solved the problem by "apt-get install". Although I get from answer a more elegant way to fix it Thanks! Jul 21, 2016 at 16:09

2 Answers 2


Ubuntu 15.04 and earlier used upstart. Upstart uses the service command to handle services. As of 16.04 Ubuntu is using systemd. Any service commands you use get remapped to systemctl commands. Systemd provides more functionality than upstart, including the ability to mask a service so that it cannot be started. Masking a service (from what I understand) essentially symlinks it to /dev/null. You should be able to unmask and restart the service with the following commands.

systemctl unmask postgresql
systemctl restart postgresql
  • If postgresql does not work try using postgresql.service Jul 20, 2016 at 15:09

if you are using Docker. then make sure the container is running. do that by typing Docker ps. if the container is missing but appears in Docker ps -a then just use Docker start

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.