Archive

Archive for the ‘Linux’ Category

Speeding up Firefox under Ubuntu

February 14th, 2010 Mohammad Al-Shami No comments

Ever wonder why browsing under Ubuntu is slower than Windows even on the same network? Well, it has to do with Ubuntu enabling IPv6 by default. This means Ubuntu will try IPv4 only after IPv6 times out. Also, Firefox comes built with Pango by default which makes it slower than it should be. I’ve fixed that on Karmic Koala, other versions should be similar. Here’s how to do it:

Disable IPv6 globally:

sudo vi /etc/default/grub

then find

GRUB_CMDLINE_LINUX_DEFAULT="quiet splash"

and replace it with

GRUB_CMDLINE_LINUX_DEFAULT=”ipv6.disable=1 quiet splash”

Then update grub from the command line

sudo update-grub

Tell Firefox not to load Pango:

vi ~/.bashrc

and add

MOZ_DISABLE_PANGO=1

at the end

Tweak Firefox’s about:config settings:

network.http.pipelining -> True
- network.http.pipelining.maxrequests -> 8 or 10
- network.http.proxy.pipelining -> True
- network.dns.disableIPv6 -> True

Enjoy

Categories: Linux Tags:

Cleaning up your boot partition with Ubuntu

December 25th, 2009 Mohammad Al-Shami No comments

If you haven’t reinstalled Ubuntu in a while, the /boot partition will eventually fill up with all the updated kernels, and you’ll get an error when trying update.

At first I used to uninstall the old kernels manually but being lazy I think it’s too much work. When you get the error with update-manager or Synaptic try this:


sudo aptitude search linux -w 160 | egrep '(image|headers|restricted)' | egrep '^i' | grep -v 'KERNEL_VERSION' | grep -v -P '[^\d]-generic' | grep -v linux-restricted-modules-common | sed 's/i A/i  /' | awk '{print $2}' | xargs sudo aptitude remove

Replace “KERNEL_VERSION” with your currently running kernel.

This might break your grub configuration but update-manager will fix that for you so no need to worry. Just make sure you run this BEFORE update-manager does the update.

To be honest I didn’t try this without “grep -v ‘KERNEL_VERSION’” so I’m not sure if removing it would break something. Just leave it there to be safe.

Categories: Linux, Technical Tags:

Empathy, the new kid on the block

February 5th, 2009 Mohammad Al-Shami No comments

If you’ve used Linux as a desktop, you’ll know it’s only playing catch-up when it comes to instant messaging. I’ve been using Pidgin since was called Gaim, I think I started using it back in 2003. I love how minimalistic it is. Sadly the developers are going nowhere with it, at least that’s my (as well as a few others) humble opinion.

I stumbled upon this post which mentions a new (or maybe just new to me) client called Empathy. After playing with it for a few days now I think it has great potential. It’s still pretty basic but also under heavy development. It’s very minimalistic and uses the Telepathy library, which IMHO is a better approach than Pidgin’s libpurple.

It still doesn’t have proxy support, but you can work around that, at least for MSN and Gtalk, the protocols that I use. Here is how I did it it:

Gtalk: Just create a tunnel with SSH


ssh -C -q -f -M 0 -N -L 5223:209.85.137.125:5223

Where 209.85.137.125 is the IP address of talk.google.com, then set the account to use localhost as a server

MSN is a little different, this trick didn’t work because the client connects to a login server, which redirects the client to a different server. MSN is implemented using the telepathy-butterfly executable. Just use a socks server like this:


mv /usr/lib/telepathy/telepathy-butterfly /usr/lib/telepathy/telepathy-butterfly-old
vi /usr/lib/telepathy/telepathy-butterfly

#!/bin/bash
exec /usr/bin/tsocks /usr/lib/telepathy/telepathy-butterfly-old

chmod +x /usr/lib/telepathy/telepathy-butterfly

Enjoy :)

Categories: Linux Tags:

Google Chrome on Ubuntu

September 5th, 2008 Mohammad Al-Shami 2 comments

I came across this guide about installing Google Chrome under Ubuntu. It is somewhat slow, slower than Windows and much slower than Firefox but it still works, well, kinda. You have a few problems with fonts, as well as sites that don’t work properly with Chrome yet. I’m sticking with Firefox for the time being, but at least I have an option for those sites that aren’t compatible with it.

I wrote this post from Chrome, so yeah, it does work :)

Categories: Linux, Technical Tags:

Slow Browsing Under Ubuntu

August 23rd, 2008 Mohammad Al-Shami 2 comments

EDIT: This post only covers IPv6, please check the update post which covers IPv6 and Firefox

Today when I rebooted to my Windows installation which I very rarely do, I noticed that browsing under Windows feels much faster than under Ubuntu. After booting back to Ubuntu I noticed the “looking up domain.tld” part was taking a lot of time, which seemed a little odd.

Anyways, after some googling I found out that Debian enables IPv6 by default and uses that before and uses it before IPv4. A quick remedy was:

sudo vi /etc/modprobe.d/bad_list

#Add this line
alias net-pf-10 off

After which you should reboot your system. Now browsing feels much faster. To speed it up a little I installed a local caching DNS server which works like a charm. A quick HOWTO can be found here

Hope this helps.

Categories: Linux, Technical Tags: , , , ,

Microsoft Keyboard Function Key Fix

July 14th, 2008 Mohammad Al-Shami 1 comment

