Friday, December 29, 2006

vga drivers for 775VM800

After searching for hours for the ASRock on board vga drivers by the wrong name "755vm800" I finally found the drivers at

ASRock -> Download


So yea, great accomplishment. :)

lost.... libgcc

What a quest.... the hunt for libgcc on solaris 10. The problem was to find if Solaris 10 ships with libgcc. Now anyone else would know that on top of their head, but not me! I have to make everything a challenge.
So I found the package listing for Solaris 10 sparc and x86 at
http://docs.sun.com/app/docs/doc/819-6399/6n8droaea?a=view Sparc
http://docs.sun.com/app/docs/doc/819-6399/6n8droaec?a=view x86.


that showed that gccruntime was included in the standard packages. However, that wasnt enough. I had to confirm that libgcc was part of the gccruntime. So I tried

pkginfo SUNWgccruntime


with no luck. Then my coworker suggested to get the vmware image and do a pkgadd or pkgrm and find out. So I could get around that when my system permitted (faced lot more problems before I could get the vmware running). Once I had the vmware I did a pkgrm SUNWgccruntime and it showed removing libgcc.so.

Which I believe confirms that libgcc is part of gcc runtime files.

Thursday, December 21, 2006

I am in control

Hehe.. for the psychologists out there, the subject is not a statement of analysis of my mental state. Its more of the tool i've been searching for for a while and just couldn't remember what it was called or what to search for. Until, my co-worker said he had used it before and to search the web for "sourceforge keyboard mouse". And I got the link that I was looking for a while.

Synergy.

Here is how to configure it for two systems:

Layout:
System1 <---> System2

System1
IP: 10.0.5.96
OS: Windows
package: SynergyInstaller-1.3.1.exe

System2
IP: 10.0.5.97
OS: RHEL4
package: synergy-1.3.1-1.i386.rpm


I used Windows as the server and RHEL4 as the client. The key parts of the configuration are

Wednesday, December 20, 2006

linux tips

Hmm.. cleaning my emails, I found this. Stuff I had saved up when I first started learning linux. dated 5/4/5 on my gmail... heh i remember the first days i started out at Edgence. Quite a learning experience! In many ways.

-------------------------------------------
#remove the annoying beeps on term
setterm -blengt disable beep
xset b 0 disable beep

#column modification
$ cat data
1 2 3
4 5
6 7 8 9 10
11 12
13 14

How to you get everything in 2 columns?
$ cat data|tr ' ' '\n'|xargs -l2
1 2
3 4
5 6
7 8
9 10
11 12
13 14

What's the row sum of the "three columns?"
$ cat data|tr ' ' '\n'|xargs -l3|tr ' ' '+'|bc
6
15
24
33
27
------------------------------------------
#Here's a quick way to edit all files whose contents contain a given string:
files=""; for i in `find . -type f -print`; do files="$files `grep -l $i`"; done; vi $files
------------------------------------------
#Move back and forth between files using vim:
:n -- move to the next file
:rew -- move back
:e #3 -- edit the third file in buffer
:ar -- list files status
------------------------------------------
#The escape characters make the regex hard to read/write (For me that is) ie to add index.html at the end of each href - replace /" with /index.html"
find . -name "*.html" -print0 | xargs --null perl -pi -e 's/\/\"/\/index.html\"/'
------------------------------------------
#who owns a perticular port?
fuser -v -n tcp 20020
------------------------------------------
#To move a text file into upper case letters, you can use Awk in the following way:
awk '{ print toupper($0) }' old_file > new_file
------------------------------------------
#defaultfile permissions....
umask 077
------------------------------------------
#Hack 4 Creating a Persistent Daemon with init


Make sure that your process stays up, no matter what

There are a number of scripts that will automatically restart a
process if it exits unexpectedly. Perhaps the simplest is something
like:

$ while : ; do echo "Run some code here..."; sleep 1; done
If you run a foreground process in place of that echo line, then the
process is always guaranteed to be running (or, at least, it will try
to run). The : simply makes the while always execute (and is more
efficient than running /bin/true, as it doesn't have to spawn an
external command on each iteration). Definitely do not run a
background process in place of the echo, unless you enjoy filling up
your process table (as the while will then spawn your command as many
times as it can, one every second). But as far as cool hacks go, the
while approach is fairly lacking in functionality.

What happens if your command runs into an abnormal condition? If it
exits immediately, then it will retry every second, without giving any
indication that there is a problem (unless the process has its own
logging system or uses syslog). It might make sense to have something
watch the process, and stop trying to respawn it if it returns too
quickly after a few tries.

There is a utility already present on every Linux system that will do
this automatically for you: init. The same program that brings up the
system and sets up your terminals is perfectly suited for making sure
that programs are always running. In fact, that is its primary job.

You can add arbitrary lines to /etc/inittab specifying programs you'd
like init to watch for you:

zz:12345:respawn:/usr/local/sbin/my_daemon
The inittab line consists of an arbitrary (but unique) two character
identification string (in this case, zz), followed by the runlevels
that this program should be run in, then the respawn keyword, and
finally the full path to the command. In the above example, as long as
my_daemon is configured to run in the foreground, init will respawn
another copy whenever it exits. After making changes to inittab, be
sure to send a HUP to init so it will reload its configuration. One
quick way to do this is:

# kill -HUP 1
If the command respawns too quickly, then init will postpone execution
for a while, to keep it from tying up too many resources. For example:

zz:12345:respawn:/bin/touch /tmp/timestamp
This will cause the file /tmp/timestamp to be touched several times a
second, until init decides that enough is enough. You should see this
message in /var/log/messages almost immediately:

Sep 8 11:28:23 catlin init: Id "zz" respawning too fast: disabled for 5 minutes
In five minutes, init will try to run the command again, and if it is
still respawning too quickly, it will disable it again.

Obviously, this method is fine for commands that need to run as root,
but what if you want your auto-respawning process to run as some other
user? That's no problem: use sudo:

zz:12345:respawn:/usr/bin/sudo -u rob /bin/touch /tmp/timestamp
Now that touch will run as rob, not as root. If you're trying these
commands as you read this, be sure to remove the existing
/tmp/timestamp before trying this sudo line. After sending a HUP to
init, take a look at the timestamp file:

