6

I'm running Debian 8 x64 and still learning it. One of the confusing things I've come across repeatedly on Debian and Ubuntu systems is there appear to be two ways of running and managing services:

  • service
  • systemctl

I've read through the Debian page on systemd (systemctl) as well as questions such as How does systemd use /etc/init.d scripts?

From what I understand so far, many Linux distributions these days, including Debian and Ubuntu, are moving away from the old SysV (System Five) and embracing systemd.

I can see that my /sbin/init is a symbolic link to /lib/systemd/systemd.

The question is:

  • If systemd has replaced SysV, why is SysV (service) still there?
  • Why can I use both seemingly interchangeably? If I start a daemon in one, the other knows about it. How? Which one is running the show?
  • Is there any real reason to use service any more or should I just stick to systemctl?
6

The service command is a "compatibility" tool to help people migrate from sysvinit to systemd. It's a smart program that tries to work out your current init system and will call sysvinit, upstart or systemd calls as necessary.

Your question is a little "tell the future" in nature; today Debian allows different init systems to work and the service command will try and work it all out. But Debian 9? Who knows what that will support... We could end up with superinit to replace systemd, and the service command will be updated...

The problem is that this solution may not be cross-platform consistent; will service work with CentOS or SuSE? Will systemctl?

If I was writing my own stuff then I'd just stick with systemctl for all systemd based platforms, but have a massive test for all OS variants I support.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.