Q. How do I change the runlevel for a Linux server without rebooting my server? I am using Gentoo Linux.
A. Almost all Linux distribution use init program to change runlevel. init is the parent of all processes. Its primary role is to create processes from a script stored in the file
/etc/inittab . This file usually has entries which cause init to spawn gettys on each line that users can log in. It also controls autonomous processes required by any particular system.
To change runlevel from 3 to 1 you need to type command as follows:
# init 1
OR
$ sudo init 1
Where 1 is runlevel number, other possible runlevel values are:
=> 0 - Shutdown server
=> 1 - Take server to single-user mode
=> 2 - Start X Window (used by Debian)
=> 3 - Full multi-user text mode
=> 5 - Start X Window
=> 6 - Reboot server
Featured Articles:
- 20 Linux System Monitoring Tools Every SysAdmin Should Know
- My 10 UNIX Command Line Mistakes
- 10 Greatest Open Source Software Of 2009
- Top 5 Email Client For Linux, Mac OS X, and Windows Users
- Top 20 OpenSSH Server Best Security Practices
- Top 10 Open Source Web-Based Project Management Software
- Top 5 Linux Video Editor Software
- Email FAQ to a friend
- Download PDF version
- Printable version
- Comment RSS feed
- Last Updated: 04/6/09



{ 3 comments… read them below or add one }
Hi Vivek,
Just typos : X is spelled X Window – Capital W, and without an “s”
so not “Start X windows” … but “Start X Window”
Thumbs up anyway
– Peko
No problem. The FAQ has been updated.
Another way to do this is by using “telinit”
Telinit allows you to spawn a session at a different runlevel than your current session – and return to it when you are done.
Example:
I have a Fedora box that I use primarily as a Samba file server on my network – and I have it set to auto-start in runlevel 3 – no graphics – to preserve processor bandwidth for actual file handling. Since I do most of my SMB maintainance through SWAT, the text login is just fine.
Occasionally though, I want to use a graphical login – so I login to the text login and then sudo telinit 5. That spawns a graphical session I can log into, and then when I exit, I’m right back at the runlevel 3 terminal session.
It’s handy – especially if you need to pop into a graphical session every now and then – without clobbering your existing user context.
What say ye?
Jim