SanshouSichimiYa

備忘録の為のブログ

Failed to start nginx.service: Unit nginx.service is masked.

単純なことなので先に解決方法

$ sudo systemctl unmask nginx
$ sudo systemctl start nginx

発生

nginxを起動しようとするとできない。

Failed to start nginx.service: Unit nginx.service is masked.

状況確認

$ sudo systemctl status nginx

f:id:sanshou-shichimi:20160901105051p:plain

Loaded: masked (/dev/null)とある。

mask?

maskとは。

「Systemd」を理解する ーシステム管理編ー

Systemdではmaskという操作を実行できる。mask操作を行う事で、サービスの起動自体不可能になる。systemctl(1)では、これはdisableの強化版だとの説明されている。

もうすこしググる

start nginx on boot with systemd

systemctl mask, systemctl unmask: disallows (allows) all and any attempts to start the unit in question (either manually or as a dependency of any other unit, including the dependencies of the default boot target). Note that marking for autostart in systemd is implemented by adding an artificial dependency from the default boot target to the unit in question, so "mask" also disallows autostarting.

unmask -> start

$ sudo systemctl unmask nginx
$ sudo systemctl status nginx

f:id:sanshou-shichimi:20160901105957p:plain

$ sudo systemctl start nginx
$ sudo systemctl status nginx

f:id:sanshou-shichimi:20160901110028p:plain