Get rid of freeze-ups during disk I/O activity in Ubuntu

If you are using Ubuntu(or it’s variants), and your computer locks/freezes up or becomes unusable during copying files or heavy disk activity, this post is for you.

Ubuntu currently employs the kernel default I/O scheduler, CFQ or Completely Fair Queuing. It has been known to cause lags and lock-ups during heavy disk activity like copying/moving or backing up data, and one (still-active) bugs report demands the use of an alternative I/O scheduler by default in future Ubuntu releases.

Personally, my computer became virtually unusable during moving/copying files and it has been completely eradicated by the use of an alternative scheduler, Deadline. I’ll be using it for the examples here. Other alternative I/O schedulers include :

  • noop
  • anticipatory

At first, you need to check whether you really benefit from the use of an alternative i/o scheduler. To do this, run this from the console :

echo "deadline" | sudo tee /sys/block/sda/queue/scheduler

Now copy a large file to/from your hard drive. If the lock-ups vanish, this has worked for you. Now, we need to make this permanent for your system. To do this, you need to know which version of Ubuntu you are using. If you are using Ubuntu 9.10 (Karmic Koala) or higher, you will be using Grub2, else you’ll be using Grub Legacy. I have got instructions for both.

For Grub2 :

gksudo gedit /etc/default/grub

For Kubuntu and Xubuntu, you will need to use kdesu kate and gksudo mousepad in place of gksudo gedit respectively.

Find :

GRUB_CMDLINE_LINUX_DEFAULT=""

Add elevator=deadline before the end of the closing double-quotes. For me, after the edit, that line looked like this :

GRUB_CMDLINE_LINUX_DEFAULT="quiet splash elevator=deadline"

After you are done, save and close the file. Now run “update-grub” from the terminal.

sudo update-grub

You’ll get something like this :

Generating grub.cfg ...
Found linux image: /boot/vmlinuz-2.6.31-20-generic
Found initrd image: /boot/initrd.img-2.6.31-20-generic
Found memtest86+ image: /boot/memtest86+.bin
done

It means grub.cfg has been rebuilt successfully. You are now good to go.

For legacy Grub :

gksudo gedit /boot/grub/menu.lst

For Kubuntu and Xubuntu, you will need to use kdesu kate and gksudo mousepad in place of gksudo gedit respectively.

Find the kernel line for your current kernel. It will be something like :

kernel /boot/vmlinuz-2.6.12-10-386 root=/dev/hda2 ro quiet splash

It will differ according to the kernel version and the logical drive to which Ubuntu is installed. Now add elevator=deadline to it. After the edit, it should look like this :

kernel /boot/vmlinuz-2.6.12-10-386 root=/dev/hda2 ro quiet splash elevator=deadline

Reboot your system and you are good to go.

Loving the Penguin

Windows XP has been replaced by Ubuntu Linux as my choice of primary operating system. I have been using it for the last three months and the experience has been amazing. The startup/shutdown happens in an instant, the machine is more responsive and it’s a good feeling to know that you are using open source software.

I’m using Xubuntu 9.10 (a variant of Ubuntu for slower systems) since my 2.8 GHz Prescott- 256 MB machine is underpowered to run Ubuntu. You can surely expect a lot of Ubuntu-related articles in the coming months.

.htaccess archived on AskApache.com

AskApache searchAn old copy of my .htaccess for AnimorphsfanForum.com seems to have been archived on AskApache.com.

http://static.askapache.com/htaccess-files/htaccess-sample.txt

I hope that it is helping some people.

Update : Following this post, the .htaccess was removed from the site. You can still search for it using Google, though.

The AskApache.com admin has kindly informed us that the file was mistakenly not moved over during a host switch. It has been restored now.

Fixing “Windows Help and Support has stopped working”

Sometimes Windows gives the error message :

Windows Help and Support has stopped working – A problem caused the program to stop working correctly. Windows will close the program and notify you if a solution is available.

The Help and Support center stops to function after this. Here’s how to resolve it.

Open up the command prompt by going to Start>Run>cmd. Type the following commands one by one :

net stop helpsvc
cd /d %windir%\pchealth\helpctr
rd packagestore /s /q
cd binaries
start /w helpsvc /svchost
netsvcs /regserver /install

After doing this, open the Task Manager by pressing [Ctrl]+[Alt]+[Del]. Go to the Processes tab, select the following process and stop them by pressing the [Del] key.

helpsvc.exe
helphost.exe
helpctr.exe

Start the command prompt again, and type in :

net start helpsvc

Windows Help and Support should be back to it’s previous self again.

Drive showing “Open with” instead of opening

Last night, I cleaned up a virus infection in one of my friends’ portable hard drive. After cleansing the drive of all malware, I found that I couldn’t open the drive by double-clicking on it, or even by right-clicking on it and selecting “Open” or “Explore”.

Here’s what to do if such a thing happens :
(We will assume that the drive which is malfunctioning is denoted by L:)

  • We need to delete the autorun.inf file(if any) in the root of the drive and replace it with an empty one.
  • To do this start command prompt by going to Start-> Run-> cmd.
    Type in the lines of code one by one.

    L:
    attrib -S -H -R autorun.inf
    del /F autorun.inf

    We have now successfully deleted autorun.inf from the root of the drive.We now need to create an empty autorun.inf in the root.

    copy con autorun.inf
    Press “Ctrl+Z” and then “Enter” key.

    Now try to open the drive. If this method doesn’t work, don’t worry, we have more where that came from.

  • We will now re-register the .DLL files in hopes of fixing this issue. Go to Start >Run. Type in regsvr32 /i shell32.dll. You should get a dialog box as shown below.

    RegSvr32

    Now try to open the drive. If it opens, you are in luck. If it doesn’t, don’t fret. We have some more tricks up our sleeve.

  • Start the registry editor by going to Start >Run >regedit. When the registry editor opens, press Ctrl+F, and search for MountPoints2. Delete all MountPoints2 keys you find. After you are done, close the registry editor. Now your drives should open normally.

If you have any queries, or you know of another way to fix this issue, feel free to leave a comment.