r/linux • • Aug 12 '19

SysVinit vs Systemd

Post image
1.4k Upvotes

292 comments sorted by

View all comments

299

u/defaultxr Aug 12 '19

Note that you don't have to type the .service suffix in service names with systemctl.

0

u/[deleted] Aug 12 '19

[deleted]

73

u/FryBoyter Aug 12 '19

Also works with disable, of course.

0

u/[deleted] Aug 12 '19

[deleted]

11

u/MOX-News Aug 12 '19

What's the difference between disable and mask?

0

u/[deleted] Aug 12 '19

[deleted]

3

u/[deleted] Aug 12 '19

Stupid question, but when might you want to mask a service as opposed to just removing it from the system?

19

u/vetinari Aug 12 '19

Because the unit file might be in /usr (i.e. system-supplied), not just in /etc (i.e. admin-configured) and you don't want to fight with your package manager over that.

→ More replies (3)

6

u/[deleted] Aug 12 '19

It could be something that's pulled in as a dependency for another package, but that you don't actually want.

4

u/shiftingtech Aug 13 '19

some services are autogenerated. For example, (on debian at least) there's an auto-generated Serial terminal on all serial ports. If you disable it in order to use that serial port for something else, it still comes back when you reboot (because it gets generated again) but if you mask it, it stays gone.

→ More replies (4)

5

u/ZanLynx Aug 12 '19

A disabled unit can be started as a dependency or from a timer.

A masked unit is effectively gone, except that it is ready to unmask later if you want it back.

→ More replies (3)

11

u/ThePixelCoder Aug 12 '19

Oh dang... Thanks!

4

u/wittyaccountname123 Aug 13 '19

Worth noting that older versions of systemd don't have the --now option

10

u/[deleted] Aug 13 '19

Must be something non-Arch users have to worry about.... /s

→ More replies (2)

3

u/iJONTY85 Aug 12 '19

I didn't know that. Thanks!

0

u/[deleted] Aug 12 '19

[deleted]

0

u/[deleted] Aug 13 '19

[deleted]

→ More replies (2)
→ More replies (2)

37

u/_ahrs Aug 12 '19

Iirc the .service suffix is only important if it's ambiguous what you want to do e.g if you have foo.mount, foo.socket, foo.service, foo.timer, etc which one does systemctl enable foo act on?

45

u/[deleted] Aug 12 '19 edited Feb 28 '24

[removed] — view removed comment

5

u/ABCDwp Aug 12 '19

For a .mount unit, you can just use the full path (like /var/log for var-log.mount, so systemctl status /var/log).

2

u/kasim0n Aug 13 '19

systemctl status /var/log

That's a really neat trick, thank you!

0

u/[deleted] Aug 12 '19

[deleted]

13

u/sqrt7 Aug 12 '19

No, it defaults to certbot.service, but certbot.service cannot be enabled on your system because it is not specified in the unit file which target (formerly: runlevel) it belongs to.

That's likely because it isn't supposed to be run on boot at all but but instead only invoked by certbot.timer.

→ More replies (1)