Home page of this blog

Wednesday, September 30, 2009

Upcoming Ubuntu Karmic has 32 bit PAE kernel

Just stumbled upon a page that shows upcoming Ubuntu Karmic has pae kernel.

What it means to Ubuntu users is (I am excited) it will support more than 4 GB of RAM in 32 bit

Default generic kernel supports only upto 4 GB in theory, but in reality can allow only upto 3.2 GB RAM

The below link is where I saw about the pae kernel, you can also see by clicking below (this does not mean much, unless for owners of 4 GB RAM system or above and wants a 32 bit system)

http://packages.ubuntu.com/karmic/linux-image-2.6.31-11-generic-pae

Monday, September 28, 2009

Clearing cache memory in linux using sysctl

In linux, when we copy big files, the file's content gets cached in RAM for fast access eventhough we might not need it later in RAM. We can forcefully clear the RAM cache using sysctl

sudo sync && sudo sysctl -w vm.drop_caches=3 && sudo sysctl -w vm.drop_caches=0

The above line is a combination of three commands
1. sync --> to ensure any pending cache is flushed onto disk
2. sysctl -w vm.drop_caches = 3 --> to clear all caches (pagecache and inode/dentry caches)
3. sysctl -w vm.drop_caches = 0 --> reset the drop_caches to no clearing

The above command clears all caches from RAM. Beware, this clearing cache works in Ubuntu fine, but in other distributions maynot work fine
Screenshot showing free RAM before clearing cache
 
Screenshot showing free RAM after clearing cache
 

Ensuring data is written to pen drives in linux

Sometimes we copy data into pendrive from Ubuntu/Fedora or any other linux distribution.

Data is not written to usb pen drive immediately as it resides in main memory. If we remove the pen drive the data may not be there or only some part of data may be there which is called corrupted data.

If we try to unmount by right clicking the icon, we might get a dialog or a notification that data is being written and another prompt after the data is being written to indicate it is safe to remove the pen drive.
But it will be ugly to unmount and mount just to ensure data is written. Instead we can do it using commandline as follows.

sync

After typing this command in terminal, we need to wait for the command to complete. This will ensure any buffer in memory is actually flushed or synced to external devices like pendrives.

Saturday, September 26, 2009

Google Chrome the fastest 64 bit browser in Ubuntu Jaunty

Benchmarks of 64 bit browsers in Ubuntu Jaunty
Firefox 3.5 (shiretoko) does not have tracemonkey for 64bit and hence low scores in all benchmarks
 
In all the benchmarks, Google Chrome 4.0.213.1 beta won others and proved to be very fast (in my system)
 
 
Google V8 Benchmark
Winner: Google Chrome 4.0.213.1
  1. Google Chrome 4.0.213.1 --> Score 4518
  2. Shiretoko 3.5.3 --> Score 322
  3. Firefox 3.0.14 --> Score 281
  4. Opera 10 --> Score 248
 
 
Peacekeeper servicemark benchmarks of 64 bit browsers in Ubuntu Jaunty
Winner: Google Chrome 4.0.213.1
  1. Google Chrome 4.0.213.1 --> Score 4468
  2. Opera 10 --> Score 1885
  3. Shiretoko 3.5.3 --> Score 1668
  4. Firefox 3.0.14 --> Score 1257

Friday, September 25, 2009

Using Windows key in Ubuntu

This article assumes a gnome 2.26 or Ubuntu Jaunty for this to work. The article is useless for windows users, as they have WINDOWS key auto configured for them by windows.
 
I was wondering if we could use the WINDOWS key in Ubuntu and was discussing with my friend. We both thought of configuring it in our Ubuntu box. Here is how we did it.
 
In Ubuntu or GNU/Linux terminology WINDOWS key is called super key or considered as Mod4 key. The default layout does not assume, the keyboard has a WINDOWS key. We need to tell the keyboard layout to consider WINDOWS key is Mod4 key. So there are two steps
 
Step 1: configuring WINDOWS key in keyboard layout
 
Substeps in text and image
 
Open the following gnome menus and perform actions in order
 
System --> Preferences --> Keyboard -->
See the below image
--> Select Layouts tab from the keyboard dialog --> Click Layout Options button -->
See the below image
--> Expand Alt/Win key behaviour node-->
See the below image
--> Select from the radio group "Super is mapped to windows key"
See the below image
 
Step 2: configuring keyboard shortcut
 
This is simple. Open System --> Preferences --> Keyboard Shortcuts

See the below image
 
Now select any action for which we need to apply shortcut from the opened dialog. Press windows key along with any combination to set a new windows key shortcut. For example, I configured Windows + L for locking my screen which will be shown as Mod4 + L and Windows + D for show desktop which will be shown as Mod4 + D. See the below screenshot
 
