LinuxQuestions.org
Visit Jeremy's Blog.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This 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


Reply
  Search this Thread
Old 09-19-2015, 01:12 PM   #1
CRCool75
Member
 
Registered: Jul 2004
Location: Alabama, USA
Distribution: OpenSuse 12.1
Posts: 66

Rep: Reputation: 15
Runlevel Purpose


Hello,

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.
 
Old 09-19-2015, 01:23 PM   #2
robertdaleweir
Member
 
Registered: Jul 2006
Location: Canada
Distribution: Fedora
Posts: 93

Rep: Reputation: 11
Quote:
Originally Posted by CRCool75 View Post
Hello,

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.
 
Old 09-19-2015, 01:55 PM   #3
michaelk
Moderator
 
Registered: Aug 2002
Posts: 25,691

Rep: Reputation: 5894Reputation: 5894Reputation: 5894Reputation: 5894Reputation: 5894Reputation: 5894Reputation: 5894Reputation: 5894Reputation: 5894Reputation: 5894Reputation: 5894
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.

Last edited by michaelk; 09-19-2015 at 02:19 PM.
 
Old 09-19-2015, 02:12 PM   #4
astrogeek
Moderator
 
Registered: Oct 2008
Distribution: Slackware [64]-X.{0|1|2|37|-current} ::12<=X<=15, FreeBSD_12{.0|.1}
Posts: 6,263
Blog Entries: 24

Rep: Reputation: 4194Reputation: 4194Reputation: 4194Reputation: 4194Reputation: 4194Reputation: 4194Reputation: 4194Reputation: 4194Reputation: 4194Reputation: 4194Reputation: 4194
Quote:
Originally Posted by michaelk View Post
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.
 
Old 09-19-2015, 08:25 PM   #5
Fred Caro
Senior Member
 
Registered: May 2007
Posts: 1,007

Rep: Reputation: 167Reputation: 167
Quote:
Is the kernel oblivious to the runlevel?
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.
 
Old 09-19-2015, 08:46 PM   #6
CRCool75
Member
 
Registered: Jul 2004
Location: Alabama, USA
Distribution: OpenSuse 12.1
Posts: 66

Original Poster
Rep: Reputation: 15
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.
 
Old 09-19-2015, 08:49 PM   #7
frankbell
LQ Guru
 
Registered: Jan 2006
Location: Virginia, USA
Distribution: Slackware, Ubuntu MATE, Mageia, and whatever VMs I happen to be playing with
Posts: 19,317
Blog Entries: 28

Rep: Reputation: 6140Reputation: 6140Reputation: 6140Reputation: 6140Reputation: 6140Reputation: 6140Reputation: 6140Reputation: 6140Reputation: 6140Reputation: 6140Reputation: 6140
These are the runlevel options on Slackware.

Code:
# 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.
 
Old 09-19-2015, 09:39 PM   #8
michaelk
Moderator
 
Registered: Aug 2002
Posts: 25,691

Rep: Reputation: 5894Reputation: 5894Reputation: 5894Reputation: 5894Reputation: 5894Reputation: 5894Reputation: 5894Reputation: 5894Reputation: 5894Reputation: 5894Reputation: 5894
Quote:
Originally Posted by CRCool75 View Post
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?

Last edited by michaelk; 09-19-2015 at 09:41 PM.
 
Old 09-20-2015, 01:02 PM   #9
jpollard
Senior Member
 
Registered: Dec 2012
Location: Washington DC area
Distribution: Fedora, CentOS, Slackware
Posts: 4,912

Rep: Reputation: 1513Reputation: 1513Reputation: 1513Reputation: 1513Reputation: 1513Reputation: 1513Reputation: 1513Reputation: 1513Reputation: 1513Reputation: 1513Reputation: 1513
Quote:
Originally Posted by Fred Caro View Post
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

When the init program exits, the system halts.

Last edited by jpollard; 09-20-2015 at 01:06 PM.
 
Old 09-20-2015, 08:22 PM   #10
Fred Caro
Senior Member
 
Registered: May 2007
Posts: 1,007

Rep: Reputation: 167Reputation: 167
jpollard,

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.

Fred.
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
[SOLVED] Audio doesn't work in runlevel 4, but does in runlevel 3 (with startx) 2bdkid Slackware 2 01-01-2015 06:08 PM
MES5 in runlevel 3 stuck after starting mavisd. Can't change back to runlevel 5 JnPson Linux - Enterprise 3 01-16-2013 05:58 PM
[SOLVED] What is the purpose of lib64? How does it serve it's purpose? BMan8577 Linux - Newbie 2 09-20-2011 01:39 PM
[SOLVED] Getting a text console runlevel in Kubuntu 10.04 (Changing runlevel won't work) gregorian Linux - Newbie 4 09-05-2010 10:50 AM
Soun Mixer absent in Runlevel 3 but present in Runlevel 5 debloxie SUSE / openSUSE 1 01-18-2006 09:15 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 04:22 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration