• CONTEST ALERT - Experience the power of DDR5 memory with Kingston Click for details

[How To] Editing The Xorg .conf File

Not open for further replies.

Satissh S

In the way of my life with linux, as everyone, i have faced a lot of troubles, but each trouble of mine proves to be a stepping stone to attaining a higher level of understanding of this wonderful operating system. I had to learn deep about X when i had to setup my cards and other x components working.
Editing the xfree86.conf or xorg.conf file to get one's graphics card working is one of the biggest hurdles for a linux newbie. Only if he could understand what he is doing, he could get rid of the fear that holds him back. The purpose of this article is just that :wink:
Basically the afore mentioned files address to three types of settings.

1. Global Settings - X Settings.
2. Device Specific Settings.
3. A structure Sectional layout that combines the above two.

The Structure :
The Xorg.conf (I will be referring only to this file whilst the same holds true for the other as well) is basically structured into different sections.
Like this,
Section Name used to identify the device /*Start of the Section**/
Device Name of The Device
Driver The driver that x loads to run the device
Option Different Options and parametres for the device
EndSection /*End of the Section **/

In addition to the above sections there are special sections or device specific settings that one can configure.

The Base Sections :
Here are a few basic sections that are found in the xorg.conf files and their functions.

1. ServerLayout:
Section ServerLayout /*Start of the Section**/
identifier Single head configuration or multi head configuration /*If you have multiple displays on different graphics cards multi head mode is used otherwise, Single head mode will be used**/
Screen 0 "screen0" 0 0 /* This Section identifies that a screen named screen0 is where x will run. In single mode configurations the screen is usually denoted as 0 0 whereas if in multihead mode, it'll be different and the identifier for the second screen would be screen1. **/
InputDevice Name of The Device /* Specifies the input defices and their identifiers eg:"Mouse0" and its parametre "core pointer" which it is set to*/
EndSection /*End of the Section **/

2. Screen Configuration :

Section Screen /*Start of the Section**/
Identifier "Screen0"
Device "Videocard 0" /* Refers to the Section Videocard **/
Monitor "Monitor 0" /* Refers to the Section Monitor **/
DefaultDepth <integer representing the bits of depth of color (eg: 16, 24)>
Subsection "Display" /* Section Within the Current Section **/
Depth <integer representing the bits of depth of color (eg: 16, 24)>
Modes < Different Resolutions For the above Depth >
EndSubSection /* Ends the Subsection **/
EndSection /*End of the Section **/

3. Mouse Configuration :

Section "InputDevice"
Identifier "Mouse0"
Driver "mouse"
Option <options>

The Options include,
1. Protocol to Specify your protocol such as "IMPS/2" or "PS/2" or "usb" as parametres to the protocol option.
2. Device to Specify where the Device is connected to, Such as "/dev/psaux" for PS/2 for Serial Mouse /dev/ttyS0 for COM1 Port.
3. ZAxisMapping to set wheel motion for a wheel mouse as "int int"- two integers specifing the motion of the wheel.

3. Keyboard Configuration :

Section "InputDevice"
Identifier "Keyboard0"
Driver "keyboard"
Option <options>

The Options Include,
1. XkbLayout to specify a keyboard layout an "us" or any other layout.
2. AutoRepeat to specify the number of times keys will be repeated as two options, <Delay time before a key that is held down starts repeating> <number of times the key is repeated per second>.
3. XkbModel Specifies the keyboard model such as pc101 , pc102 or microsoft .

4. Monitor Configurations :

Section "Monitor"
Identifier "Monitor0"
VendorName "<Monitor Vendor>"
ModelName <Model Name>
HorizSync <Horizontal refresh rates> /* Specify your horizontal refresh rates here **/
VertRefresh <vertical Refresh Rates /* Specify your vertical refresh rates here **/
Option "dpms" /* The DPMS option specifies whether you want to use the powersaving features of the monitor. It supports standby and suspend functions **/

5. VideoCard Configurations :
Section "Device"
Identifier "VideoCard0"
Driver "<Name of the driver>" /* nv , vesa ,nvidia etc., **/
VendorName <Name of the Vendor> /* Name of the Card **/
BoardName <Name of the Board> /*Name of the board of the Card **/
Note About Vesa Driver:
Vesa Stands for Video Electronics Standards Association (VESA). You can get your unsupported graphics card to work if you can specify vesa in the driver section and later install the appropriate driver and update the xorg.conf file.

6. Module Configurations :
When X Server Starts up it looks for the following section for knowing the modules it has to load.
Section "Module"
Load "dbe"
Load "extmod"
Load "fbdevhw"
Load "glx"
Load "record"
Load "dri"
Load "freetype"
Load "type1"
Load "xtt"
Load "speedo"

Explanation of Modules:
1. dbe:
Required for animations. Implements Double buffering for flicker free and smooth of animations.

2. extmod:
Loads module for performing common functions in X Server.

3. fbdevhw:
The Linux framebuffer module which is used to let x communicate with framebuffer device in linux.(/dev/fb0)

4. glx:
The glx extension connects the DRI 3D library and X.
the following command gives you information about glx and the fps at which xserver functions:-
#glxgears -info

5. record:
The record module adds record extension to capture events that are associated with recording and playback user actions.

6. dri:
Loads Direct Rendering Interface to provide accelerated 3d graphics. NOT SUPPORTED BY NVIDIA CARDS

7. freetype:
Loads the module that can handle TrueType (.ttf and .ttc) ,Type1 (.pfa and .pbf) and OpenType (.otf and .otc) Fonts

Additionally there can also be another section called DRI
Section "DRI"
Mode 0000 /* Specifies the mode in which DRI will run Eg: 0666 etc., **/

The Above Mentioned are the prime sections of the xorg.conf file which can be edited to your preferences. Hope the above was useful :wink: :)
Any Corrections, Suggestions and tips will be gleefully acknowledged.
The Document is licensed under Free Document Licence and FSF. :D


FooBar Guy
Very nice tutorial, this one deserves to be sticky, if you've written it.

btw, i'd appretiate if you could give some info on VESA mode. As this is a life saviour if graphics card isnt supported.
Satissh S

Satissh S

Yes, Promise You, I wrote it, but i'm just a beginner in linux. I had to learn the above from various sites such as tldp.org and google searches when i was trying to configure my Nvidia GeForce 6800 GT card. And also when trying to get x working with Gentoo.

Vesa Stands for "Video Electronics Standards Association". I used this driver with my nvidia card b'coz, the card was relatively new and wasn't suported i guess. Later I installed NVIDIA Drivers. I think All Graphics hardware supports VESA driver.

PS: Was there anything wrong in what i wrote? :( :roll:


Wise Old Owl
Good tutorial mate....

My card is Nvidia geforce 2.When I tried installing Xandors.The installation screen never showed up.I even tried the VESA setup...but no luck.You are saying that all graphics hadware supports VESA...
Satissh S

Satissh S

But Vignesh, why don't you remove the card and try installing xandros, and once installed later pluggin the card. Xandros has nvidia drivers and will support them. Correct me if wrong.. But i'm pretty sure that vesa driver supports all cards, atleast until you install the drivers.


left this forum longback
:D Very Nice HOWTO Sateesh.You mentioned u tried installing Gentoo...why not show us brief steps of how do you achieve that.. :D
Satissh S

Satissh S

Here'tis prakash! Much of these i had learnt from the handbook and followed them just like that. Once you have setup your netcard, you can fireup links2 and refer to their manuals.
1.) Boot into gentoo minimal install live cd.
2.) Set the date,
date 120722352005 /*Me typing at 07th december 10'o clock (pm) 35 minutes and year 2005 */

3.) Set-up ethernet card.
net-setup eth0
From here on I simply followed the instructions from :-
Gentoo Handbook
It can be easily done by opening another shell [ctrl]+[alt]+*
and opening links2 . I referred the guide and executed the commands back and forth.

4.) Execute fdisk to partiton hard disks.
fdisk /dev/hda /* /dev/hda is the first hard disk and /dev/hdb is second and so on.. */

5.) P for partition information and use fdisk to create and resize partitons. Tap m to see the list of commands.
I made the foll,
/dev/hda1 Ext2 Filesystem to be mounted for /boot
/dev/hda2 Swap
/dev/hda3 ReiserFs as /

6.) Now,
mke2fs /dev/hda1
mkswap /dev/hda2
mkreiserfs /dev/hda3

7.) Turning on the swap,
swapon /dev/hda2

8.) For my nvidia card:-
modprobe nvidia

9.) mounting the root partition as /mnt/gentoo
mount /dev/hda3 /mnt/gentoo

10.) mounting the boot partition as /mnt/gentoo/boot
mount /dev/hda1 /mnt/gentoo/boot

11.) Downloading the Stage 3 tarball
1.) From the net:-
cd /mnt/gentoo
links2 http://www.gentoo.org/main/en/mirrors.xml
I navigated to the architecture and pressed D to download. And the Q to quit links2.
tar xvjpf stage3-pentium4-* [tab]
2.) From CD(Gentoo Universal CD):-
mount /dev/cdroms/cdrom0 /mnt/cdrom
cd /mnt/gentoo
tar xvjpf /mnt/cdrom/stages/stage3-pentium4-2005.1-r1.tar.bz2

