Suramya's Blog : Welcome to my crazy life…

August 4, 2012

Reinstalled system after accidental removal of KDE. Pleasantly surprised by ease of configuration

Filed under: Computer Tips,Knowledgebase,Linux/Unix Related,Tech Related — Suramya @ 11:19 PM

Last night I was trying out stuff on my computer and decided to install virtual box on the system to allow me to install Windows in a virtual environment. I ran the command to install virtual box and then said ok without paying too much attention to what it was doing. As a punishment for that, the apt-get program proceeded to uninstall most of the KDE environment on the system leaving me with Gnome as my primary desktop (and there is no way I am using Gnome as my primary desktop). I could have fixed it by reinstalling KDE but since I had been thinking about removing the 32 bit Debian and installing the 64 bit version I decided to use this opportunity to do so and downloaded the 64 bit version from the Debian site, put it on a USB drive and proceeded with the install which took about an hour to complete.

After the install completed, I upgraded the system to the latest ‘Unstable’ build (Debian Unstable has the latest software packages so I prefer using it as opposed to Stable which is rock solid but has fairly dated software versions.) which took most of the night thanks to the no of packages to download and install. Once everything was upgraded I started customizing my setup and initially was dreading the amount of time it would take to get both my monitors working (based on previous experience) but surprisingly this time I didn’t have to do a lot to get both the monitor’s working.

If you remember, the last time I tried enabling the second monitor I hit a lot of hurdles mostly thanks to the mess I had made with my previous meddling and experimentation but this time it was fairly simple. I thought that I would follow the same steps I had the last time I installed the monitor so I started by installing the fglrx driver but the latest version of the driver no longer supports my chipset (ATI RS880 [Radeon HD 4250]) and the installer told me to install the free Radeon driver in the package xserver-xorg-video-radeon instead. So I did that after purging the fglrx driver (See here for instructions). I also had to install the Firmware for the Radeon card which I did by issuing the following command:

apt-get install firmware-linux-nonfree

After the driver was installed I rebooted (to make sure all systems started up clean) and setup my dual monitors by following these steps:

  • Click on Start -> System Settings
  • Click on ‘Display and Monitor’ under Hardware.
  • Under ‘Size & Orientation’ change the ‘Position’ dropdown to ‘Left Of’ the first (If your second monitor is to the left of the first one)
  • Set the Primary output to the monitor where you want the Task bar etc to show up. If you don’t know which monitor is which, click on the identify Outputs button.
  • Once you are done, Click on ‘Apply’ and if all looks good you can set it as default by clicking on the ‘Save as Default button’.

If you are ok with the resolutions available to you in the dropdowns above then you are done and you can skip the steps below.

Unfortunately for me I wanted a resolution of 1440×900 as the default instead of 1600×900 which was too small & the fonts looked pretty bad at that resolution and the 1280×1024 which was the next available size looked worse because my of my monitor shape (16:9 resolution as opposed to 4:3). So I had to do a bit more work to fix the problem.

First I tried manually setting the mode to 1440×900 using xrandr but I got an error message that “xrandr ‘cannot find mode'”. So I did a little Google search and found a forum post where another person was having the same issue. That link told me how to add a custom mode to my system which I did using the following steps:

First we need to figure out if our configuration will support the mode we are trying to use and if so get the modeline we need for the new config, so we run this command:

cvt 1440 900

If the system can support the resolution specified (1440×900 in the above example) it will return a line that looks something like:

# 1440x900 59.89 Hz (CVT 1.30MA) hsync: 55.93 kHz; pclk: 106.50 MHz
Modeline "1440x900_60.00"  106.50  1440 1528 1672 1904  900 903 909 934 -hsync +vsync

Luckily for us my system can support the resolution so we then need to tell xrandr about the new mode using the following command:

xrandr --newmode "1440x900"  106.50  1440 1528 1672 1904  900 903 909 934 -hsync +vsync 

Where the first paramter (“1440×900” in this case) is an identifier and the rest is the information returned by cvt. (If successful the command will return no output.)

Then we need to tell the system that both the displays (called DVI-0 and VGA-0 on my system) should use the new mode which is accomplished using the following commands:

xrandr --addmode VGA-0  "1440x900"
xrandr --output VGA-0 --mode 1440x900
xrandr --addmode DVI-0  "1440x900"
xrandr --output DVI-0 --mode 1440x900

If the commands were successful then your screen should resize and start using the new resolution. Now that this is done we want this to happen everytime we log in without having to run the commands manually.

When you click on the ‘Save as Default’ button in the ‘Size & Orientation’ dialog box, KDE saves your settings in a file at the following location: ~/.kde/share/config/krandrrc that is executed everytime you log in to KDE. So to make the changes permanent we have to modify the file with the new settings.

The file contains the following lines right at the top:

[Display]
ApplyOnStartup=true
StartupCommands= 

We need to modify the StartupCommands= line to use our new settings. Basically it should contain all the commands we used above in a single line delimited by \n. On my system the file looks like the following after I updated it:

[Display]
ApplyOnStartup=true
StartupCommands=xrandr --newmode "1440x900"  106.50  1440 1528 1672 1904  900 903 909 934 -hsync +vsync\nxrandr --addmode DVI-0  "1440x900"\nxrandr --addmode VGA-0
  "1440x900"\nxrandr --output VGA-0 --pos 1450x0 --mode 1440x900 --refresh 59.9782\nxrandr --output DVI-0 --pos 0x0 --mode 1440x900 --refresh 59.9782\nxrandr 
--output DVI-0 --primary

Once you make the change, save the file and log out. After loging out I usually restart X to make sure everything came up cleanly and then if all went well then the changes should take effect after you log in.

Hope others find this useful when configuring their systems.

– Suramya

PS: The best part is that after re-formating and using the Opensource version of the display driver instead of the proprietary one, my average memory usage went down from about 3GB about 1GB with all the same programs running in the background. 🙂

1 Comment »

  1. […] for historic reasons. In the newer version of KDE the process is a lot simpler, please refer to this post for the updated steps – […]

    Pingback by Suramya's Blog » Configuring Dual monitors in Debian — August 4, 2012 @ 11:46 PM

RSS feed for comments on this post. TrackBack URL

Leave a comment

Powered by WordPress