Force startx to run X in a specific resolution and refresh Rate

28,523

Solution 1

Before saying anything, I should recommend you backup xorg.conf file using the command

sudo cp /etc/X11/xorg.conf /etc/X11/xorg.conf_backup

Next, to make any changes it is recommended to stop Xorg (which will bring you to a text-only screen) using the command

sudo /etc/init.d/lightdm stop

(Hopefully you are running Ubuntu 12.04 or 11.10. If not, just substitute lightdm for gdm or kdm if running kde). After that, you can edit your configuration file via

sudo nano /etc/X11/xorg.conf

From there, look for the Subsection Display, then navigate down to modes where you will type in your custom resolution with the refresh rate. Then save it, and restart X.

If none of that worked, and I completely screwed your xorg over, you can restore the backup (thank god for backups) using the command

sudo /etc/X11/xorg.conf_backup /etc/X11/xorg.conf

Solution 2

If you are using nvidia drivers read my answer 22 at this link

Share:
28,523

Related videos on Youtube

BhaveshDiwan
Author by

BhaveshDiwan

A programmer... Nocturnal.... Avid listener of Hindustani classical music. Hire me!? I do not support any war, whatsoever, Period. My Avatar image 'Z' is the logo since 2011 of a website I own.

Updated on September 18, 2022

Comments

  • BhaveshDiwan
    BhaveshDiwan over 1 year

    From my past experience (using Win-Xp), this particular monitor works only on 60Hz , Best resolution being 1024x768.

    I have "installed and configured" Ubuntu 12.04 Minimal (on USB stick) so that most of the time terminal is used, however, whenever there is a need to enter GUI, I may issue startx command to go into gnome.

    However the problem is that on this particular system, issuing this command poses problem because its default refresh rate won't synchronize with the monitor. The display keep on flickering and utterly unreadable. It is visible that gnome has been loaded and default wallpaper and desktop items are visible. But the problem is due to refresh rate different than 60Hz.

    I am looking for a command attribute to startx command which will force the refresh rate to 60Hz and resolution preferably to 1204x768

    I can open terminals with Ctrl+Alt+T and enter commands.

    Key combinations like Ctrl+Alt+NumPlus works flawlessly in distributions like solaris, but it's not working for me. Also the commands like xrandr -r 60 60 being refresh rate wont work.

    The same problem is faced even when I boot from a live CD

    • Admin
      Admin almost 12 years
      xorg.log please
    • Admin
      Admin almost 12 years
      Not sure this can be done with startx itself, but you can probably set up the appropriate xrandr command in an .xinitrc to do it.
    • Admin
      Admin almost 12 years
      @Mitch How may i get the log from a live CD??? moreover its almost impossible to store and post this log from a live CD for I am not having any GUI to get to a browser to approach the storage device to store the log
    • Admin
      Admin almost 12 years
      @Bryce I tried xrander as an attribute, How should i incorporate it on the .xinitrc file?? 60Hz ~ 1024*768 will be perfect!
    • Admin
      Admin almost 12 years
      I think just appending the line 'xrandr --output VGA1 --mode 1024x768_60' into ~/.xinitrc ought to do it.
    • Admin
      Admin almost 12 years
      For getting the Xorg.0.log, you mention you mostly use it from the terminal? So run startx one time and then cancel/kill it. Then from the terminal do 'sudo apt-get install pastebinit; pastebinit /var/log/Xorg.0.log'.
    • Admin
      Admin almost 12 years
      @Bryce , does this hold true with a live CD. where will it be logged under pastebin?
    • Admin
      Admin almost 12 years
      Yep, will hold true with a live CD too. pastebinit will post the log to a website and give you a URL you can paste in here for people to look at.
    • Admin
      Admin almost 12 years
      Nan, not working for me.. even the internet is sluggish and since i am unable to get a properly loaded GUI, i can't even troubleshoot the internet... any guidance for I may blindly enter the terminal ctrl+alt+T and give some command to change the refresh rate + resolution... I am utterly bugged by this system now... :-\
    • Admin
      Admin over 2 years
      What's wrong with: startx /bin/bash adj-dimension-then-exec.sh -- :1 ?