30

I am converting a package from .rpm to .deb using this tutorial. However, to test and debug the application I need to run it. The programs readme explains to run it as a service with:

systemctl enable progname.service
systemctl start progname.service

What is the equivalent on ubuntu for these commands?

  • sudo service network-manager restart is what I was looking for when I found this. – Martin Thoma May 27 '16 at 10:58
  • As of 2018, Ubuntu does use the newer systemd systemctl (as does any system above Ubuntu 15.04, Debian 8, CentOS 7, Fedora 15...). The old /usr/sbin/service utility calls systemctl if/when the system is running systemd. – michael Jan 2 '18 at 5:01
12

Ubuntu is currently planning/developing to use systemd in the future. See following links for info: Vivid will switch to booting with systemd... and Release notes: Boot and service management

I am using 14.04.

You can use the more native command update-rc.d. Check the man page.

Enabling a service with defaults (see man page):

sudo update-rc.d foo_service defaults

Disabling a service:

sudo update-rc.d foo_service remove

Note that in order to remove without error message the foo_service file must not be present. However you can force:

sudo update-rc.d -f foo_service remove
5

systemctl is the control utility for systemd:

http://www.freedesktop.org/software/systemd/man/systemctl.html

Note that Ubuntu doesn't use systemd, it uses upstart, which does a few of the same things in principle, but has some different concepts.

Without much knowledge about systemd, and based on what I read in the document I posted, I think you don't need to "enable" a service. Just dropping the .conf file for your service in /etc/init should make upstart aware of it.

That's the crux of the matter, though: the systemd config file for your service won't work unmodified on Ubuntu, you have to "translate" that to an equivalent version for Upstart. Here's documentation for upstart:

http://upstart.ubuntu.com/cookbook/

Once you have a suitable upstart .conf file, you can start a service (equivalent, I think, to systemctl start) using:

start your-service
5

Default package on 14.04 is systemd-services that doesn't provides the systemdctl command.

Read

You must read the article How To Install And Test Systemd On Ubuntu 14.04 Trusty Tahr And Ubuntu 12.04 Precise Pangolin if you want to use systemd.

Pitti PPA

There is a PPA ppa:pitti/systemd that provide the adequate package for LTS 12.04, 14.04 and upcoming.

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.