rob@catlin:~# ls -al /tmp/timestamp
-rw-r--r-- 1 rob users 0 Sep 8 11:28 /tmp/timestamp
The two drawbacks to using init to run arbitrary daemons are that you
need to comment out the line in inittab if you need to bring the
daemon down (since it will just respawn if you kill it) and that only
root can add entries to inittab. But for keeping a process running
that simply must stay up no matter what, init does a great job.
------------------------------------------
RuBoard
#I've found it very useful to pipe the results of a
#MySql query. The below will execute
#an SQL select statement and pipe result to a textfile
mysql database_name -e "sql statement" > sql.txt
------------------------------------------
#startx with an error log
startx 2>&1 | tee startx.log
------------------------------------------
#to check the settings being used for your Xserver
#(like xinerama), use "whereis" to locate the startx script:
whereis startx
------------------------------------------
#then edit that shell script to add server arguments, like:
startx -- +xinerama
#to add Xinerama support, although this can be in the
#config file found in /etc/X11/XF86Config-4.
------------------------------------------
#to find out what package something belongs to:
rpm -qf /path/to/mysterious_file
------------------------------------------
#To modify font sizes, so that 12 points looks like
#you expect, you can specify the dpi for the Xserver:
startx -- -dpi 100
------------------------------------------
#to find what the Xserver currently thinks your dpi is:
xdpyinfo | grep resolution
------------------------------------------
#to list all fonts:
xlsfonts
------------------------------------------
#to fax under linux, assuming you have all the
#standard packages for this installed, and have
#printed your document to a postscript file:
fax send -v 123-4567 file.ps
------------------------------------------
#to make a pdf file from an HTML page, first view the HTML
#in a good browser and print to file(.ps). Then use:
ps2pdf file.ps file.pdf
------------------------------------------
#htmldoc is not standard in RedHat, but can be obtained from
#http://www.easysw.com/htmldoc.
#This is a graphical program but can also be run from the
#command-line. The below will convert an HTML document to pdf:
htmldoc -t pdf -f invoice012.pdf --webpage invoice012.html
------------------------------------------
#directory usage, list the size of directories
du -ch
------------------------------------------
#amount of swap space used
free
------------------------------------------
#convert a man page to a textfile
man command | col -b > command.txt
------------------------------------------
#change the prompt to the current directory and current time:
PS1="[\W \@]"
------------------------------------------
#tell me the date and time
date
------------------------------------------
#tell met the date as YYYY-MM-DD
date +%Y-%m-%d
------------------------------------------
#If I can't remember a command, you can search
#for all commands related to a term
apropos term
------------------------------------------
#when copying directories, hidden files are skipped.
#They can be copied by stipulating "cp .*", but then
#hidden directories aren't copied recursively. This is an
#issue when I backup my email folders (Kmail), because
#hidden files and directories are used. But there is a
#command to copy directories recursively, including
#hidden files and directories:
rcp -r original new
------------------------------------------
#If you're using a digital camera and download the images to
#a linux system, you probably have gphoto2 installed (this is
#standard on RedHat, the project URL is
#http://www.gphoto.org/).
#For the Canon Powershot G2, the below command will get all
#pictures from the camera (connected to the USB port):
gphoto2 --camera "Canon PowerShot G2" --port usb: -P
------------------------------------------
#Perl can be used to perform a regular expression substitution
#on a series of text files, making backups, using a single command:
perl -pi.bak -e 's/foo/bar/' filelist
#note: use with caution. Test your regular expression before applying it
#to a large group of files. In the example above, the backup files will
#have the extension ".bak".
------------------------------------------
#Make a man page from a perldoc:
pod2man Photos.pm > /usr/share/man/man3/Photos.3pm
#after that, "man Photos" will display the Photos module documentation
#in manpage format.
------------------------------------------
#make an Xauthority file for user Chris
mkxauth -u Chris -c
------------------------------------------
#find files larger than 1 Megabyte modified less than 250 minutes ago
find / -size +1000k -mmin -250
------------------------------------------
#to convert a postscript file (.ps) to .jpg, thumbnail size, with ghostscript:
gs -sDEVICE=jpeg -sOutputFile=file.jpg -r20 file.ps
------------------------------------------
#if booting from a boot disk, and it's necessary for some reason
#to boot into a shell with only the "/" partition mounted (e.g. other
#partitions have errors), enter the below at the "boot>" prompt:
linux init=/bin/sh
------------------------------------------
#RedHat installations use "cups" for printing
#instead of lpd. The below command will print
#multiple copies of "class3.ps" collated (in this case, 14 copies)
lpr.cups -#14 -o Collate=True class3.ps
------------------------------------------
#to do a screen capture of a single window, saved as "file.jpg":
import file.jpg
------------------------------------------
#to make a tar file of all html files in /www
tar -czf pt.tar.gz /www*
------------------------------------------
#to list files in a gzipped tar archive:
tar -ztf pt.tar.gz
-----------------------------------------

just for fun

Here is a collection of quotes, msn ID's, signatures etc that I have come across and found worth keping with all respect to my sense of humor :) note none of it is my creativity...


the whole difference between construction and creation is exactly this: that a thing constructed can only be loved after it is constructed; but a thing created is loved before it exists

hai...jisne mujhe banaya hai, woh bhi mujhe samajh na paya hai

the real test of a choice is of makin the same choice again

The sum of the intelligence on the planet is a constant; the population is growing.

If you choose not to decide you still have made a choice.

It is easier to get forgiveness than to get permission.

Valentine's Day is a cruel, evil holiday which exists solely to pour lemon juice on the paper-cut
hearts of the unattached.

"Not all who wander are lost."

Those who fear the darkness have never seen what the light can do

Real men don't take backups. They put their source on a public FTP-server and let the world mirror it. -- Linus Torvalds

People often find it easier to be a result of the past than a cause of the future.

"I'm lost! I've gone looking for me. If I should return before I get back, please have me wait."
"And in the beginning there was nothing. And God said, 'let there be light'. And there was still nothing, BUT you could see IT!" -Anonymous

