So I installed LUbuntu 11.04 on my VirtualBox. I couldn't find the 1366x768 resolution so I installed Guest Additions but it wasn't there. So I used this code to set the correct resolution:

gtf 1366 768 60
xrandr --newmode "1368x768_60.00"  85.86  1368 1440 1584 1800  768 769 772 795 $
xrandr --addmode VBOX0 1368x768_60.00
xrandr --output VBOX0 --mode 1368x768_60.00

The problem is that I can't find a way to save this information for the next reboot. I tried on .xinitrc and nothing happens. Then I tried on .bashrc but it's not working, I need to start a console before this commands are executed.

  • You could try putting those commands into your /etc/rc.local. – onse Jan 16 '12 at 20:00
  • I edited the file and I changed the execution bits but it's not happening. Maybe LUbuntu works differently. – dierre Jan 17 '12 at 9:18

I was trying to change the default resolution of LXDE on Ubuntu (LXDE is also used in Lubuntu) and I found a solution for this problem. I also have Lubuntu installed and I've checked that this file actually exists which it does (Ijust tried this fix as well and it worked).

So, the fix....

  1. Open up a terminal, press ctrl+alt+t
  2. I'm guessing you have a default Lubuntu install, so "Leafpad" would be your default editor, type/copy this into the terminal and press enter... (you may be asked for a password)

    sudo leafpad /etc/xdg/lxsession/LXDE/autostart
  3. Now add your commands to the bottom of the file adding a @ before the actual command. Mine looked like this after...

    @xscreensaver -no-splash
    @lxpanel --profile LXDE
    @pcmanfm --desktop --profile LXDE
    @xrandr --auto --output DVI-1 --primary --mode 1680x1050 --left-of DVI-0
| improve this answer | |
  • 1
    Worked like a charm. – dierre Mar 3 '12 at 9:43
  • @captain_G I have no LXDE directory only a Lubuntu and Lubuntu-Netbook directory. What should I do? – Jürgen Paul Aug 4 '12 at 3:43
  • @Severus - Open your terminal as above. type "cd /etc/xdg/lxsession/". That should take you to lxsession directory. Now type "find -name autostart". Hopefully that should show you the directory with autostart in. If I remember correctly I 2 directories you have are for the different sessions available. You could add it to both of them or just the one you are using. Hope this helps (sorry for the late reply!) – captain_G Aug 26 '12 at 21:02
  • @xrandr -s 1440x900 worked in an old legacy linux in vmware – Stuart Cardall Mar 7 '18 at 12:15

I personally put those sorts of commands, to be run at login, in a script in ~/bin , call it set_resolution

Then run gnome-session-properties and add the command to be run at login (use ~/bin/set_resolution).

enter image description here

| improve this answer | |
  • 2
    It's LUbuntu, non Ubuntu, so I do not have gnome-session-properties – dierre Jan 17 '12 at 9:05
  • 1
    Openbox (Lubuntu) uses ~/.config/openbox/autostart – Panther Jan 17 '12 at 15:53
  • still not working. I've added ~/.config/openbox/autostart then chmod u+x but at reboot nothing is happening. – dierre Jan 17 '12 at 16:46

Here's another line added to my /etc/xdg/lxsession/LXDE/autostart file to get it working:

@xrandr --output LVDS --off

tip from: http://lists.freedesktop.org/archives/xorg/2007-August/027490.html

Update: the above was fine for awhile until I ran the GUI config tool lxrandr, which seems stupidly unaware of dual-monitor setups. So I made this change:

$ cat $HOME/.config/autostart/lxrandr-autostart.desktop

[Desktop Entry]
Name=LXRandR autostart
Comment=Start xrandr with settings done in LXRandR --then manually tweaked
Exec=xrandr --output DVI-0 --mode 1920x1200 --rate 60.0 --output LVDS --off --output VGA-0 --primary --mode 1920x1200 --left-of DVI-0

Note that I'm running Ubuntu 12.04 with LXDE. One would hope that a pure Lubuntu 12.04 setup would include a smarter lxrandr binary...


This page helped me : https://wiki.ubuntu.com/X/Config/Resolution

I ended up putting my changes in ~/.xprofile

| improve this answer | |
  • Had the same problem as dierre, I couldn't get the xrandr settings to stick in Lubuntu 13.10, and people suggested autostart etc. However, adding the commands to .xprofile finally worked for me. Thanks! – Beamie Jan 19 '14 at 17:38

If anyone is still struggling with this, I tried everything I could find with no luck (I put the command line into so many files I lost count). In the end I found an easy solution through trial and error and I would try it first before all the other stuff.

Open a terminal and test the xrandr command (as have been posted by others). I am using Lubuntu on an old system just to give it a bit more life and have an old monitor rigged to it so my cmd line to change the resolution was

xrandr --auto --output VGA1 --primary --mode 1158x864

didn't add any of the other stuff.

Then went to start->preferences->Default Applications For LXSession

Selected "autostart" menu then put the exact command line code into the white text box and clicked "add".

Rebooted and success!!!

| improve this answer | |

The only method that worked for me, was:

  1. run the necessary commands to get the new mode through cvt and xrandr, explained here: https://wiki.ubuntu.com/X/Config/Resolution#Adding_undetected_resolutions
  2. paste them in a .sh file, like set_resolution.sh, as an example it would look like this:

    xrandr --newmode "1920x1080_60.00" 173.00 1920 2048 2248 2576 1080 1083 1088 1120 -hsync +vsync
    xrandr --addmode HDMI-1 1920x1080_60.00
    xrandr --output HDMI-1 --mode 1920x1080_60.00
  3. go to Menu -> Preferences -> DefaultAplications for LXSession -> Core Applications, and there, scroll down to Xrandr white block, it should be empty, and add the path of the .sh file where you saved it.

  4. reboot!

I'm Using LXDE9.0 with openbox on a Asus's TinkerBoard. Tried modifying the ~/.xprofile, autostart in /etc/xdg/lxsession, autostart of openbox, xinitrc, and none of them worked for me. this is only for a session, not global for all users, but it would do the trick faster than going on xorg.conf file that was the last option that i didn't try.


| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.