Find the answer to your Linux question:
Results 1 to 4 of 4
Enjoy an ad free experience by logging in. Not a member yet? Register.
  1. #1

    How to remove X from linux distribution?

    How to remove X completly from the system?

    As a Security practice I wanted to disable X from loading.
    So i modified following line from /etc/inittab.
    I was then able to start my machine in terminal mode(runlevel 3).

    I wasn't satisfied at this stage as i was able to get the graphical console by merely typing

    #init 5
    So i search and find out that the reason for loading the graphical user interface was a script resided in

    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.

    I have 2 questions here.

    1)Is this Method considered to be stardard while removing X in linux distro.
    Will it make any difference?
    I m not using any application that explicitly use graphical user interface and i can work in runlevel 3.

    2)Is any package responsible for loading X .If yes then removing shall remove X from the system,correct me if i m wrong.

    My distribution Details.
    # uname -r
    # 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

  2. #2
    Linux Guru coopstah13's Avatar
    Join Date
    Nov 2007
    NH, USA
    if you want to remove X, its pretty simple to just use yum and remove x11 packages

    you need root access to change init to runlevel 5 from 3, though i will say that users can still run "startx" command and bring up x-windows (at least locally) so if you don't want it, just remove packages, it shouldn't be an issue if you aren't using any X applications

  3. #3
    or they could reboot and add " 5" to the kernel args, over-ruling /etc/inittab, to take them to runlevel 5 (if you don't have grub password-protected).

    like coopstah13 said, best bet is to remove the X packages. but of course, if they can get root (which by default is easy, if they are local to the machine) your efforts are in vain (assuming they can get networking up or mount media).

  4. $spacer_open
  5. #4
    Just Joined!
    Join Date
    May 2011
    Southern California, US
    If you *know* that none of your programs ever use init 5, you *could* delete the X11 server via YUM or RPM.

    If you want to keep it around, just in case, but still want to keep init 5 away from most prying eyes, then:
    1. Edit the /etc/inittab file and change the id:5:initdefault: to id:3:initdefault:
    2. Move the /etc/X11/prefdm file to /etc/X11/prefdm.orig
    3. Create a new /etc/X11/prefdm with two lines in it:
    init 3

    This will cause a loop. Whenever someone tries to init 5, it will automatically switch to init 3 instead. If you ever really need to get init 5, you will have to copy /etc/X11/prefdm.orig back into /etc/X11/prefdm.


Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts