Detecting which system manager is running on Linux System

Objective

There are multiple system managers which can by possibly running on your Linux system. The current most common system managers are SysV (init), Systemd and Upstart. You may find this short guide to be of use to you, if you are unsure which, system manager is running on your Linux system.

Requirements

Privileged access to your Linux system is required.

Difficulty

EASY

Conventions

  • # – requires given linux commands to be executed with root privileges either directly as a root user or by use of sudo command
  • $ – requires given linux commands to be executed as a regular non-privileged user

Instructions

The system manager is a first process which start on your Linux system. Thus looking at what processes started first by using ps -p 1 command my provide some clues, but no definitive answers. Example:

SysV

# ps -p 1
  PID TTY          TIME CMD
    1 ?        00:00:01 init

Systemd

# ps -p 1
  PID TTY          TIME CMD
    1 ?        00:00:04 systemd

Upstart

# ps -p 1
  PID TTY          TIME CMD
    1 ?        00:00:01 init

First process symbolic link

More reliable approach to check which system manager is running on you Linux System is to check for a symbolic link pointing to an executable binary of the first system process.

SysV

# ls -l /proc/1/exe
lrwxrwxrwx 1 root root 0 Apr  3 04:17 /proc/1/exe -> /sbin/init
OR
# stat /proc/1/exe | grep File
  File: `/proc/1/exe' -> `/sbin/init'

Systemd

# ls -l /proc/1/exe
lrwxrwxrwx 1 root root 0 Mar 27 09:39 /proc/1/exe -> /lib/systemd/systemd
OR
# stat /proc/1/exe | grep File
  File: /proc/1/exe -> /lib/systemd/systemd

Upstart

# ls -l /proc/1/exe
lrwxrwxrwx 1 root root 0 Apr  3 04:29 /proc/1/exe -> /sbin/upstart
OR
# stat /proc/1/exe | grep File
  File: '/proc/1/exe' -> '/sbin/upstart'

Init symbolic link

Check to which system manager is executable /sbin/init pointing to:

SysV

# ls -l /sbin/init   
-rwxr-xr-x 1 root root 36992 Jul 14  2013 /sbin/init

Systemd

#  ls -l /sbin/init   
lrwxrwxrwx 1 root root 20 Feb 14 03:36 /sbin/init -> /lib/systemd/systemd

Upstart

# ls -l /sbin/init    
lrwxrwxrwx 1 root root 7 May 19  2016 /sbin/init -> upstart


Comments and Discussions
Linux Forum