Linux - NewbieThis Linux forum is for members that are new to Linux.
Just starting out and have a question?
If it is not in the man pages or the how-to's this is the place!
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
I'm somewhat of a newb to Linux, but I've managed to set up a few Ubuntu Server edition boxes. I've never really paid attention to runlevels, but while working toward my LPIC-1 certification I've noticed the Linux servers I've deployed are running on runlevel 2. Shouldn't they be set to run on runlevel 3? These servers are simple Samba servers and may offer a few other network services. Do runlevels only refer to start-up scripts/services that are executed? Is the kernel oblivious to the runlevel? I think I have a misconception as to what runlevels are.
I'm somewhat of a newb to Linux, but I've managed to set up a few Ubuntu Server edition boxes. I've never really paid attention to runlevels, but while working toward my LPIC-1 certification I've noticed the Linux servers I've deployed are running on runlevel 2. Shouldn't they be set to run on runlevel 3? These servers are simple Samba servers and may offer a few other network services. Do runlevels only refer to start-up scripts/services that are executed? Is the kernel oblivious to the runlevel? I think I have a misconception as to what runlevels are.
Hi CRCool75
The following URL gives an excellent explanation of 'run levels'. https://en.wikipedia.org/wiki/Runlevel . They have been replaced with 'service/targets' in systemd recently.
In addition, not all distributions conform to the standard base as explained on the Wiki page. Ubuntu is based upon debian which uses the following on versions 7 and older.
0 halt
1 single user mode
2,3,4,5 multiuser mode
6 reboot
Run level 2 is the default regardless if running a GUI. I thought that debian was on the page at one time but probably was removed since version 8 now uses systemd. With systemd multiuser is now 3 and graphical is 5.
In a nutshell runlevels refer to startup scripts and services but they can be switched at anytime.
In a nutshell runlevels refers to startup scripts and services but they can be switched at anytime.
Expanding a little on michaelk's nutshell: In a nutshell a runlevel refers to some startup state currently defined on your specific machine. They are usually inherited from the distro maintainers but may easily be altered and despite some convention, are not universal.
No, runlevel 1, or 'single user mode' will start you up with less of the kernel activated, that is why you need to reboot/continue to get the graphics. I think, but do not know, that runlevel 1 is used by admin on a multiuser system to isolate admin from other processes in order to make changes.
Ok, thanks... Runlevel 3 is the level for networking. If this is the case, and I'm running network services, shouldn't it be set to 3 rather than 2? Obviously I've changed the default runlevel 2 to accommodate networking.
# These are the default runlevels in Slackware:
# 0 = halt
# 1 = single user mode
# 2 = unused (but configured the same as runlevel 3)
# 3 = multiuser mode (default Slackware runlevel)
# 4 = X11 with KDM/GDM/XDM (session managers)
# 5 = unused (but configured the same as runlevel 3)
# 6 = reboot
Many servers are set to run in headless mode with no monitor, but are administered remotely via the command line using ssh. Accordingly, starting then in a mode that would invoke a GUI is a waste of resources.
If I recall correctly, Ubuntu server comes by default with no display manager and without X. With them missing, a machine will have no GUI. If they are installed, any runlevel from 2-5 will boot to a GUI.
Ok, thanks... Runlevel 3 is the level for networking. If this is the case, and I'm running network services, shouldn't it be set to 3 rather than 2?
No. Ubuntu does not use the standard run levels. 2 is the default for multiuser mode regardless if running a GUI. The kernel is oblivious of run level and can be changed at any time without rebooting. Same goes for starting the GUI.
For reference what version Ubuntu are you running?
No, runlevel 1, or 'single user mode' will start you up with less of the kernel activated, that is why you need to reboot/continue to get the graphics. I think, but do not know, that runlevel 1 is used by admin on a multiuser system to isolate admin from other processes in order to make changes.
Fred.
Actually, the kernel doesn't care. It neither uses nor supports run levels.
Run levels are only supported by the init program that is invoked after the kernel is running. That "init" program is USUALLY /sbin/init, but it can actually be any program at all. Some systems use busybox (a stand alone shell with many utilities compiled in). This can be used to run a shell script, or the console is prompted for commands - effectively a single user mode. I have even seen references using "login" for the init program to force the user to login before getting a shell.
The kernel has a specific parameter that can be used to replace the default init program: init=<full_path_to_program>. This gets run instead of the default /sbin/init
yes sorry,
the kernel is loaded first but what is used of the kernel is controlled by init, or similar, so apologies, the kernel is oblivious to the runlevel but the reverse cannot be said, not that you were saying.
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.