2*b||!(2*b)

this signature being renovated ... excuse the mess

Unix IS user friendly. It's just selective about who its friends are

"Don't worry about people stealing your ideas. If your ideas are any good, you'll have to ram them down people's throats."

"Well, let's just say, 'if your VCR is still blinking 12:00, you don't want Linux'". --Bruce Perens, Debian's Fearless Leader

reportedly from an installation manual: 'ram disk' is _not_ an installation procedure...

another filesystem sshfs

Although I don't know enough about file systems to say how secure this is. But since its running on ssh, I am assuming its secure enough for my humble earthly file sharing. So I found sshfs while looking for alternative for smbfs as it really was giving me quite a bit of problems. Here are the steps involved in getting it working.

Firstly, it only needs to be installed on the guest system. i.e the system where you are going to mount to.

You will need the following packages.
fuse-2.6.1.tar.gz (if your OS is not compiled with fusefs support)
sshfs-fuse-1.7.tar.gz

Just the standard should do.

./configure
make
sudo make install


Once the above two packages are compiled and installed, we now need to set up the system. Follow the steps below:

First you need to load the fuse module into the system.

sudo modprobe fuse
lsmod should show you fuse to be loaded.

fuse creates a device /dev/fuse on the system. Change the permissions on this device to allow read/write/execute as you see fit.
sudo chmod user:group /dev/fuse


Now you can create a local directory where the host OS will be mounted. I keep my smb mounts and sshmounts in /SHARES

mkdir /SHARES/hostname

Now you can mount the host system using sshfs

$sshfs -h
usage: sshfs [user@]host:[dir] mountpoint [options]

sshfs rohan@gandalf:~/sources /SHARES/gandalf


I would suggest to take a look at sshfs -h. It has a lot of options that can be configured.


Note: I had the error below when I tried to run sshfs
   foofs: error while loading shared libraries: libfuse.so.2:
cannot open shared object file: No such file or directory
I found the solution
"check /etc/ld.so.conf for a line containing '/usr/local/lib'. If it's missing, add it, and run ldconfig afterwards." at
fusefaq

Monday, December 18, 2006

installers on os's

Alright.. so, trivial for a lot of people, but jsut so I dont forget the usage here are the different installers in different OS

linux: rpm
rpm -ivh pkg.rpm #install an rpm package
rpm -qa | grep pkg #search for a package
rpm -e `rpm -qa | grep pkg` # erase a given package... use with care .. grep may matche more than one package..

hp-ux: swinstall
swinstall -s source.depot pkgname #install pkgname form the source.depot
swinstall -s source.depot.gz pkgname #also deals with gz archive

solaris: pkg-*
pkg-add -d #add a package
pkg-rem # remove the package
grrrr forgot already... memory is just not my thing...

debian: apt-get
apt-get install "exact name"


okay will update when i find the right info...

Thursday, December 14, 2006

time and again

I was listening to a gazal, "Woh kagaz ki kashti". An excellent gazal, and i heard the line

"Na Duniya Ka Gham Tha Na Rishton Ke Bandhan
Badi Khoobsoorat Thi Wo Zindgaani"


and that made me think (I won't say realize, as i believe you really don't know when you realize), Where I stand. Where I was, where I will be. To elaborate, I am probably in a situation where I am understanding relationships. Their value. How its hard to keep ties. Life's been great to me so far, but why does it have to make me choose? Why do I need to be in a position where I will hurt someone or another? Why can't we all just get along? Being in a position to make a decision is bad, well probably not as bad as not having right to make decisions. And then I think, how great it was to be young, small, little!! Had no worries, didn't need to worry about keeping everyone happy. And thats exactly what the song fits in.

I've always loved gazals, and felt them. Felt them, to my experiences. And after hearing a gazal for years, suddenly, someday, I see the beauty in them that I missed out every time I heard it. Like the line I quoted above. Didn't mean much to me. Well, I liked it. Nothing too exceptional, until while driving home from our Christmas party it struck me. Beautiful! And that led me to write.

