The second state is changed by enable and disable. Here you can see where systemd keeps the list of services to start at boot.
At boot systemd brings the system to the target multi-user.target, a server's normal working state, and starts everything attached to it. The attached services are symbolic links in the multi-user.target.wants directory:
enable creates a link to the unit file there, and disable removes it; that is what they report: Created symlink … or Removed …. The Synchronizing state … SysV lines before that are housekeeping: Ubuntu also updates the old start scripts. The --now option adds a start to enable and a stop to disable; without it, both commands change autostart only.
For some units is-enabled prints static: their file does not say which target to attach to, and another unit or systemd itself starts them. systemd-journald is one of them; such units need no enabling.
cron is stopped and its autostart is off. You run sudo systemctl enable cron. What will systemctl is-active cron print?
-
enabledcomes fromis-enabled.is-activereports on running now, and cron is still stopped. -
enablewithout--nowonly creates the boot link. cron starts running afterstartor the next boot. -
failedis the mark of a failure. Nobody started cron; it is simply stopped.
enable created the link in multi-user.target.wants but did not start cron. cron starts running after sudo systemctl start cron or at the next boot.
Key points
-
enableputs a link to the unit intomulti-user.target.wants, anddisabletakes it away; systemd starts services at boot by these links. -
--nowadds a start toenableand a stop todisable.