{"id":12797,"date":"2019-03-28T20:38:19","date_gmt":"2019-03-28T20:38:19","guid":{"rendered":"http:\/\/www.appservgrid.com\/paw92\/?p=12797"},"modified":"2019-03-28T20:38:19","modified_gmt":"2019-03-28T20:38:19","slug":"the-story-behind-init-and-systemd-why-init-needed-to-be-replaced-with-systemd-in-linux","status":"publish","type":"post","link":"https:\/\/www.appservgrid.com\/paw92\/index.php\/2019\/03\/28\/the-story-behind-init-and-systemd-why-init-needed-to-be-replaced-with-systemd-in-linux\/","title":{"rendered":"The Story Behind \u2018init\u2019 and \u2018systemd\u2019: Why \u2018init\u2019 Needed to be Replaced with \u2018systemd\u2019 in Linux"},"content":{"rendered":"<p>I am subscribed to several mailing lists related to various Linux Distributions and Applications just to keep myself updated with what\u2019s going on where. What are the new bugs? What are the Patches Released? What is expected in next release? and a whole lot of other stuffs. These days the mailing list is heavily populated with \u201cChoose your side on Linux Divide\u201d, mainly on Debian Mailing list along with a few other.<\/p>\n<div id=\"attachment_8649\" class=\"wp-caption aligncenter\">\n<p><a href=\"https:\/\/www.tecmint.com\/wp-content\/uploads\/2014\/09\/systemd.png\"><img loading=\"lazy\" decoding=\"async\" class=\"size-full wp-image-8649\" src=\"https:\/\/www.tecmint.com\/wp-content\/uploads\/2014\/09\/systemd.png\" alt=\"Linux Systemd\" width=\"600\" height=\"400\" aria-describedby=\"caption-attachment-8649\" data-lazy-loaded=\"true\" \/><\/a><\/p>\n<p id=\"caption-attachment-8649\" class=\"wp-caption-text\">systemd replaces init<\/p>\n<\/div>\n<h6>What \u201cChoose your side on Linux Divide\u201d is all about?<\/h6>\n<p>The\u00a0<b>init<\/b>\u00a0daemon is going to be replaced with daemon\u00a0<b>systemd<\/b>\u00a0on some of the Linux Distributions, while a lot of them have already implemented it. This is\/will be creating a huge gap between traditional Unix\/Linux Guard and New Linux Guard \u2013 programmers and System Admins.<\/p>\n<p>In this article, we will discuss and solve following all queries one-by-one.<\/p>\n<ol>\n<li>What init is?<\/li>\n<li>What is systemd?<\/li>\n<li>Why init needed to be replaced?<\/li>\n<li>What features systemd will own.<\/li>\n<\/ol>\n<h4>What is init?<\/h4>\n<p>In Linux,\u00a0<b>init<\/b>\u00a0is a abbreviation for Initialization. The\u00a0<b>init<\/b>\u00a0is a daemon process which starts as soon as the computer starts and continue running till, it is shutdown. In-fact init is the first process that starts when a computer boots, making it the parent of all other running processes directly or indirectly and hence typically it is assigned \u201c<b>pid=1<\/b>\u201c.<\/p>\n<p>If somehow\u00a0<b>init<\/b>\u00a0daemon could not start, no process will be started and the system will reach a stage called \u201c<b>Kernel Panic<\/b>\u201c. init is most commonly referred to as\u00a0<b>System V init<\/b>. System V is the first commercial UNIX Operating System designed and usages of init on most of the Linux Distribution of today is identical with\u00a0<b>System V OS<\/b>\u00a0with a few exception like Slackware using BSD-style and Gentoo using custom init.<\/p>\n<p>The need to replace init with something more perfect was felt from a long time and several alternatives were developed from time-to-time, some of which became distribution\u2019s native init replacement, some of which are:<\/p>\n<ol>\n<li><b>Upstart<\/b>\u00a0\u2013 A init replacement daemon implemented in Ubuntu GNU\/Linux and designed to start process asynchronously.<\/li>\n<li><b>Epoch<\/b>\u00a0\u2013 A init replacement daemon built around simplicity and service management, designed to start process single-threaded.<\/li>\n<li><b>Mudar<\/b>\u00a0\u2013 A init replacement daemon written in Python, implemented on Pardus GNU\/Linux and designed to start process asynchronously.<\/li>\n<li><b>systemd<\/b>\u00a0\u2013 A init replacement daemon designed to start process in parallel, implemented in a number of standard distribution \u2013 Fedora, OpenSuSE, Arch, RHEL, CentOS, etc.<\/li>\n<\/ol>\n<h4>What is systemd?<\/h4>\n<p>A\u00a0<b>systemd<\/b>\u00a0is a System Management Daemon named with UNIX convention to add \u2018<b>d<\/b>\u2018 at the end of daemon. So, that they can be easily recognized. Initially it was released under GNU General Public License, but now the releases are made under GNU Lesser General Public License. Similar to init, systemd is the parent of all other processes directly or indirectly and is the first process that starts at boot hence typically assigned a \u201c<b>pid=1<\/b>\u201c.<\/p>\n<p>A\u00a0<b>systemd<\/b>, may refer to all the packages, utilities and libraries around daemon. It was designed to overcome the shortcomings of init. It itself is a background processes which is designed to start processes in parallel, thus reducing the boot time and computational overhead. It has a lot other features as compared to init.<\/p>\n<h4>Why there was a need to replace init?<\/h4>\n<p>A init process starts serially i.e., one task starts only after the last task startup was successful and it was loaded in the memory. This often resulted into delayed and long booting time. However, systemd was not designed for speed but for getting the things done neatly which in turns avoid all the UN-necessary delay.<\/p>\n<h5>Features of systemd<\/h5>\n<ol>\n<li>Clean, stateforward and efficient design.<\/li>\n<li>Simpler boot process.<\/li>\n<li>Concurrent and parallel processing at boot.<\/li>\n<li>Better API.<\/li>\n<li>Simple Unit Syntax.<\/li>\n<li>Ability to remove optional components.<\/li>\n<li>Low memory footprints.<\/li>\n<li>Improved technique to express dependencies.<\/li>\n<li>Initialization instruction written in config file and not in shell script.<\/li>\n<li>Make use of Unix Domain Socket.<\/li>\n<li>Job Scheduling using systemd Calendar Timers.<\/li>\n<li>Event Logging with journald.<\/li>\n<li>Choice of logging System events with systemd as well as syslog.<\/li>\n<li>Logs are stored in binary file.<\/li>\n<li>systemd state can be preserved to be called later in future.<\/li>\n<li>Track process using kernel\u2019s cgroup and not PID.<\/li>\n<li>Users login managed by systemd-logind.<\/li>\n<li>Better integration with Gnome for interoperability.<\/li>\n<\/ol>\n<h5>Bottlenecks systemd<\/h5>\n<ol>\n<li>Everything at one place.<\/li>\n<li>Not POSIX standard.<\/li>\n<\/ol>\n<h4>Systemd and Distro Integration<\/h4>\n<table border=\"0\" cellspacing=\"0\">\n<tbody>\n<tr>\n<td align=\"CENTER\" height=\"19\"><b>Linux Distribution<\/b><\/td>\n<td align=\"CENTER\"><b>Integration<\/b><\/td>\n<\/tr>\n<tr class=\"alt\">\n<td align=\"LEFT\" height=\"19\">Fedora<\/td>\n<td align=\"LEFT\">Yes, first distro to adopt systemd<\/td>\n<\/tr>\n<tr>\n<td align=\"LEFT\" height=\"16\">Arch<\/td>\n<td align=\"LEFT\">Yes<\/td>\n<\/tr>\n<tr class=\"alt\">\n<td align=\"LEFT\" height=\"19\">RedHat<\/td>\n<td align=\"LEFT\">Yes<\/td>\n<\/tr>\n<tr>\n<td align=\"LEFT\" height=\"19\">CentOS<\/td>\n<td align=\"LEFT\">Yes<\/td>\n<\/tr>\n<tr class=\"alt\">\n<td align=\"LEFT\" height=\"19\">Debian<\/td>\n<td align=\"LEFT\">Yes, Debian 8 codename Jessie will have systemd by default<\/td>\n<\/tr>\n<tr>\n<td align=\"LEFT\" height=\"19\">Gentoo<\/td>\n<td align=\"LEFT\">Yes, but needs to be downloaded, installed and configure side with custom init<\/td>\n<\/tr>\n<tr class=\"alt\">\n<td align=\"LEFT\" height=\"19\">OpenSUSE<\/td>\n<td align=\"LEFT\">Yes<\/td>\n<\/tr>\n<tr>\n<td align=\"LEFT\" height=\"19\">Slack<\/td>\n<td align=\"LEFT\">No (Though it has not been adopted till now in slackware, Patric Volkerding has not shown any indication if it will be adopted or not)<\/td>\n<\/tr>\n<tr class=\"alt\">\n<td align=\"LEFT\" height=\"16\">Ubuntu<\/td>\n<td align=\"LEFT\">Yes, needs to be installed and configured with Upstream.<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<h5>Controversy<\/h5>\n<p>Linus Torvalds, Chief architect of Linux kernel, feels attitude of key developer of systemd towards users and bug reports do not seems ok. It was also reported that systemd philosophy is weird and a foreign way to control system processes. The same has been recorded from Patric Volkerding and other notable Linux Users and Developers as well as over online forum, time-to-time.<\/p>\n<h4>systemd vs init<\/h4>\n<table border=\"0\" cellspacing=\"0\">\n<tbody>\n<tr>\n<td align=\"CENTER\" height=\"21\"><b>Features<\/b><\/td>\n<td align=\"CENTER\"><b>init<\/b><\/td>\n<td align=\"CENTER\"><b>systemd<\/b><\/td>\n<\/tr>\n<tr class=\"alt\">\n<td align=\"LEFT\" height=\"21\">DBus Dependency \u2013 Mandatory<\/td>\n<td align=\"LEFT\">No<\/td>\n<td align=\"LEFT\">Yes<\/td>\n<\/tr>\n<tr>\n<td align=\"LEFT\" height=\"19\">Device based Activation<\/td>\n<td align=\"LEFT\">No<\/td>\n<td align=\"LEFT\">Yes<\/td>\n<\/tr>\n<tr class=\"alt\">\n<td align=\"LEFT\" height=\"21\">Device dependency configuration with udev<\/td>\n<td align=\"LEFT\">No<\/td>\n<td align=\"LEFT\">Yes<\/td>\n<\/tr>\n<tr>\n<td align=\"LEFT\" height=\"21\">Timer based Activation<\/td>\n<td align=\"LEFT\">Cron\/at<\/td>\n<td align=\"LEFT\">Proprietary<\/td>\n<\/tr>\n<tr class=\"alt\">\n<td align=\"LEFT\" height=\"19\">Quota Management<\/td>\n<td align=\"LEFT\">No<\/td>\n<td align=\"LEFT\">Yes<\/td>\n<\/tr>\n<tr>\n<td align=\"LEFT\" height=\"19\">Automatic Service Dependency Handling<\/td>\n<td align=\"LEFT\">No<\/td>\n<td align=\"LEFT\">Yes<\/td>\n<\/tr>\n<tr class=\"alt\">\n<td align=\"LEFT\" height=\"19\">Kills users Process at logout<\/td>\n<td align=\"LEFT\">No<\/td>\n<td align=\"LEFT\">Yes<\/td>\n<\/tr>\n<tr>\n<td align=\"LEFT\" height=\"19\">Swap Management<\/td>\n<td align=\"LEFT\">No<\/td>\n<td align=\"LEFT\">Yes<\/td>\n<\/tr>\n<tr class=\"alt\">\n<td align=\"LEFT\" height=\"21\">SELinux integration<\/td>\n<td align=\"LEFT\">No<\/td>\n<td align=\"LEFT\">Yes<\/td>\n<\/tr>\n<tr>\n<td align=\"LEFT\" height=\"19\">Support for Encrypted HDD<\/td>\n<td align=\"LEFT\">No<\/td>\n<td align=\"LEFT\">Yes<\/td>\n<\/tr>\n<tr class=\"alt\">\n<td align=\"LEFT\" height=\"21\">Static kernle module loading<\/td>\n<td align=\"LEFT\">No<\/td>\n<td align=\"LEFT\">Yes<\/td>\n<\/tr>\n<tr>\n<td align=\"LEFT\" height=\"19\">GUI<\/td>\n<td align=\"LEFT\">No<\/td>\n<td align=\"LEFT\">Yes<\/td>\n<\/tr>\n<tr class=\"alt\">\n<td align=\"LEFT\" height=\"19\">List all the child processes<\/td>\n<td align=\"LEFT\">No<\/td>\n<td align=\"LEFT\">Yes<\/td>\n<\/tr>\n<tr>\n<td align=\"LEFT\" height=\"21\">Sysv compatible<\/td>\n<td align=\"LEFT\">Yes<\/td>\n<td align=\"LEFT\">Yes<\/td>\n<\/tr>\n<tr class=\"alt\">\n<td align=\"LEFT\" height=\"19\">Interactive booting<\/td>\n<td align=\"LEFT\">No<\/td>\n<td align=\"LEFT\">Yes<\/td>\n<\/tr>\n<tr>\n<td align=\"LEFT\" height=\"19\">Portable to non x86<\/td>\n<td align=\"LEFT\">Yes<\/td>\n<td align=\"LEFT\">No<\/td>\n<\/tr>\n<tr class=\"alt\">\n<td align=\"LEFT\" height=\"21\">Adopted on<\/td>\n<td align=\"LEFT\">Several Distro<\/td>\n<td align=\"LEFT\">Several Distro<\/td>\n<\/tr>\n<tr>\n<td align=\"LEFT\" height=\"19\">Parallel service startup<\/td>\n<td align=\"LEFT\">No<\/td>\n<td align=\"LEFT\">Yes<\/td>\n<\/tr>\n<tr class=\"alt\">\n<td align=\"LEFT\" height=\"19\">Resource limit per service<\/td>\n<td align=\"LEFT\">No<\/td>\n<td align=\"LEFT\">Yes<\/td>\n<\/tr>\n<tr>\n<td align=\"LEFT\" height=\"19\">Easy extensible startup script<\/td>\n<td align=\"LEFT\">Yes<\/td>\n<td align=\"LEFT\">No<\/td>\n<\/tr>\n<tr class=\"alt\">\n<td align=\"LEFT\" height=\"19\">Separate Code and Configuration File<\/td>\n<td align=\"LEFT\">Yes<\/td>\n<td align=\"LEFT\">No<\/td>\n<\/tr>\n<tr>\n<td align=\"LEFT\" height=\"19\">Automatic dependency calculation<\/td>\n<td align=\"LEFT\">No<\/td>\n<td align=\"LEFT\">Yes<\/td>\n<\/tr>\n<tr class=\"alt\">\n<td align=\"LEFT\" height=\"19\">Verbose debug<\/td>\n<td align=\"LEFT\">Yes<\/td>\n<td align=\"LEFT\">No<\/td>\n<\/tr>\n<tr>\n<td align=\"LEFT\" height=\"19\">Version<\/td>\n<td align=\"LEFT\">N\/A<\/td>\n<td align=\"LEFT\">V44+<\/td>\n<\/tr>\n<tr class=\"alt\">\n<td align=\"LEFT\" height=\"19\">Size<\/td>\n<td align=\"LEFT\">560 KB<\/td>\n<td align=\"LEFT\">N\/A<\/td>\n<\/tr>\n<tr>\n<td align=\"LEFT\" height=\"21\">Number of Files<\/td>\n<td align=\"LEFT\">75 files<\/td>\n<td align=\"LEFT\">900 files + glib + DBus<\/td>\n<\/tr>\n<tr class=\"alt\">\n<td align=\"LEFT\" height=\"21\">Lines of code \u2013 LOC<\/td>\n<td align=\"LEFT\">15000 (Approx)<\/td>\n<td align=\"LEFT\">224000 (Approx) (inc Codes, comments and white space) 125000 (Approx) (acctual code)<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<h4>Conclusion<\/h4>\n<p>Anything running as pid=1 must not break, must not be mess and must be controlled by users effectively and efficiently. Many-a-user believes that replacing init for systemd is nothing more than reinventing the wheel everytime as a side effect of Linux. But this is the diverse nature of Linux. This is because Linux is that much powerful. Change is good and we must appreciate it if it is for a good reason.<\/p>\n<p>That\u2019s all for now. I\u2019ll be here again with another Interesting article you people will love to read. Till then stay tuned and connected to Tecmint. Don\u2019t forget to provide us with your valuable feedback in the comments below.<\/p>\n<p><a href=\"https:\/\/www.tecmint.com\/systemd-replaces-init-in-linux\/\" target=\"_blank\" rel=\"noopener\">Source<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<p>I am subscribed to several mailing lists related to various Linux Distributions and Applications just to keep myself updated with what\u2019s going on where. What are the new bugs? What are the Patches Released? What is expected in next release? and a whole lot of other stuffs. These days the mailing list is heavily populated &hellip; <\/p>\n<p class=\"link-more\"><a href=\"https:\/\/www.appservgrid.com\/paw92\/index.php\/2019\/03\/28\/the-story-behind-init-and-systemd-why-init-needed-to-be-replaced-with-systemd-in-linux\/\" class=\"more-link\">Continue reading<span class=\"screen-reader-text\"> &#8220;The Story Behind \u2018init\u2019 and \u2018systemd\u2019: Why \u2018init\u2019 Needed to be Replaced with \u2018systemd\u2019 in Linux&#8221;<\/span><\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1],"tags":[],"class_list":["post-12797","post","type-post","status-publish","format-standard","hentry","category-linux"],"_links":{"self":[{"href":"https:\/\/www.appservgrid.com\/paw92\/index.php\/wp-json\/wp\/v2\/posts\/12797","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.appservgrid.com\/paw92\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.appservgrid.com\/paw92\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.appservgrid.com\/paw92\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.appservgrid.com\/paw92\/index.php\/wp-json\/wp\/v2\/comments?post=12797"}],"version-history":[{"count":1,"href":"https:\/\/www.appservgrid.com\/paw92\/index.php\/wp-json\/wp\/v2\/posts\/12797\/revisions"}],"predecessor-version":[{"id":12798,"href":"https:\/\/www.appservgrid.com\/paw92\/index.php\/wp-json\/wp\/v2\/posts\/12797\/revisions\/12798"}],"wp:attachment":[{"href":"https:\/\/www.appservgrid.com\/paw92\/index.php\/wp-json\/wp\/v2\/media?parent=12797"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.appservgrid.com\/paw92\/index.php\/wp-json\/wp\/v2\/categories?post=12797"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.appservgrid.com\/paw92\/index.php\/wp-json\/wp\/v2\/tags?post=12797"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}