PS; Substitute pentium4 with u'r architecture.

12.) Installing Portage Snapshots:-
links2 http://gentoo.osuosl.org/snapshots/
Download the snapshot and then untar it.
tar -xvjf portage-2005*.tar.bz2 -C /mnt/gentoo/usr

13.) Mounting /proc and /devfs filesystems
mkdir /mnt/gentoo/devfs
mkdir /mnt/gentoo/proc
mount -t devfs devfs /mnt/gentoo/devfs
mount -t proc none /mnt/gentoo/proc

14.) Copy the resolv.conf so that you don't have to set-up net again
cp /etc/resolv.conf /mnt/gentoo/etc/resolv.conf

15.) Optimising the environment variables using /mnt/gentoo/etc/make.conf :-
nano /mnt/gentoo/etc/make.conf
Donot edit CHOST Setting
Set CFLAGS to -march=i686 or -march=athlon-xp
we can use -O pipe and speed optimisation flags (0 ,1,2,3). I really dunno abt these, seem like compiling options,
CFLAGS="-march=i686 -pipe -O2"
CXXFLAGS="${CFLAGS}" /*To use Same Setting as CFLAGS**/
MAKEOPTS="-j2" /* Number of parallel guidelines to occur. Value = No. Of CPU + 1 **/
Next we have to configure our portage setting. There were several options in the make.conf.example which i don't remember now. Open the File in another terminal. Select the option you wan't and
[click] to paste in your make.conf file. Finish. :ws for vi , [ctrl] + x to quit in nano.

16.) Using mirror select to select mirrors:-
mirrorselect -a -s4 -o | grep GENTOO_MIRRORS >> /mnt/gentoo/etc/make.conf
Double checkin /etc/make.conf for changes.

17.) Changing root directory to /mnt/gentoo using chroot:
chroot /mnt/gentoo /bin/bash

18.) Updating Environment Variables:-
env-update; source /etc/profile

19.) updating the portage information:-
emerge sync
emerge --metadata /* Speeds up emerges by building a portage cache**/

20.) Configuring USE Variable:-
We have to configure /etc/make.conf with the use variables.
view the /usr/portage/profiles/use.desc file for available use flags.
USE="gtk gnome -qt -kde dvd alsa cdr"
The above line specifies to use gtk , gnome dvd alsa and cdr and not qt and kde. If you want you can put -gtk and -gnome and use qt and kde.
Add the following for kernel sources package
USE="-doc" emerge gentoo-sources

21.) BootStrap the Gentoo root partiton:-
cd /usr/protage/ ; scripts/bootstrap.sh /* Dunno why should this be done. **/

23.) Set TimeZone:-
ln -sf /usr/share/zoneinfo/<path> /etc/localtime /** path area should be your timezone. I dunno what to put there i simply put /IN/South Dunno if correct.

24.) modify fstab:-
vi /etc/fstab
/dev/hda1[tab]/boot[tab]ext2[tab]noauto,noatime[tab]1 2
/dev/hda2[tab]none[tab]swap[tab]sw[tab]0 0
/dev/hda3[tab]/[tab]reiserfs[tab]noatime[tab]0 1
/dev/cdroms/cdrom0[tab]/mnt/cdrom[tab]auto[tab]noauto,user[tab]0 0
/dev/cdroms/cdrw0[tab]/mnt/cdrom1[tab]auto[tab]noauto,user[tab]0 0
none[tab]/proc[tab]defaults[tab]0 0
none[tab]/dev/shm[tab]tmpfs[tab]defaults[tab]0 0

25.) Building the Kernel:-
I choose to get my kernel by using genkernel as i was a bit afraid of building it myself ;) :wink:
emerge gentoo-sources /* D/L Gentoo Source **/
emerge genkernel /* D/L GenKernel **/
genkernel --menuconfig all
ls /boot/kernel* /boot/initramfs* /* For Kernel name and the initrd generated **/
emerge coldplug /* D/L coldplug for autodetection of hardware and other components **/
rc-update add coldplug boot /* Adding coldplug to run at boot **/

26.) Adding some Extra- Services:-
emerge syslog-ng
rc-update add syslog-ng default
emerge vixie-cron
rc-update add vixie-cron default
emerge hotplug
rc-update add hotplug default
emerge reiserfsprogs
rc-update add reiserfsprogs default
rc-update add domainname default
Runs System services such as system logger, cron daemon , hotplug , reiserfs daemon , domainname.

27.) Add Driver Support.
emerge nvidia-kernel

28.) Add users:
1. Set root password:-

2. useradd <name> -m -G users,wheel,audio -s /bin/ash
passwd <name>

3. Machine Name:-
echo <name> > /etc/hostname
echo <name.com> > /etc/dnsdomainname