I’ve owned a Microsoft MultiMedia Keyboard 1.0A for years now. It’s a well belt keyboard to say the least. Only one problem though, the “F Lock” key. As a Linux user I have no use for the “Special” keys Microsoft added to the keyboard, and the button always starts turned off, no way to fix it.

I used to keep my PC on at all times so I only needed to press that button every couple of months, or when I want to take a screenshot, but now I started to turn it off at night, and having to press that stupid button every time I boot my system is a huge pain in the butt.

I found a fix for it here and thought I should share

vi /usr/local/bin/f_lock_fix
setkeycodes bb 59 # Help  -> F1
setkeycodes 88 60 # Undo  -> F2
setkeycodes 87 61 # Redo  -> F3
setkeycodes be 62 # New   -> F4
setkeycodes bf 63 # Open  -> F5
setkeycodes c0 64 # Close -> F6
setkeycodes c1 65 # Reply -> F7
setkeycodes c2 66 # Fwd   -> F8
setkeycodes c3 67 # Send  -> F9
setkeycodes a3 68 # Spell -> F10
setkeycodes d7 87 # Save  -> F11
setkeycodes d8 88 # Print -> F12
chmod 700 /usr/local/bin/f_lock_fix

Now add this to your startup file “/etc/rc.local” or equivalent

if [ -x /usr/local/bin/f_lock_fix ]; then
	echo "Fixing the F-Lock scan codes for F1-F12 keys...";
	/usr/local/bin/f_lock_fix;
fi

Surround sound under Ubuntu Hardy Heron

April 27th, 2008 Mohammad Al-Shami 4 comments

Been using Ubuntu Hardy Heron for about a month now, and I have to say it rocks, the best Desktop Linux so far.

Anyways, I have a Creative Audigy 2 card since I’m not a fan of software mixing under Linux, which is connected to an old creative 4.1 set. Since I don’t have any space I hooked only the front speakers and use the rear channels with a headset. After upgrading to Hardy I couldn’t get the headset to work. I just found the solution on the Ubuntu forums and thought I should document.

The new Ubuntu uses PulseAudio as it’s default sound engine, you can set volume levels for each application separately which is cool if you ask me. PulseAudio uses 2 channels by default. All you have to do is change:

; default-sample-channels = 2

To:

 default-sample-channels = 6

In /etc/pulse/daemon.conf, then restart gdm and you’re done

Booting Windows and Linux using the NT loader

April 20th, 2008 Mohammad Al-Shami No comments

I recently decided to install Windows on my home PC since I wanted to play some games, it’s been about 3 years since I started using Linux exclusively but thought a change would be nice. Since I didn’t find good guides I decided to write my own :)

Why would you want to do that? Well, back when I used to dual boot on a single drive I used to re-install Windows very frequently. Windows wipes out grub during installation so I needed to keep grub on a separate partition.

This guide assumes you have 2 hard drives; one for Linux and the other for Windows, you can do the same with a single drive but with minor changes.

Install Windows on the first hard drive
Install Linux on the second drive, and install grub on the master boot record of that drive
Download Grub4Dos
Save grldr and menu.lst to C:\
Edit menu.lst and put the following:

title Linux
chainloader (hd1)+1
rootnoverify (hd1)

Edit your boot.ini and add the following line:

C:\GRLDR="Linux"

Another way to do this is using bootpart. Make sure to install grub on the first sector of the boot partition because bootpart can’t read master boot records.

Some Gnome key binding tips

April 8th, 2008 Mohammad Al-Shami No comments

A few days ago I decided to bite the bullet and upgrade from Ubuntu 7.04 to 8.04. I’ve been using IceWM for a while and thought I should give Gnome a try. I’m used to Win+Something shortcuts so I wanted to implement those under Gnome. Here is a list of shortcuts that should cover the concepts:

Win+Q: Terminal (With some specific options)
Control+Alt+W: Amarok (The W is from my Windows days, from Winamp :) )
Alt+F5: Toggle window maximized mode
Win+[ZXCVB]: Playback controls for Amarok
Win+R: Run dialog

Let’s begin

  • Open gconf-editor and go to global_keybindings.As you can see the format isn’t hard
  • Set the value of run_command_1 to “<Super>q” and the value of run_command_2 to “<Alt><Control>w” without the quotes (Those correspond to Win+Q and Control+Alt+W)
  • Now go to keybinding_commands
  • Set the value of command_1 to “xterm -ls -fg white -bg black -cc 33:48,37:48,45-47:48,38:48,58:48″ and the value of command_2 to “amarok” without the quotes. Now test Win+Q and Control+Alt+W
  • Go to windows_keybindings
  • Set the value of toggle_maximized to “<Alt>F5″. Now test
  • Run dialog is set using panel_run_dialog under global_keybindings, I set it to “<Super>r”. Amarok sets the playback keys by default, but you’ll notice that both Win+R and Win+V don’t work. This happens because Compiz is the default window manager now. To fix this install compizconfig-settings-manager, go to “Advanced Desktop Effects Settings” and disable “Enhanced Zoom Desktop” or change the key bindings. This will free both key bindings so you can use them here

Edit: A weird thing happened to me today, I set the “Visual Effects” in appearance to “None” and suddenly my shortcuts stopped working. The solution to this is simple, make sure you use “<Super>r”, not “<Super> R”; Note the extra space before the “R”. Omitting this space works in both cases, something to keep in mind.

Categories: Linux Tags: