Saturday, September 29, 2007

Bash's noclobber

If there is something I don't miss is a chance of thumbing through a new book. It always seems that I never have enough money to buy them all, so the resort to the next best option. To seek out engineering students who buy books in the feverish days before the examinations only to banish them to the dark and dusty corners. Needless to say these are technical books explaining basics of languages or Unix shell environment, a particular favorite of mine.
Perhaps it is my insatiable curiosity that drives me to read all books even the 'for Dummies' books which are looked down with disdain by other geeks, I find them amusing and entertaining.

Lately I have started noticing that some information was missing here and there. For instance, the setting of no clobber of existing files is nowhere to be seen in shell books these days , I guess the authors of these technical books consider it unimportant and almost trivial.

The no clobber setting however is life saving sometimes, it prevents accidental overwriting of existing files while using IO redirection on bash shell or badly written shell scripts. It is better to set it with set -C than losing a very important file .

$ set -C # Enable it $ ls > foo bash: foo: cannot overwrite existing file $ set +C # Disable noclobber $ ls > foo # exiting file overwritten!!!

Just include a line with set -C option somewhere in .profile or .bashrc file inside your home directory.

Wget Re-tries!!

Its just that kind of day, nothing just works. I need to get this huge source pack and the Internet connection is acting up again. I have long since given any hope of ISP fixing the connection timeouts and total connection failures.

So, the wget program grabbing the file from the Internet running in background sputters after 20 or so tries and gives up. This calls for extreme measures.

$ wget -t 0 -c http://examplesite.com/pub/xxxx.bz2

The -t ( --tries ) set to 0 (zero) which means it keeps on trying infinitely until the hell freezes over. And -c ( --continue ) is to continue grabbing the half downloaded file.

Friday, September 28, 2007

Install Debian from Web in Windows

While going through old archives of emails I didn't read I stumbled upon this announcement of Debian-Installer Loader, a win32 loader for Debian Installer.

This is very good tool that would help new users start off the installation from the Web while still in Microsoft Windows OS environment.

This is the announcement of "Debian-Installer Loader", a win32 loader for
Debian Installer.


Overall, the process is very simple (it's been inspired by a similar
project with Ubuntu).  D-I-L runs on the users' win32 system,
auto-detects wether the CPU supports 64-bits, picks the appropiate
linux and initrd.gz images for netboot, and uses GRUB for DOS to
chainload into it.


This has a few interesting applications:


  - Migrating to Debian on hardware without CD drive (or USB boot
  capability).
  - Migrating to Debian for users who have no idea how to burn an ISO
  and/or how to configure their BIOS for CD boot.
  - Migrating a system to Debian inmediately, at any time, wether
  we have a boot CD at hand or not.
  - Advocating Debian to Windows users.  Rather than give them a CD
  (expensive), give them a piece of paper with an URL.


Frontend site for Windows clients to visit is at:


 http://goodbye-microsoft.com/

Further details (screenshots, GPLed source code) at:

 http://goodbye-microsoft.com/more.htm 

Hope you like it,

-- 
Robert Millan


The screenshots of the D I L in action would look familiar to those who used loadlin to start installation from Microsoft Windows 95/98 long back.
Debian Windows installer screenshots

Watch The Video

Killing Sluggish Iceweasel

Sometimes my Iceweasel (unbranded firefox) web browser seems sluggish after rendering flash heavy web page or stops responding all together. I hope this behavior is not uncommon at all.

Instead of waiting for(ever) the browser to start responding normally I resort killing the web browser with killall 11 (eleven) HUP signal. After-all its me who is uses the computer not the other way around. ;o)

killall -11 firefox-bin

Note: Please note that -11 is hyphen followed by two numeric one's not ' l ' English alphabet.

Mounting a Windows partition automatically at boot time

If you have setup a Microsoft Windows and Linux dual boot system you may want to mount the windows partition automatically when you boot into GNU/Linux. As usual I don't suggest using any special scripts or packages for this. We will use the standard *nix files system table (fstab for short) file which stores all the entries about all known filesystems on the system and place an entry for our partition. Lets get started,Just place the following line into your /etc/fstab (filesystem table) file and you are done. /dev/hdaX /mnt/C vfat defaults,auto 0 0
  • /dev/hdaX if you are using a IDE harddrive, X is the number of the partition (use fdisk -l to list your partition info)
  • /mnt/C the mount point, where the windows partition is attached
  • vfat - vfat for 98x or ntfs for NTFS partition
  • auto - Mount the partition at boot time
Other possible parameters you can use uid/gid , showexec, umask etc.. the fstab manual page (man fstab) has detailed information about all the options. Also if you want your windows partition to check for errors with fsck.vfat at boot time check the last entry in the line from 0 0 to 0 1 .

Pidgin Sound Notifications

Pidgin Purple logo If you haven't used Pidgin (formerly gaim) then you should give it a try. The USP of the program is that it supports a wide range of Instant messaging protocols.

  • AIM
  • Bonjour
  • Gadu-Gadu
  • Google Talk
  • Groupwise
  • ICQ
  • IRC
  • MSN
  • MySpaceIM
  • QQ
  • SILC
  • SIMPLE
  • Sametime
  • XMPP
  • Yahoo!
  • Zephyr

Now, you *now* know what I am talking about ;o).

Being a fantical lightweight desktop user, I am currently running custom complied Fluxbox as my window manager and I don't use a sound daemon like ESD too.

So when the pidgin package on GNU/Debian suggested that I use gstreamer to play the silly pings and pongs my geek soul quivered.

$ apt-cache show pidgin Package: pidgin Priority: optional .... Some extra packages are recommended to use the core functionality present in most pidgin installations: * gstreamer0.10-plugins-base, gstreamer0.10-plugins-good - Sound support. .

Instead of installing gstreamer and plugins I decided to use aplay from the alsa-utils packages which also has commonly used alsamixer, amixer.

Pidgin Preferences dialog box

So in Sound Panel of Pidgins Preferences (see image above) which available under tools menu, I selected the sound method as *command* and sound command as "aplay -q %s".



If you don't want to play any sounds and happy with just console beeps then you can set the sound method to *beep*.



Pidgin Sound Preferences dialog box



And don't forget to test the sounds by using test button in the *Sounds Events* section below. If you still don't hear any sounds, either the sounds are muted in Pidgin or you must have messed up something.

Thursday, September 27, 2007

Decompressing 7-zip ( 7z ) archive files

7-zip is toted to have a higher compression ratio than the regular zip archives. The 7-zip compressed files usually have a .7z extension , but lets check with 'file' command to find what kind of file it is. $ file archive.7z archive.7z: 7-zip archive data, version 0.2 ( For this tutorial I created a 7-zip compressed archive (archive.7z) with few blank files beforehand.) Alright now lets find out what packages in GNU/Debian Sid provide tools to handle 7-zip files. $apt-cache search 7-zip advancecomp - collection of recompression utilities krusader - twin-panel (commander-style) file manager for KDE (and other desktops) lzma - Default and general compression method of 7z format in 7-Zip program p7zip - 7zr file archiver with high compression ratio p7zip-full - 7z and 7za file archivers with high compression ratio p7zip-rar - non-free rar module for p7zip Hmm, Lets go with "p7zip" package and install it. $ apt-get install p7zip The "p7zip" package provides /usr/bin/7zr program which I here use to list (l) and extract (x) our archive file. Listing with "l" parameter shows the contents of the archive. $ 7zr l archive.7z 7-Zip (A) 4.55 beta Copyright (c) 1999-2007 Igor Pavlov 2007-09-05 p7zip Version 4.55 (locale=C,Utf16=off,HugeFiles=on,1 CPU) Listing archive: archive.7z Solid = - Blocks = 0 Date Time Attr Size Compressed Name ------------------- ----- ------------ ------------ ------------------------ 2007-09-27 16:18:37 ....A 0 0 bar1 2007-09-27 16:18:58 ....A 0 0 bar2 2007-09-27 16:18:58 ....A 0 0 bar3 2007-09-27 16:18:58 ....A 0 0 bar4 ------------------- ----- ------------ ------------ ------------------------ 0 0 4 files, 0 folders Lets extract the files in the archive with "x" option. This uncompress the files to the current directory. $ 7zr x archive.7z 7-Zip (A) 4.55 beta Copyright (c) 1999-2007 Igor Pavlov 2007-09-05 p7zip Version 4.55 (locale=C,Utf16=off,HugeFiles=on,1 CPU) Processing archive: archive.7z Extracting bar1 Extracting bar2 Extracting bar3 Extracting bar4 Everything is Ok Total: Folders: 0 Files: 4 Size: 0 Compressed: 130

Wednesday, September 26, 2007

