How Systemd Is Different From SysVinit?

How Systemd Is Different From SysVinit?

What Is init?

In Unix or Unix based systems init is the first process that gets started during system boot. It is the parent process of all the processes that are running into the system. It automatically adopt all the process that get orphaned. init holds the process id 1. Once it gets started it continues running until the system is shutdown.


What is SystemV (SysV)?

Unix System V(five) is often abbreviated as SysV. It was one of the first commercial Unix OS developed by AT&T that was released in 1983. A new style of system startup configuration was used in Unix system v and therefore it was called SysVinit. Later it was used in various other Linux distributions. sysvinit is a traditional init system for Unix/Linux whose primary purpose is initializing, managing and tracking system services and daemons. Over the years several alternatives of traditional init system have been released to counter the design limitations.

Runlevels

A runlevel is the state of init process that can be used by the system to determine in which mode it has to operate. Each runlevel has a certain number of services stopped or started, these levels are identified by numbers. Generally, there are seven runlevels exist numbered from 0 to 6.

Init runlevelModeDescription
0Haltshuts down system
1Single-user modeDoes not configure network interface, start the daemon or allows non-root logins
2Multi-user mode with no NFS(network file system)Does not configure network interface or start the daemon
3Multi-user networking mode(command line)starts the system normally
4undefineduser-definable
5Multi-user mode (GUI)This is the standard runlevel for most of the Linux based system
6rebootreboots the system

Once Linux kernel gets booted, the init program reads the /etc/inittab file to determine the behavior for each runlevel. Many Linux distribution boot by default in runlevel 3 or 5. These are the standard runlevel that are discussed in this article, a new runlevel can be created or existing ones can be modified by a user according to the requirement.

Mostly used SysV service commands are

sudo service start service-name – the command will start the given service

for example-

sudo service start apache2 This command will start the apache server in the system using systemVinit.

sudo service stop service-name -this command is used to stop a service
sudo chkconfig service-name on -enable the service at boot,  for example – apache2 will start its services once the system boot completed.

sudo chkconfig – display a list of enabled or disabled services on boot with runlevels information
sudo chkconfig service-name off– disable the service at boot
sudo service service-name restart– this command will restart a given service
sudo service service-name status – Will display the status of an individual service
chkconfig example –list –  check if a service is configured to start on boot or not


What is Systemd in modern Linux system?

systemd is a newer init system. It includes various features like on-demand starting daemons, snapshot support, process tracking, and inhibitor locks, etc. It replaces Unix traditional system v and BSD init system and nowadays systemd is adopted by
a majority of Linux distributions. systemd is compatible with SysV and LSB init scripts.

What is systemctl?

systemctl is a utility that is responsible for controlling a widely adopted init system and service manager systemd.

Some commonly used systemctl service commands are

sudo systemctl start service-name -To start a service
sudo systemctl stop service-name -Use to stop a systemd service
sudo systemctl enable service-name -enable the service at boot,apache2 will start its services once the system boot completed.
sudo systemctl disable service-name– disable the service at boot
sudo systemctl restart service-name– this command will restart the apache2 services
sudo systemctl status service-name– Will display the status of individual service
systemctl is-enabled service-name – check if a service is configured to start on boot or not

Some other commands used in systemd are-

hostnamectl – Use to control the hostname, there are various options are available to use with this command
for example-
hostnamectl set-hostname --pretty new_hostname
teamdctl – The team daemon control tool, allows a user to interact with a running teamd instance.
timedatectl – Control the system time and date, It may be used to query and change the system clock and its settings
journalctl– Query the systemd journal
systemd-analyze or systemd-analyze time–  Check the system boot time
systemd-analyze blame– Check each service time consumption at startup
systemctl kill service-name– Kill all the processes associated with the given service
systemctl – List all running services
systemctl status – Shows system status

What are Systemd targets?

systemd targets are a similar concept to runlevels and also serves a similar purpose. But operates slightly differently. Each target named instead of numbers that are intended to serve a specific purpose. systemd targets are represented by target units which ends with .target file extension.

To explore more about systemd targets or if you are intended to working with system targets then you should visit Working with systemd targets. If you have to say something on the topic, please write us in the comments below.

Previous How To Setup FTP Server In Linux/Unix?

About author

You might also like

Linux Topics 0 Comments

How To Add/Remove New User In Linux/Unix

In this article, we will learn to add or remove users and giving them required permissions in Linux or Unix. As these operating systems are multi-user many users can have

Uncategorized 0 Comments

File Ownership And Permissions In Linux/Unix

Linux and Unix are multi-user operating systems that means different users can access the operating system at a time and can use system resources simultaneously. So the files created by

Linux Topics 0 Comments

How to Learn Linux Without Having a Linux Machine?

Wondering how to learn Linux without having a Linux PC with you?? Is it really possible or you’re just kidding me?? Trust me it’s all possible and you just need

0 Comments

No Comments Yet!

You can be first to comment this post!

Leave a Reply