And that is it. Close the dialog, now we can enjoy the unused WINDOWS key in Ubuntu (if you have windows, you will already know how to use Windows + L to lock, Windows + D to bring desktop, Windows + E to bring explorer ... all of which you can configure)

Hope this is an enjoyable read

Wednesday, September 23, 2009

Using fast concurrent command line download manager in Ubuntu

aria2 is a very powerful command line download manager. I use aria2 to download linux iso's. Here is an example how I used aria2 in Ubuntu to download Ubuntu Netbook Remix.
Step 1: Installing aria2 in Ubuntu Jaunty
This is very simple.
sudo apt-get install aria2
Step 2: Identify mirrorlist URL for the download
We need to identify mirrors all across the world, hosting our favorite download.
For example, Ubuntu Netbook Remix is hosted in different servers all across the world. The mirrors URL gives us easy access of all such servers hosting Ubuntu
http://www.ubuntu.com/getubuntu/downloadmirrors#mirrors
This needn't be Ubuntu iso, it can be any file which is mirrored/hosted in different servers across the world. This step just shows a URL which lists all such mirror servers hosting same version of file, here in this example Ubuntu Jaunty
Step 3: Pick 5 reliable nearby servers from the mirrorlist
In this step, we need to choose from the mirrorlist around 5 reliable servers.
The five servers should be different from one another
In this example, say I pick Japan, Finland, German, UK and Belgium servers
Step 4: Copy the download URL of the file we wish to download from each of the picked servers and note it
Here the URL we choose should be the complete download URL including the file name we intend to download.
For example, if I wanted to download Ubuntu Netbook Remix from the servers I chose in previous step (Japan, Finland, German, UK and Belgium), I need to note down the full path of the file I am downloading from each server. Let us say I noted down as follows in some editor
  1. Japan: http://ftp.riken.jp/Linux/ubuntu-cdimage/9.04/ubuntu-9.04-netbook-remix-i386.img
  2. Finland: http://www.nic.funet.fi/pub/mirrors/releases.ubuntu.com/9.04/ubuntu-9.04-netbook-remix-i386.img
  3. Germany: http://ftp.uni-kl.de/pub/linux/ubuntu.iso/9.04/ubuntu-9.04-netbook-remix-i386.img
  4. UK: http://mirror.ox.ac.uk/sites/releases.ubuntu.com/releases/9.04/ubuntu-9.04-netbook-remix-i386.img
  5. Belgium: http://ubuntu.mirrors.skynet.be/pub/ubuntu.com/releases/9.04/ubuntu-9.04-netbook-remix-i386.img
Step 5: Create a text file and store the 5 URL separated by tab
In this step, we need to open gedit or nano or vi editor and paste all the URL's we noted down each separated from one another by a tab
For example, in this case, I gave gedit urls.txt from command line and pasted the noted down URL's separated by tabs. It is very important that each URL should be separated from another by a tab and not a space
Example

http://ftp.riken.jp/Linux/ubuntu-cdimage/9.04/ubuntu-9.04-netbook-remix-i386.img http://www.nic.funet.fi/pub/mirrors/releases.ubuntu.com/9.04/ubuntu-9.04-netbook-remix-i386.img http://ftp.uni-kl.de/pub/linux/ubuntu.iso/9.04/ubuntu-9.04-netbook-remix-i386.img http://mirror.ox.ac.uk/sites/releases.ubuntu.com/releases/9.04/ubuntu-9.04-netbook-remix-i386.img http://ubuntu.mirrors.skynet.be/pub/ubuntu.com/releases/9.04/ubuntu-9.04-netbook-remix-i386.img

Save it and close the editor
Step 6: Start downloading using aria2 from command line
This is our final step. After saving the tab separated list of URL's in a text file, we need to pass that file as input to aria2
Open terminal (Key in Alt + F2 and type gnome-terminal in the text box to launch terminal)
Change to the directory where the tab separated URL file is saved. Let us say I saved urls.txt in Downloads folder then I type the following to change directory
cd ~/Downloads
Then use aria2c as follows to start downloading
aria2c -m0 -iurls.txt -c
Well that is it, do not close the terminal till the download completes. aria2c allocates the total size of the download first, then hits all the fully qualified URL's from the input file.
aria2c --> is the commandline aria2 download manager
-c --> this option asks aria2c to continue the download from where it left the download last time, we closed without completing download
-i --> the file which is passed next to -i should contain tab separated list of URL's from different mirrors. The default count of URL's expected by aria2c is 5 and aria2c opens 5 concurrent connections and hits each different server from different thread. If a server fails, that is peacefully ignored by aria2c. The concurrency count can be increased. Each conncurrent connection tries to fetch a segment of the big file from the serverlist thus reducing the bandwidth on server. It is like honeybee collecting nectar from 10 different flowers not stressing any of the flowers
-m --> tells how many times aria2c should retry failed connection, 0 means unlimited
There are other interesting params, which can be read from man aria2c
aria2c will utilize n concurrent threads and download the split segment of big file from n different URL's we gave inside the file. This way let us say I have a 2 Mbps download connection, aria2c will utilize 51 Kbps in each 5 concurrent thread equally and thus utilizing max download bandwidth totally.
Hope this helps, my next idea is to develop a QT based s/w for using aria2c from GUI. Maybe if I get it ready, I may publish that
Thanks for reading