Installing Flash Plugin in Debian

Lets install Shockwave Flash plugin from Macromedia Adobe on Debian. We will be using the flashplugin-nonfree package from Debian Non-free. This package will install plugin for any Netscape or Mozilla based browsers like Mozilla, Mozilla-Firefox, Firefox, Iceweasel, and Iceape, along with few others like Galeon and Epiphany. Before we begin make sure you have non-free repository added in your apt-get sources.list file. Here is example from my sources.list file. deb http://ftp.iitm.ac.in/debian sid main non-free contrib Alright update the apt list and install flashplugin-nonfree package. $ apt-get update ... $ apt-get install flashplugin-nonfree Reading package lists... Done Building dependency tree Reading state information... Done Suggested packages: konqueror-nsplugins x-ttcidfont-conf msttcorefonts ttf-xfree86-nonfree xfs The following NEW packages will be installed: flashplugin-nonfree 0 upgraded, 1 newly installed, 0 to remove and 0 not upgraded. Need to get 15.5kB of archives. After unpacking 143kB of additional disk space will be used. Get:1 http://ftp.iitm.ac.in sid/contrib flashplugin-nonfree 9.0.48.0.2 [15.5kB] Fetched 15.5kB in 8s (1906B/s) At this moment the install asks you if you have downloaded the latest flashplayer tar.gz file and prompts your for the path. Lets downloaded the latest flashplayer9 update from another console. $ cd /tmp $ wget http://download.macromedia.com/pub/labs/flashplayer9_update/flashplayer9_install_linux_082207.tar.gz Once the file is downloaded, give the path as /tmp/ in the text box prompt of the installer. And the install continues.... Preconfiguring packages ... Selecting previously deselected package flashplugin-nonfree. (Reading database ... 72707 files and directories currently installed.) Unpacking flashplugin-nonfree (from .../flashplugin-nonfree_9.0.48.0.2_i386.deb) ... Setting up flashplugin-nonfree (9.0.48.0.2) ... Installing from local file /tmp//install_flash_player_9_linux.tar.gz Flash Plugin installed. Cool,Lets check if the plugin installed. You need restart your browser if you it is already running and point your browser to about:plugins If you see something like this then the plugins is install and working. Shockwave Flash File name: libflashplayer.so Shockwave Flash 9.0 r48 MIME Type Description Suffixes Enabled application/x-shockwave-flash Shockwave Flash swf Yes application/futuresplash FutureSplash Player spl Yes

Creating files the hackers way!

In *nix is all about text files, Let it be the costly piece of hardware that you brought or just some configuration setting to your favorite programs everything is humbled down to be a simple text file. Alright creating a new file doesn't necessarily mean opening your favorite editor pico or vi. There are quite faster ways for creating blank files on the shell, tell me find any simpler method. ;) Touch happens to be the standard way to create a blank file but that means I have to type five characters ( t o u c h ) being a lazy typist I use a much simpler method. $ touch testfile $ ls -l -rw-r--r-- 1 arky arky 0 Mar 23 22:31 testfile My hack is using the standard shell redirect operator > which does save some typing. ;) $ > testfile2 $ ls -l -rw-r--r-- 1 arky arky 0 Mar 23 22:31 testfile -rw-r--r-- 1 arky arky 0 Mar 23 22:31 testfile2

Tuesday, September 25, 2007

Bittorrent complains unable to setrlimit not allowed to raise maximum limit

Ever wondered why Bittorrent complains that it is unable to setrlimit not allowed to raise maximum limit while starting. Most people would ignore this harmless warning but I just had to know why. First I posted a support request on Bittorrent Support site , I am still waiting for any response from them. Meanwhile here is the error message if you haven’t seen it before. $ bittorrent-console >>> unable to setrlimit not allowed to raise maximum limit In plain speak, its the python interpreters way of saying “look I need more system resources”. So,lets try to do just that. In gnu/Linux the Pluggable Authentication Modules (PAM) are used to place a cap on system resources. The /etc/security/limit.conf is the configuration file where the limits are, raise the limits and the warning will go away. Here is a example of the /etc/security/limits.conf configuration. * soft core 0 * hard rss 10000 @student hard nproc 20 @faculty soft nproc 20 @faculty hard nproc 50 ftp hard nproc 0 @student – maxlogins 4 More information on limits.conf configuration syntax is available here Happy Torrenting !!!!! Resources

Popular Posts