LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (https://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   How to disable X windows? (https://www.linuxquestions.org/questions/linux-newbie-8/how-to-disable-x-windows-846241/)

pinga123 11-24-2010 06:17 AM

How to disable X windows?
 
I have modified /etc/inittab file for changing default runlevel from 5 to 3 .
Now i can boot in terminal mode .However if i issue init 5 i get a X window.
How would i disable loading X? do i need to disable some services?
P.S.
What is Xvfb? How would i disable it?
My Distribution Details.
Code:

# lsb_release -a
LSB Version:    :core-3.1-ia32:core-3.1-noarch:graphics-3.1-ia32:graphics-3.1-noarch
Distributor ID: EnterpriseEnterpriseServer
Description:    Enterprise Linux Enterprise Linux Server release 5.2 (Carthage)
Release:        5.2
Codename:      Carthage
# uname -a
Linux OFSMUW-VMGR-51 2.6.18-92.el5PAE #1 SMP Fri May 23 22:26:05 EDT 2008 i686 i686 i386 GNU/Linux


jlcasado 11-24-2010 06:21 AM

Hi,

On the /etc/inittab file you can find that X is started so you can comment out those lines....

But why you would like to go into runlevel 5 if you don't want the X windows to be started?

Best regards
jose

repo 11-24-2010 06:24 AM

Quote:

What is Xvfb? How would i disable it?
http://en.wikipedia.org/wiki/Xvfb

Quote:

How to disable X windows?
uninstall X ?


Kind regards

jschiwal 11-24-2010 06:25 AM

You could simply comment out the line I have highlighted in /etc/inittab:
Code:

# /etc/init.d/rc takes care of runlevel handling
#
# runlevel 0  is  System halt  (Do not use this for initdefault!)
# runlevel 1  is  Single user mode
# runlevel 2  is  Local multiuser without remote network (e.g. NFS)
# runlevel 3  is  Full multiuser with network
# runlevel 4  is  Not used
# runlevel 5  is  Full multiuser with network and xdm
# runlevel 6  is  System reboot (Do not use this for initdefault!)
#
l0:0:wait:/etc/init.d/rc 0
l1:1:wait:/etc/init.d/rc 1
l2:2:wait:/etc/init.d/rc 2
l3:3:wait:/etc/init.d/rc 3
#l4:4:wait:/etc/init.d/rc 4
l5:5:wait:/etc/init.d/rc 5
l6:6:wait:/etc/init.d/rc 6

If your concern is with security, you could uninstall X support using your package system as well, or opt for a minimal installation when installing, not installing the Xorg server in the first place.

pinga123 11-24-2010 09:27 PM

Quote:

Originally Posted by jschiwal (Post 4169359)
You could simply comment out the line I have highlighted in /etc/inittab:
Code:

# /etc/init.d/rc takes care of runlevel handling
#
# runlevel 0  is  System halt  (Do not use this for initdefault!)
# runlevel 1  is  Single user mode
# runlevel 2  is  Local multiuser without remote network (e.g. NFS)
# runlevel 3  is  Full multiuser with network
# runlevel 4  is  Not used
# runlevel 5  is  Full multiuser with network and xdm
# runlevel 6  is  System reboot (Do not use this for initdefault!)
#
l0:0:wait:/etc/init.d/rc 0
l1:1:wait:/etc/init.d/rc 1
l2:2:wait:/etc/init.d/rc 2
l3:3:wait:/etc/init.d/rc 3
#l4:4:wait:/etc/init.d/rc 4
l5:5:wait:/etc/init.d/rc 5
l6:6:wait:/etc/init.d/rc 6

If your concern is with security, you could uninstall X support using your package system as well, or opt for a minimal installation when installing, not installing the Xorg server in the first place.

It would be great help if you explain why have you commented the line?
How would i uninstall X Which package needs to be removed?How would i find which file is to be done?
There was no choice of not installing X while Installing OS.

chrism01 11-24-2010 10:02 PM

If you want to remove Xwin from the cmd line, you'll need one or more of the 'yum' cmds: http://kbase.redhat.com/faq/docs/DOC-2531
However, the qn remains; why 'init 5' if you don't want Xwin?
init level 3 gives you a full capability server. init 5 is specifically to start the Xwindows.
As for init 4, it's officially undefined/avail to local user to provide a cusstom state.
http://www.linuxtopia.org/online_boo...ices-runlevels

pinga123 11-24-2010 10:45 PM

Quote:

Originally Posted by chrism01 (Post 4170264)
If you want to remove Xwin from the cmd line, you'll need one or more of the 'yum' cmds: http://kbase.redhat.com/faq/docs/DOC-2531
However, the qn remains; why 'init 5' if you don't want Xwin?
init level 3 gives you a full capability server. init 5 is specifically to start the Xwindows.
As for init 4, it's officially undefined/avail to local user to provide a cusstom state.
http://www.linuxtopia.org/online_boo...ices-runlevels

Did as per you said still not able to achieve as per the requirement .
I have commented following line.
Code:

l5:5:wait:/etc/init.d/rc 5
Reboot the system.
it was booted in runlevel 3.
later i run init 5 and it went to graphical mode.
What is the use of commenting l5:5:wait:/etc/init.d/rc 5 ?

JoshyJ 11-24-2010 11:02 PM

As most people have said. There is no point in changing to runlevel 5 as that is purely for X Windows.

Is there something that you placed in runlevel 5? or specific reason for wanting runlevel 5?

chrism01 11-24-2010 11:03 PM

Exaclty what did you do? I pointed out that you need to apply the correct yum cmds from the cmd line (as root) to remove the deskop/Xwin Sw.
You'd start with

yum grouplist

then use the

yum remove <relevant groupname>

to remove the desktop/Xwin stuff.
I'm not on Linux right now, so you'll have to get the correct name yourself.

pinga123 11-24-2010 11:15 PM

Quote:

Originally Posted by jschiwal (Post 4169359)
You could simply comment out the line I have highlighted in /etc/inittab:
Code:

# /etc/init.d/rc takes care of runlevel handling
#
# runlevel 0  is  System halt  (Do not use this for initdefault!)
# runlevel 1  is  Single user mode
# runlevel 2  is  Local multiuser without remote network (e.g. NFS)
# runlevel 3  is  Full multiuser with network
# runlevel 4  is  Not used
# runlevel 5  is  Full multiuser with network and xdm
# runlevel 6  is  System reboot (Do not use this for initdefault!)
#
l0:0:wait:/etc/init.d/rc 0
l1:1:wait:/etc/init.d/rc 1
l2:2:wait:/etc/init.d/rc 2
l3:3:wait:/etc/init.d/rc 3
#l4:4:wait:/etc/init.d/rc 4
l5:5:wait:/etc/init.d/rc 5
l6:6:wait:/etc/init.d/rc 6

If your concern is with security, you could uninstall X support using your package system as well, or opt for a minimal installation when installing, not installing the Xorg server in the first place.

Thanks for your replies and most of my doubts are clear but I m still not clear why there is need to comment out the line in code where the same can be achieved making default runlevel 3.
I just want to know the diference between making default runlevel 3 and commenting the highlighted line as per jschiwal's post.



There are no services that are there in runlevel 5 I just want to avoid going into runlevel 5.
For example i should be getting error or nothing should happen when i type init 5.Is this possible?

jlcasado 11-29-2010 09:45 AM

Hi,

Commenting lines:
Code:

l4:4:wait:/etc/init.d/rc 4
l5:5:wait:/etc/init.d/rc 5

will avoid that when you run "/sbin/init 5" or "/sbin/init 4" no scripts under /etc/rc.d/rc5.d/ or /etc/rc.d/rc4.d/ will be run (a nice doc to read is here).

Regardign your last question, you are right, selecting the runlevel for inittab is enough for starting in the right runlevel and nothing else is needed.

Cheers
jose


All times are GMT -5. The time now is 06:02 PM.