Tuesday, September 22, 2009

Scanning for viruses, rootkits in Ubuntu Jaunty

A month back, I used a pen drive from a friend and came to know it had some windows viruses in it the next day. I laughed at my friend that it did not affect me nor did I see any virus. Anyhow, I got scared and wanted to make sure my Ubuntu had never any virus in it.

I did three things to absolutely make sure no viruses are there in Ubuntu

Step 1: Installing clamav antivius

Here is how
I installed clamav antivirus and scanned for antiviruses (Sure, My Ubuntu did not have any viruses!!)
sudo apt-get install clamav

Installing...
Installed
Scanning

First change to the directory which you want to make sure no viruses are there and issue
clamscan -r

To scan any folder clamscan -r will do and it will report if any viruses found. To scan a windows folder, first mount the windows partition (In Ubuntu Jaunty it is as easy as clicking the partition icon in nautilus (file manager) ), then change to windows folder and scan for viruses using clamscan -r
To scan /etc or other directories where only root has access a sudo clamscan -r will work the magic

Step 2: Scanning for rootkits

There may be some rootkits sitting in kernel, which can be checked using chkrootkit
To install chkrootkit
sudo apt-get install chkrootkit
Scanning for rootkits
sudo chkrootkit

Step 3: Enable ufw

A firewall allows us to control the network flow between host and internet. I have enabled firewall and have enabled only http and ssh (for doing secure shell from my small netbook). This is very simple as ufw (uncomplicated firewall) comes with Ubuntu by default.
To enable
sudo ufw enable
To add ssh
sudo ufw allow ssh
Above screenshot shows, enabling firewall, checking its status and deleting http allow rule. After adding/removing any firewall rules, restart firewall by disable and enable
Hope, this may help somebody to make absolutely sure (a security paranoid?) their Ubuntu is free of rootkits or viruses
Also may help some Ubuntu/Windows dual boot users to scan for viruses in their Windows partitions from Ubuntu using clamscan -r after mounting Windows partition which is just a click in Ubuntu!

Sunday, September 20, 2009

Fedora 11 rocks with KDE 4.3.1

Recently I was playing with Ubuntu Jaunty in my netbook and I made it totally useless by installing netbook launcher from synaptic. I could not see my gnome panel. I could have fixed it. But I used to try fedora 11 again on my netbook. I mounted Fedora 11 DVD iso in /var/www/ in my desktop (a core i7 desktop) then installed from network (home network)

Then to get wireless working I installed kmod-wl from rpmfusion. After rebooting I was surprised to see 2.6.30 kernel which is very new and I got wireless.

I wanted to try KDE 4.2 under Fedora 11 so installed KDE instead of gnome in fedora 11. I installed all updates overnight and came next morning to be pleasantly surprised to see KDE 4.3.1. Wow

Some screenshots below

I am enjoying KDE 4.3.1 in Fedora 11. Fedora 11 has latest KDE 4.3.1 , Firefox 3.5.1. Also openoffice is 3.1. Fedora 11 is very snappy than Ubuntu Jaunty in this netbook. I am thinking of going with Fedora 11 in my core i7 desktop (I am very lazy to reinstall/remove Ubuntu from it)


I had enabled presto (delta updates) by installing presto plugin

sudo yum install yum-presto

Fedora 11 did the update around 1GB very fast as it used presto (delta updates) It updated only around 500 MB instead of 1 GB. And the reason for fedora snappiness may be due to its i586 architecture instead of i386. Also after upgrading default swappiness in Fedora 11 has been modified to 40 from 60!!

Commmand to know swappiness of system

sudo sysctl -q vm.swappiness

Only glitch I faced is while playing videos/audios in VLC as it had a buggy pulse audio implementation. Just for VLC sake, I disabled pulseaudio and everything works fine. To disable pulseaudio I removed alsa-plugins-pulseaudio package

suspend/resume works great on this netbook with Fedora 11

Fedora 11 rocks