service command not found

In this troubleshooting guide we learn how to fix service command not found error message

Introduction

When you run more command in linux terminal / console, you get the following error message

service: command not found

or when using sudo you get the following error message

sudo: service: command not found

Solutions to service: command not found

How To Fix service: command not found in Ubuntu / Debian / Kali Linux / Raspbian

In Ubuntu service is provided by init-system-helpers package.

init-system-helpers is:

This package contains helper tools that are necessary for switching between the various init systems that Debian contains (e. g. sysvinit or systemd). An example is deb-systemd-helper, a script that enables systemd unit files without depending on a running systemd.

It also includes the “service”, “invoke-rc.d”, and “update-rc.d” scripts which provide an abstraction for enabling, disabling, starting, and stopping services for all supported Debian init systems as specified by the policy.

While this package is maintained by pkg-systemd-maintainers, it is NOT specific to systemd at all. Maintainers of other init systems are welcome to include their helpers in this package.

To fix this problem, we can install more using the command below.

sudo apt-get -y install init-system-helpers

This command might take some time to finish depending on your machine internet connection.

You can also use apt command to install init-system-helpers.

sudo apt -y install init-system-helpers

Or if you have aptitude installed you can use the following command.

sudo aptitude install init-system-helpers

Summary

In this tutorial we learn how to fix service command not found error in Ubuntu / Debian / Kali Linux or Raspbian distribution.