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
from
id:5:initdefault:
to
id:3:initdefault:
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
/etc/X11/prefdm
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.

7 comments:

  1. I’ve desired to post about something similar to this on one of my blogs and this has given me an idea. Cool Mat.
    python training in rajajinagar | Python training in btm | Python training in usa

    ReplyDelete
  2. Your good knowledge and kindness in playing with all the pieces were very useful. I don’t know what I would have done if I had not encountered such a step like this.
    advanced excel training in bangalore

    ReplyDelete
  3. Great post! I am actually getting ready to across this information, It’s very helpful for this blog.Also great with all of the valuable information you have Keep up the good work you are doing well.
    Data Science training in rajaji nagar | Data Science with Python training in chenni

    Data Science training in electronic city | Data Science training in USA

    Data science training in pune | Data science training in kalyan nagar

    ReplyDelete