Search This Blog

Wednesday, November 24, 2010

Changing runlevel of your Linux Distribution to disable Graphic Interface.

In this tutorial i m trying to change default runlevel of my linux distribution.

Currently it is set to run level 5 which means whenever the the machine get boot up it will end up displaying X console(Graphical User Interface).However I believe in working on non graphical environment i.e terminal and not so interested in graphical look of Linux.

So I have decided to change its run level to 3 .By doing this i will be able to start the machine in terminal rather than Graphical mode.

Need to modify /etc/inittab file.

modify following parameter
restart the machine
Recheck the runlevel by typing.
# runlevel
N 3

To Implement More security measures i went ahead doing some extra stuff.
(This is not so required if you the machine you are working is not intended for linux hardening purpose)
At this stage I was able to get terminal of machine after reboot
I wasn't satisfied at this stage as i was able to get the graphical console by merely typing
#init 5

So i searched google and find out that the reason for loading the graphical user interface was a script resided in
being called by system after executing
#init 5

So i renamed it thinking OS will fail in finding it when invoked by inittab file .
To my surprise i was able to get the terminal back even if i hit
#init 5
but then i realize i keep on getting following error lines.

INIT: cannot execute "/etc/X11/prefdm"
INIT: cannot execute "/etc/X11/prefdm"
INIT: Id "x" respawning too fast: disabled for 5 minutes

I found out the reason behind this was a line in /etc/inittab
x:5:respawn:/etc/X11/prefdm -nodaemon

(respawn The process will be restarted whenever it terminates)
Since the file prefdm was renamed and respawned the OS was keep on trying to execute it considering it is terminated.

Now i have made the above line commented and
removed execute bit of the file .

System is now behaving as i wish it would behave.
Now Even if i run
#init 5
it wont get into graphical mode.

No comments:

Post a Comment