无法重新启动 postgresql.service:单元 postgresql.service 被屏蔽

Den*_*hov 6 postgresql

我该如何解决这个问题?(Ubuntu 16.04.1 LTS)

sudo service postgresql restart 
Failed to restart postgresql.service: Unit postgresql.service is masked.
Run Code Online (Sandbox Code Playgroud)

Bri*_*ore 6

Ubuntu 15.04 及更早版本使用 upstart。Upstart 使用该service命令来处理服务。从 16.04 开始,Ubuntu 正在使用 systemd。您使用的任何服务命令都会重新映射到systemctl命令。Systemd 提供比 upstart 更多的功能,包括屏蔽服务使其无法启动的能力。屏蔽服务(据我所知)本质上是将其符号链接到 /dev/null。您应该能够使用以下命令取消屏蔽并重新启动服务。

systemctl unmask postgresql
systemctl restart postgresql
Run Code Online (Sandbox Code Playgroud)