{"id":13764,"date":"2019-04-06T02:52:04","date_gmt":"2019-04-06T02:52:04","guid":{"rendered":"http:\/\/www.appservgrid.com\/paw92\/?p=13764"},"modified":"2019-04-06T02:52:04","modified_gmt":"2019-04-06T02:52:04","slug":"how-to-change-runlevels-targets-in-systemd","status":"publish","type":"post","link":"https:\/\/www.appservgrid.com\/paw92\/index.php\/2019\/04\/06\/how-to-change-runlevels-targets-in-systemd\/","title":{"rendered":"How to Change Runlevels (targets) in SystemD"},"content":{"rendered":"<p><strong>Systemd<\/strong>\u00a0is a modern\u00a0<a href=\"https:\/\/www.tecmint.com\/best-linux-init-systems\/\" target=\"_blank\" rel=\"noopener\">init system for Linux<\/a>: a system and service manager which is compatible with the popular SysV init system and LSB init scripts. It was intended to overcome the shortcomings of SysV init as explained in the following article.<\/p>\n<ol>\n<li><a href=\"https:\/\/www.tecmint.com\/systemd-replaces-init-in-linux\/\" target=\"_blank\" rel=\"noopener\">The Story Behind \u2018init\u2019 and \u2018systemd\u2019: Why \u2018init\u2019 Needed to be Replaced with \u2018systemd\u2019 in Linux<\/a><\/li>\n<\/ol>\n<p>On Unix-like systems such as Linux, the current operating state of the operating system is known as a\u00a0<strong>runleve<\/strong>l; it defines what system services are running. Under popular init systems like SysV init, runlevels are identified by numbers. However, in systemd runlevels are referred to as\u00a0<strong>targets<\/strong>.<\/p>\n<p><b>Suggested Read:<\/b>\u00a0<a href=\"https:\/\/www.tecmint.com\/linux-boot-process-and-manage-services\/\" target=\"_blank\" rel=\"noopener\">Managing System Startup Process and Services (SysVinit, Systemd and Upstart)<\/a><\/p>\n<p>In this article, we will explain how to change runlevels (targets) with systemd. Before we move any further, let\u2019s briefly under the relationship between\u00a0<strong>runlevels<\/strong>\u00a0numbers and\u00a0<strong>targets<\/strong>.<\/p>\n<ul>\n<li><strong>Run level 0<\/strong>\u00a0is matched by\u00a0<strong>poweroff.target<\/strong>\u00a0(and\u00a0<strong>runlevel0.target<\/strong>\u00a0is a symbolic link to\u00a0<strong>poweroff.target<\/strong>).<\/li>\n<li><strong>Run level 1<\/strong>\u00a0is matched by\u00a0<strong>rescue.target<\/strong>\u00a0(and\u00a0<strong>runlevel1.target\u00a0<\/strong>is a symbolic link to\u00a0<strong>rescue.target<\/strong>).<\/li>\n<li><strong>Run level<\/strong>\u00a03 is emulated by\u00a0<strong>multi-user.target<\/strong>\u00a0(and\u00a0<strong>runlevel3.target<\/strong>\u00a0is a symbolic link to\u00a0<strong>multi-user.target<\/strong>).<\/li>\n<li><strong>Run level 5<\/strong>\u00a0is emulated by\u00a0<strong>graphical.target<\/strong>\u00a0(and\u00a0<strong>runlevel5.target<\/strong>\u00a0is a symbolic link to\u00a0<strong>graphical.target<\/strong>).<\/li>\n<li><strong>Run level 6<\/strong>\u00a0is emulated by\u00a0<strong>reboot.target<\/strong>\u00a0(and\u00a0<strong>runlevel6.target<\/strong>\u00a0is a symbolic link to\u00a0<strong>reboot.target<\/strong>).<\/li>\n<li><strong>Emergency<\/strong>\u00a0is matched by\u00a0<strong>emergency.target<\/strong>.<\/li>\n<\/ul>\n<h3>How to View Current target (run level) in Systemd<\/h3>\n<p>When the system boots, by default systemd activates the\u00a0<strong>default.target<\/strong>\u00a0unit. It\u2019s main work is to activate services and other units by pulling them in via dependencies.<\/p>\n<p>To view the default target, type the command below.<\/p>\n<pre>#systemctl get-default \r\n\r\ngraphical.target\r\n<\/pre>\n<p>To set the default target, run the command below.<\/p>\n<pre># systemctl set-default multi-user.target  \r\n<\/pre>\n<h3>How to Change the target (runlevel) in Systemd<\/h3>\n<p>While the system is running, you can switch the target (run level), meaning only services as well as units defined under that target will now run on the system.<\/p>\n<p>To switch to\u00a0<strong>runlevel 3<\/strong>, run the following command.<\/p>\n<pre># systemctl isolate multi-user.target \r\n<\/pre>\n<p>To change the system to\u00a0<strong>runlevel 5<\/strong>, type the command below.<\/p>\n<pre># systemctl isolate graphical.target\r\n<\/pre>\n<p>For more information about systemd, read through these useful articles:<\/p>\n<ol>\n<li><a href=\"https:\/\/www.tecmint.com\/manage-services-using-systemd-and-systemctl-in-linux\/\" target=\"_blank\" rel=\"noopener\">How to Manage \u2018Systemd\u2019 Services and Units Using \u2018Systemctl\u2019 in Linux<\/a><\/li>\n<li><a href=\"https:\/\/www.tecmint.com\/create-new-service-units-in-systemd\/\" target=\"_blank\" rel=\"noopener\">How to Create and Run New Service Units in Systemd Using Shell Script<\/a><\/li>\n<li><a href=\"https:\/\/www.tecmint.com\/linux-boot-process-and-manage-services\/\" target=\"_blank\" rel=\"noopener\">Managing System Startup Process and Services (SysVinit, Systemd and Upstart)<\/a><\/li>\n<li><a href=\"https:\/\/www.tecmint.com\/manage-systemd-logs-using-journalctl\/\" target=\"_blank\" rel=\"noopener\">Manage Log Messages Under Systemd Using Journalctl [Comprehensive Guide]<\/a><\/li>\n<\/ol>\n<p>In this guide, we showed how to change runlevels (targets) with systemd. Use the comment form below to send us any questions or thoughts concerning this article.<\/p>\n<p><a href=\"https:\/\/www.tecmint.com\/change-runlevels-targets-in-systemd\/\" target=\"_blank\" rel=\"noopener\">Source<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<p>Systemd\u00a0is a modern\u00a0init system for Linux: a system and service manager which is compatible with the popular SysV init system and LSB init scripts. It was intended to overcome the shortcomings of SysV init as explained in the following article. The Story Behind \u2018init\u2019 and \u2018systemd\u2019: Why \u2018init\u2019 Needed to be Replaced with \u2018systemd\u2019 in &hellip; <\/p>\n<p class=\"link-more\"><a href=\"https:\/\/www.appservgrid.com\/paw92\/index.php\/2019\/04\/06\/how-to-change-runlevels-targets-in-systemd\/\" class=\"more-link\">Continue reading<span class=\"screen-reader-text\"> &#8220;How to Change Runlevels (targets) in SystemD&#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-13764","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\/13764","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=13764"}],"version-history":[{"count":1,"href":"https:\/\/www.appservgrid.com\/paw92\/index.php\/wp-json\/wp\/v2\/posts\/13764\/revisions"}],"predecessor-version":[{"id":13765,"href":"https:\/\/www.appservgrid.com\/paw92\/index.php\/wp-json\/wp\/v2\/posts\/13764\/revisions\/13765"}],"wp:attachment":[{"href":"https:\/\/www.appservgrid.com\/paw92\/index.php\/wp-json\/wp\/v2\/media?parent=13764"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.appservgrid.com\/paw92\/index.php\/wp-json\/wp\/v2\/categories?post=13764"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.appservgrid.com\/paw92\/index.php\/wp-json\/wp\/v2\/tags?post=13764"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}