Tech Nuggets (15)

systemd-timedated を無効化する

Posted:

systemd-timedated を無効化するには systemctlmask コマンドを使う。

systemd-timedatedenable/disable できるものではない。 disable しようとすると以下のように表示される:

$ sudo systemctl disable systemd-timedated
The unit files have no installation config (WantedBy=, RequiredBy=, UpheldBy=,
Also=, or Alias= settings in the [Install] section, and DefaultInstance= for
template units). This means they are not meant to be enabled or disabled using
systemctl.

Possible reasons for having these kinds of units are:
• A unit may be statically enabled by being symlinked from another unit's
  .wants/, .requires/, or .upholds/ directory.
• A unit's purpose may be to act as a helper for some other unit which has
  a requirement dependency on it.
• A unit may be started when needed via activation (socket, path, timer,
  D-Bus, udev, scripted systemctl call, ...).
• In case of template units, the unit is meant to be enabled with some
  instance name specified.

こうしたサービスは systemctlmask/unmask コマンドを使うことで無効化/有効化することができる:

無効化
$ sudo systemctl mask systemd-timedated.service
Created symlink '/etc/systemd/system/systemd-timedated.service' → '/dev/null'.
有効化
$ sudo systemctl unmask systemd-timedated.service
Removed '/etc/systemd/system/systemd-timedated.service'.

出力にある通り、/dev/null へのシンボリックリンクを /etc/systemd/system に、ユニットと同じ名前で作成することで無効化している。