Tag Archives: linux

How I helped the office chef

If you know me personally (why would you be reading this otherwise ?), it’s quite possible that you are thinking about some smart-ass remark to make in the comments after reading the title …or maybe you are just plain shocked. Well, relax, you may breathe normally now. I did not help the chef with his work. I helped him with the only thing that I am good at …well, at least kinda good at — tech stuff.

The chef at our office is a charming Pakistani chap who likes speaking in Hindi whenever he sees me (inspite of the quality of hindi he hears me speak !). So, we tend to indulge in small talk as he serves me my lunch.

Sometime last week, he asks me whether I can help him with a computer problem (don’t they all at some point šŸ™‚ !?!), and nice fella that I am, I say yes. He goes back into his kitchen (or whatever that large room that is, which is always kept closed; away from the view of the good people eating their lunches) and brings back a fairly old Compaq laptop.

Says, it doesn’t work (hmm, nice problem description). I power it up and don’t even have to ask him to elaborate. I hear the all too familiar, click-tik-tik-tik-click-tik… of the Hard disk.

So, i tell him — Aapki disk mar gayee.

Fortunately, he actually knows what I am talking about (so, he doesn’t have to suffer more tech talk in hindi). He says, he showed it to some other techies in the office and all of them said, there is nothing that can be done except for buying a new harddisk. (most of these other techies are windoze people). He was hoping I could do some magic …all he wants is to access the net, play movies and songs. He has a desktop at home, so any other job (like his son’s school work) can be done on that.

That’s when i realize (or perhaps remember ?), it is so ridiculous that an broken hard disk equates an unusable system — if you live in a proprietary software world, that is.

I tell him, I can certainly help him, if he has a USB stick and is ready to learn something new. He was all for it ! (another observation — most non-tech people don’t know nor do they care what an OS is, it is all the same to them — until of course they actually see something different, like a system boot up from a USB stick, without a hard disk attached).

So, he gives me his 4GB USB stick and offers the laptop too. I say, I don’t need it. He gives me a confused look, but I can see, he is really hoping for magic.

I won’t get into the details (since, it isn’t deep magic really, in fact people like Luke an Kushal have made it downright boring), I’ll just list the steps:

  • get the latest and greatest Fedora release (Fedora 10, right now)
  • get the liveusb-creator
  • run liveusb-creator
  • press two buttons, i’m ain’t telling you which, if you have to ask
  • boot system with new live USB install
  • configure the system for net access
  • add the repos rpmfusion-free, rpmfusion-nonfree, adobe (for flash plugin) and freshrpms (for libdvdcss)
  • install mplayer, libdvdcss, ffmpeg, vlc, audacious, gecko-mediaplayer, flash-plugin
  • (note: my aim was to give the chef a usable system)

Well, all that done, I gave the USB stick to the chef and asked him to boot his laptop using it. I could see, he was still trying to understand what was happening, especially since i was idly fiddling with the br0ke Hard Disk in my hand.

The look on his face, when he saw a login screen is indescribable ! I showed him the way around the GNOME UI. Got him connected to the wireless, got him playing movies, songs and saving files off the net. He then tells me why he has that ear to ear grin.

Apparently, the hard disk had been misbehaving for quite sometime. Random hangs followed by multiple tries to get the system booting, followed by the eventual clicking sounds. It finally stopped working about 3 months ago. He took it first to the laptop vendor, where he found out that getting a new hard disk was kinda expensive. Since his computing needs were limited, he didn’t think it wise to buy a disk here. He had planned to buy the disk the next time he visited Pakistan (since computer spares are supposed to be cheaper there) and had resigned to the fact that the laptop was dead.

However, out of sheer coincidence (I assume, it was more like running out of topics for small talk), he asked me to help since I was a techie …and I say, I can …and I do …and all in a matter of a few hours !! He just couldn’t get over the fact.

Now, he is telling everyone he is chatty with (and that’s a *lot* of people, including especially, the ‘other’ techies who had a go at the laptop) about this guy who made his laptop run without a hard disk.

Well, what can I say !?

Thanks Luke, Kushal and all the guys working on Fedora …and thanks to FOSS developers all over the world ! …it’s because of you guys, at least one guy thinks I am some sort of a magician.

Why I use the ‘noatime’ mount option.

Well, I’m back to posting. Hopefully, I shall continue this. The next few posts, I plan on jotting down all the little tweaks and configuration changes I make after every linux install that I do. The first of these is adding the mount option ‘noatime’.

To understand this, you need to first understand what ‘atime’ means. Traditional unix filesystems keep track of three ‘time’ attributes for every file on the system. These are:

mtime - The modification time (The time the file was last modified, duh!)
atime - The access time (The time the file was last accessed)
ctime - The change time (The time the inode of the file was last changed)

These attributes (along with others) can be viewed using the command “stat <filename>“. Among these three, having the system maintain the ‘atime’ attribute is by far the least useful.

Most applications that care about access times prefer to use the ‘inotify’ mechanism, instead of repeatedly polling the file. So, in other words, the system maintains a record that hardly anyone would look at. That, by itself, is not such a bad thing, however, if you consider the fact that the system has to write to the file’s inode every time the file is accessed ! you’d agree that having the ‘atime’ record is not only useless but also quite expensive.

So, how do you stop the system from doing this ? Well, use the ‘noatime’ option:

  • Edit the file ‘/etc/fstab’
  • Add the option ‘noatime’, separated with a comma, to the fourth field of every disk based filesystem entry
  • Save the file and reboot (or remount all the filesystems corresponding to the modified entries (using the command: mount -o remount ))

Well, all that said, here’s the article that inspired me to start this series of posts: Replacing atime with relatime

I always knew it made a difference, I just never did realize, nor care to measure how much of a difference ! Well. now I know, so do you. Thanks for reading.

Peeking into the linux loader

This post is as much as a tip as a demonstration on how beautifully simple it is to “look-neath-the-hood” when working with linux. This is the reason why linux programmers are happy programmers. Anyways, on with the details.
If you have ever seen errors like …

error while loading shared libraries: foo.so: cannot load shared object file: No such file or directory

when you know that foo.so exists, or have see something like ….

java.lang.UnsatisfiedLinkError: no foobar in shared library path
java.lang.UnsatisfiedLinkError: /some/module/soandso.so: libstdc++.so.6: cannot handle TLS data

you may use the LD_DEBUG feature to zoom-in on the problem.

The linux loader (/lib/ld-<version>.so) looks at the environment variable “LD_DEBUG” to print out interesting debug information as it loads libraries and resolves symbols. What exactly is printed out depends on the value that the variable is set to. You may get the list of valid values by setting LD_DEBUG=help. For example:

$ LD_DEBUG=help ls
Valid options for the LD_DEBUG environment variable are:

libs display library search paths
reloc display relocation processing
files display progress for input file
symbols display symbol table processing
bindings display information about symbol binding
versions display version dependencies
all all previous options combined
statistics display relocation statistics
unused determined unused DSOs
help display this help message and exit

To direct the debugging output into a file instead of standard output
a filename can be specified using the LD_DEBUG_OUTPUT environment variable.

What you make of this info. and how much it helps depends on the specific problems you are facing but all in all this is a useful thing to know when you are facing ^library issues^. More detailed information about working/writing libraries on linux is available at the Program Library HOWTO