Its funny, how I feel grown up. Grown up. Those words resonate. And make me think, how this is absolute nothing compared to what others face. What I am going to be facing some day. I am doing what I think is the right thing for me to do now. Prepare for that time when I will be in a crises. Lucky, as I consider myself (lucky enough to hope for a Jack of Hearts on the last card in poker and get it :).. yes DAMN I rock.. Okay, tad bit of my self there) to have not been in any situation that I consider taxing my emotions. I believe I have lived a very sheltered life. Sheltered by luck. I believe I will some day be in a situation where I will breakdown. What does one do to prepare oneself? I was, and am again (with a short break in between), a risk taker with a plan for worst case. So whats the worst case that life's going to throw at me? And how will I take it? How do I prepare myself for that? Practically, I think there is no point worrying about it till its there. And then deal with it whole heartedly.


I don't know what am I. I've always thought I know myself. Been confident and believed myself. Trusted myself over anyone else, and had complete faith in my decisions. But.. now I begin to "realize". I am not bigger than life. I understand what they would mean when they would say that.

Ego. I, apparently have a huge ego. But where is the line between Ego and Confidence? I dont mean confidence in oneself. Confidence to show, is what i mean. A little of show is needed to get anywhere. Sales is the key. And confidence is the first and foremost aspect of that. But how do I curb the ego leave the confidence intact?

Guess, on the whole, this post doesn't really appear to make much sense. But an trained mind will tell you that this really doest. :) Well, things that have been on my mind are out there. If any one can answer the questions that I didn't ask, I'd like to hear it. Although, comming back to my ego. I really don't think that there are many people out their that are better than me. So that would mean, I don't think many people can guide me. That lead me to ever really go to many classes in high school, lectures in university, T.A's at university.

Now atleast I am willing to accept that there is intelligence out that thats higher than mine. And I think thats a good start.

Dil-e-nadaan tujhe hua kya hai

Just a song I like. I love ghazals. To the extent I have may be 2-3 CD's I've bought with multiple songs repeated. Just so that I can have all the ones I like in the best quality in one place! Bad Excuse? Love knows no reason. Sorry.

Wednesday, December 13, 2006

eth0 has different MAC address than expected, ignoring.

So following my previous post where I got kernel 2.6.9 finally running on my desktop, I had problem with eth interface.

Error said "eth0 has different MAC address than expected, ignoring."
So google search gave me some things that I treid and failed. One thing that worked was a nice link on how to spoof your mac address.
http://whoozoo.co.uk/mac-spoof-linux.htm

In summary:
1. set bootproto=none
2. ifconfig down eth0 (if it isnt already down)
3. ifconfig eth0 hw ether 11:22:33:11:22:22 (your choosen mac address)
4. service network restart
5. now you can go back and set the bootproto to dhcp
(Although step 1 and 5 don't make sense. I dont want to go back and narrow it all down right now. Have some deadlines to meet and so needed this pc running with 2.6.9 asap. Will update later, hopefilly :))

kernel woos

Alright, so I have compiled the linux kernel 32485902483 times, and failed. Big deal! So I took it upon my hands to explore this uncharted territory that I've always feared.
Okay now I am too bored to continue giving a background and how I sucked at that for last 3 years. Lets jump right to the point.

The problems I faced and solutions are below. All though you can search the same error string on google and get the same results that i am posting (thats what I did :)).

linux 2.6.19:
error: kernel panic saying "enforcing enabled but no policies"
fix: disable enforcing. add enforcing=0 in /boot/grub/grub.conf at the end of the line "kernel..."

linux 2.6.9:
kernel panic:
Cannot open root device "LABEL=/" or unknown-block(0,0)

fix: this has lots of fixes covered at
http://www.linuxquestions.org/questions/showthread.php?t=269230
What worked for me was increasing my block dev ramsize! Apparently sometimes ramdisk is too small for initrd to fit in (or so I understand). So solution,
grep BLK_DEV_RAM /usr/src/linux/.config
CONFIG_BLK_DEV_RAM=y
CONFIG_BLK_DEV_RAM_SIZE=8192

Add the above 2 lines to your kernel config.