29.) Configure Grub:-
emerge grub
grub or manually edit /etc/grub/menu.lst

30.) Reboot and install packages:-
emerge -k xfree(or xorg) gnome mozilla openoffice-bin
Let them D/L and you have all that you need to get your system working. Of Course we need to configure xserver. Run xorgconfig or xf86config.
Hope the above was useful. Correct any mistakes please. ;)
Satissh S

Satissh S

@prakash: BTW I'm gonna install debian soon. Have ordered the two dvd's and will be installing them soon.:)


left this forum longback
:D Thanks for yet another review.I am going to install gentoo 2004.3(thats wat i got) this week or probably next week.U enjoy debian.. :wink: :D
b/w i have got universal install CD..so i think no need to download extra snapshots.....or is it necessary?whether U compiled Ur own kernel or genkernel...Thanks
Satissh S

Satissh S

No we don't have to download stages btw, we have to d/l snapshot b'coz when using emerge we have to have configure repos i guess.. I used genkernel as iam a bit afraid to do it myself but it has been explained very elaboratly in the handbook. Enjoy Gentoo.. meanwhile lemmy dive into a ocean of OSS Softwares.. Debian ;)


Broken In

recently, my X server crashed. And whenever, I login.., I was returend to text mode.

After that, I reinstalled the xserver by doing
rpm -xvf force xfreei386(something....i donnow exactly).

Then, xserver started running normally.
but now a new problem starts..

now I have lost the root account (and all the user accounts)..whenever I type in the username field as 'root' it says invalid name account...caps lock...etc......http://www.thinkdigit.com/forum/images/icons/icon8.gif

pls help..I already searched the net and found nothing.
I posted a thread here..no one responded..
Please help my dear friend..
thanks a lot.
Satissh S

Satissh S


Easy Way:-
there is a trick for resetting root password,
just pop in fc rescue cd and boot to rescue mode and execute the following command
$ chroot /mnt/sysimage
now ull be logged in the shell, type
$ passwd
ENTER NEW UNIX Password: <type_da_new_password>
RE-ENTER NEW UNIX Password: <type_the_new_password>
now u can activate the root acct.

DISCLAIMER: Iam not sure of the procedure as apparently i've not been to Fc or its rescue mode recently. :|

HARD Way but sure-shot solution:-
Use a live cd, such as ubuntu or lfs livecd to boot ur system.
Mount your system partitions in order using commands,
mkdir /mnt/hd
export new=/mnt/hd
mount -t <fs_name[1]> /dev/hdx_modify[2] $new
repeat the above for the different partitions u have,
use swapon to enable your swap partition
swapon /dev/hdx_modify[2]
mount the /proc partition, after mounting the root partition!!
mount -t proc none $new/proc
now use chroot to enter your new partition as root user
chroot $new /bin/sh
now execute,
Exit the chroot environment by,
this changes your root password.
now unmount everything, using
unmount $new/proc
unmount $new/modify[3]
swapoff /dev/hdx_modify[2]
repeat for all partitions
cd /
unmount $new
reboot, root password should work.
[1] fs_name refers to the filesystem of your partition, replace it with ext2, ext3 or reiserfs or leave it to automatically detect, simply by ordinary mounting.
mount /dev/hdx_modify[2] $new

[2] hdx_modify refers to your filesystems, replace with /dev/hda1 , /dev/hda2 , /dev/hda3 , /dev/hda4(/hda5,hda6..) as required.

[3] $new/modify refers to the partitions you mounted within the root system, like boot etc. Give accordingly.

If u feel uncomfortable, ask help from a lug, they will help surely.
Last edited:


Broken In
Thank you very much satissh...I will try your idea..think it shud work..

but, what is the problem is ..I know the root password...the login screen tells whenever I type 'root' and press 'enter', it says invalid user, not even asking for password (for all the user accounts too). I use Red Hat 9.

thank you.. I wud see whether ur solution works....lets see...
Satissh S

Satissh S

Iam unable to get u'r problem, it says user root not found??
maybe some problem in /etc/passwd or probably ur system is screwed up.
Again enter that chroot mode and backup ur data and install a newer distro. RH9 is old, but not gold :|
Thats all i have to say abt this weird problem :|
Satissh S

Satissh S

check if the file /etc/passwd contains the line,
else add it by editing within the chroot environment.
Weird, I seriously havent encountered this before :|


Broken In
hi sattish,

sure..100% its a weird one..

thank u very much for the ideas. I tried it but failed...
at last, I've decided to reinstall the software ( iam not goin to use redhat 9).

suggest me some good linux flavour.
my system config. is very low.
celeron 850mhz, 128mbram.
Not open for further replies.
Top Bottom