Wednesday, June 29, 2011

Tweaking Ubuntu

What do GRUB, Nvidia, GDM, Brightness and SSDs have in common? You need to know some tweaks to make them work as you'd expect them to.

I'm an Ubuntu user since, erm... Ubuntu 8.04? I don't know. However, I wasted hours and days installing, wiping, installing, wiping, installing again and tweaking it. From now on I'll try to post all the tweaks I come across here on my shiny new blog. Read on...

So, the first tweak isn't really to be considered as a tweak. In fact it's a good prevention from being fooled by your coworkers.

Disabling accessibility in GDM
You ask why the hell one would want to disable such a great and useful feature? Well, take my laptop, lock its screen (CTRL + ALT + L, by the way) and hand it over to some of my best friends. As a result you get an unusable laptop back because enabling all the accessibility features at once and moving the virtual keyboard around makes it impossible to log in again (I think it was due to a faulty graphics driver).

Enough thrilling story. Here's how you can disable accessibility in GDM:
sudo gedit /var/lib/gdm/.gconf.mandatory/%gconf-tree.xml
Now search for "accessibility" and set "enable" to "false". It should look like this afterwards:
<dir name="accessibility">
<dir name="keyboard">
<entry name="enable" mtime="1306265153" type="bool" value="false">

Done. Enjoy your unhackable GDM.

Ugly boot screen after enabling Nvidia drivers
Without any further blabla:
wget +x fixplymouth./fixplymouth

The script will ask you for the resolution to set. Use your current screen resolution if it shows up in the list the script spits out. Otherwise use a resolution smaller yours. Also, the higher the bits (8, 16, 24) the better.
If you don't know what resolution to use open nvidia-settings, click "X Server Display Configuration" and look at the list at "Resolution".


Adjust your display's brightness automatically
To do that we need to install a tool called redshift:
sudo add-apt-repository ppa:jonls/redshift-ppa
sudo apt-get update &amp;amp;amp;&amp;amp;amp; sudo apt-get install redshift

Either manually start it using something like redshift -l 48:16 (where "-l X:X" stands for your current position's latitude and longtitude) or add it to your startup applications.

"Unlock your keyring" a thousand times
One bug "feature" I've been suffering for a long, long time: You need to keep all your passwords within one (1!) keyring, or Ubuntu will bug you with a thousand password dialogs after every single login again and again... and again.
This is what your "Passwords and Encryption Keys" screen should look like

Non-sliding background with Compiz
You're annoyed of your background sliding around when you're switching workspace? Install Compiz configuration manager (sudo apt-get install compizconfig-settings-manager), open it (ccsm), find a plugin called "Desktop Wall" and copy "type=Desktop" into the "Non sliding windows" field in the "Viewport Switching" tab. That's it.

Get lifetime and performance out of your SSD
Congratulations! You did the only correct thing and bought yourself a SSD. Booting up should take only a few seconds now (really!).

At first, do a backup (really, I almost crashed my laptop because I did one little mistake):
sudo cp /etc/fstab /etc/fstab.bak

Now open fstab (sudo gedit /etc/fstab) and find the line that's responsible for mounting your root ("/"). It should look like this:
UUID=b0620914-3943-4cdd-bcf8-00909575c43c / ext4 errors=remount-ro,user_xattr 0 1

Add "discard,noatime,nodiratime," in front of "errors=remount-ro,user_xattr 0 1" like this:
UUID=b0620914-3943-4cdd-bcf8-00909575c43c / ext4 discard,noatime,nodiratime,errors=remount-ro,user_xattr 0 1

Next step is to edit /etc/rc.local (sudo gedit /etc/rc.local). Add the following text before "exit 0":
echo deadline &gt; /sys/block/sda/queue/scheduler
echo 1 &gt; /sys/block/sda/queue/iosched/fifo_batch

Speed it up no matter if you run a HDD or SSD
Open your /etc/fstab again (sudo gedit /etc/fstab) and append the following line:
tmpfs /tmp tmpfs defaults,noatime,mode=1777 0 0

If you want some more detailed instructions or you want to know what you're actually tweaking visit or How To Geek.

PS: Don't forget to reboot your machine now. ;)

Further reading...


  1. The SSD section got me to finally spend the few minutes to tweak my SSD performance. I doubt I'll notice much improvement, I mean I hardly noticed an improvement with my SSD over an HDD (probably due to not paying attention), but even the unnoticeable improvements are still improvements.

    Before I reached the bottom and saw the link for detailed instructions, I was wondering what exactly everything did and Googled it and came across this: - I find it to be much better than the translated instructions.

    As for the other sections, I either already know it or it doesn't affect me much if at all. Great stuff though!

  2. Thanks for pointing this out! I've added your link. :)