Why is Ubuntu running at 2 levels?

Source: Internet
Author: User

Following the previous article http://www.cnblogs.com/EasonJim/p/7163069.html in-depth study of the Linux operating level, found that most of the internet said Ubuntu operating level default is 2, So here's an in-depth analysis of why 2 is not the other.

Analysis Process:

First, from http://forum.ubuntu.org.cn/viewtopic.php?f=97&t=221304 this article learned that the Debian department's operating level 2~5 are the same. and through

CD /etc/initless rc-sysinit. conf

Found inside a sentence: Env default_runlevel=2, so on this discovery, can be explained that Ubuntu default RunLevel is 2.

There are also a number of people who have been widely described in the following Web site content:

Https://debian-administration.org/article/212/An_introduction_to_run-levels

Http://www.debianadmin.com/debian-and-ubuntu-linux-run-levels.html

Https://stackoverflow.com/questions/16227792/runlevel-2-and-5-works-the-same-on-ubuntu

Https://unix.stackexchange.com/questions/39411/why-does-debian-and-ubuntu-default-to-runlevel-2

Https://wiki.debian.org/RunLevel

http://www.pathbreak.com/blog/ubuntu-startup-init-scripts-runlevels-upstart-jobs-explained

https://askubuntu.com/questions/686700/no-difference-between-runlevel-3-and-5-in-ubuntu-15-04

So, in summary, this should be the case: according to the Debian Strategy manual , there is no difference between RunLevel 2 and 5 by default. As shown below:

Mode  not  not  not used.6:system reboot.

That is, in the Debian system, 2 is the default level, and the rest are not used. And the official introduction is starting from 2.

But it's strange to find that if you run the RunLevel command on an Ubuntu 16.04 system, you get n 5, which corresponds to the GUI at the level shown below:

Run level Name Describe
0 Stop Shutting down the system
1 Single-User mode Manage task modes.
2 Multi-user mode Do not configure network interfaces, do not export network services
3 Multi-user mode and network Normal boot system
4 Not used/user can be determined?? Yi For special purposes
5 Booting the system normally using the GUI display manager Run Level 3 + display Manager
6 Restart Rebooting the system
s or S Single-User mode Do not configure a network interface or start a background process.

Or will that be, in the server version will not show 2, in fact, tested, in the server 16.04 version is also n 5.

So it's strange that the boot level will also be upgraded as the version is upgraded.

From http://forum.ubuntu.org.cn/viewtopic.php?t=474412, Discover Ubuntu System-level change history:

1, Ubuntu 6.10 and previous versions use Sysvinit.

2, Ubuntu 14.10 and the previous version of the use of upstart but still keep sysvinit coexist.

Https://wiki.ubuntu.com/Upstart

Https://help.ubuntu.com/community/UpstartHowto

3, Ubuntu 15.04 started using SYSTEMD, but you can choose to use the SYSTEMD or upstart in the boot option, but not the same time using sysvinit or upstart coexist.

Https://wiki.ubuntu.com/SystemdForUpstartUsers

Instead of using runlevel for representation, SYSTEMD uses target for display, compared to the table below:

   Mapping between Runlevels and systemd targets   ┌─────────┬───────────────────┐   │runlevel│target            │   ├─────────┼───────────────────┤   │0        │poweroff.  Target   │   ├─────────┼───────────────────┤   │1        │rescue.  Target     │   ├─────────┼───────────────────┤   │2, 3, 4  │multi-user.  target│   ├─────────┼───────────────────┤   │5        │graphical.  Target  │   ├─────────┼───────────────────┤   │6        │reboot.  Target     │   └─────────┴───────────────────┘

This form is derived from: https://askubuntu.com/questions/788323/change-runlevel-on-16-04

Then I found in the test that the desktop version or the server version of Ubuntu 16.04 to get the default target. Is the display of graphical.target, which corresponds to the level n 5. (Command: systemctl get-default )

But it doesn't seem to be much of a conclusion. Indicates the default level of 2.

Summarize:

So, I guess, because of historical reasons, before 15.04, the system level should still be 2 as the default, but after 15.04, the use of the SYSTEMD problem, the default level is changed to 5 as the default, and through the above historical development, regardless of the 2~5 between, there is no difference.

Or because of the use of systemd this, so that some previous articles on how to modify the system RunLevel, in 16.04 does not take effect issues. Then to modify the RunLevel, you can refer to this article to modify: https://askubuntu.com/questions/788323/change-runlevel-on-16-04

Other findings:

If 16.04 of the system has 5 as the default level, then after I set up a service, I put it on the level 2 will not run it? This is not the case, the operating level of the system is said to run from small to large, to run to 5, then it will go through 2, so, we set up the service, that is, directly set up on the 2 automatic start on the line, but found that some services are set to run automatically in 2~5, so I guess, this should be for insurance, This service can be started at any run level. Reference: https://askubuntu.com/questions/323374/run-levels-only-at-start-up;

There are also some practices are set up in the beginning, and then to 5 to kill the start of K, I think this practice can achieve effect, but if according to the above summary, run the running level, will be a bit of waste of resources, to start and kill, rather than from the beginning of the 2 level to 5 do not start better.

Reference:

Https://unix.stackexchange.com/questions/170555/why-is-my-debian-jessie-always-in-runlevel-5

https://askubuntu.com/questions/788323/change-runlevel-on-16-04

Https://askubuntu.com/questions/323374/run-levels-only-at-start-up

https://askubuntu.com/questions/686700/no-difference-between-runlevel-3-and-5-in-ubuntu-15-04

http://www.pathbreak.com/blog/ubuntu-startup-init-scripts-runlevels-upstart-jobs-explained

Https://wiki.debian.org/RunLevel

Https://unix.stackexchange.com/questions/39411/why-does-debian-and-ubuntu-default-to-runlevel-2

Https://stackoverflow.com/questions/16227792/runlevel-2-and-5-works-the-same-on-ubuntu

Http://www.debianadmin.com/debian-and-ubuntu-linux-run-levels.html

Https://debian-administration.org/article/212/An_introduction_to_run-levels

Why is Ubuntu running at 2 levels?

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.