7

I am getting the error systemctl: command not found in Ubuntu 16.04 server.
How can I fix it?

I'm trying to run:

sudo systemctl start openvpn@server 
Tim
  • 32,861
  • 27
  • 118
  • 178
Arn stn
  • 71
  • Doesn’t the command line tell you what package to install? Have you tried it? – Melebius Aug 30 '16 at 12:20
  • 1
    The executable should be located in /bin/systemctl and be able to run without specifying the full path. It is part of the systemd package which comes preinstalled with 16.04. Please show the output of apt policy systemd to verify you have the necessary package installed. Also show the output of ls -l /bin/systemd and echo $PATH please. – Byte Commander Aug 30 '16 at 12:40

1 Answers1

3

Unless removed after installation of 16.04, /bin/systemctl should be installed. It is part of the systemd package.

In Ubuntu 16.04, init is implemented as systemd. This replaces upstart by default, although a 16.04 system can be configured to use upstart.

Byte Commander is correct, but did not post his comment as the answer.

An important exception: If you upgraded from 14.04 to 16.04, then your system is still running upstart, not systemd and systemctl will not function as you're expecting in your question. I suspect this is the explanation for the problem you're having. If allowed to stand, the upgraded system will continue to develop problems when new software is added or updates are made by software that assumes systemd is used because the version number is 16.04, and all the other permutations of assumptions leading to errors that are possible. This is one case that argues for doing a clean install rather than upgrading if at all possible.

How can you tell if your system is running systemd or upstart as init?

# init --help

... and observe the output.

This article will help further, including instructions on switching between implementations of init: https://wiki.ubuntu.com/SystemdForUpstartUsers