Wednesday, April 30, 2008

Installing GRUB on a USB drive

About a month ago, I finally bought a flash drive (a 4GB one) for myself, to replace the antique 256MB MP3 player. As this was intended to be a pen drive and not an MP3 player, it supported USB booting. Unfortunately, each time I plugged it in, the flash drive became the default hard disk, since it apparently had priority over SATA disks for booting. Now you might say I could simply set the SATA drive as the preferred hard disk for booting, but once you remove the drive, and the BIOS detects that it is missing, it no longer keeps a track of the flash drive, plug it in another time and it tries to boot from the flash drive. I did try looking for a way to disable USB booting, but to no avail. I couldn't locate it neither in the motherboard manual, nor in the BIOS itself. I could have probed the matter a bit more, but then I decided to install a GRUB in my pen drive. After all, it takes a mere 170KB, I could install a regular OS in this thing (4GB pen drive). Okay so here's how I did it.
Plug in the drive and make sure it has a file system, format it if it doesn't.
Make a folder called boot in the root directory of the pen drive. Or simply execute the following command in your terminal.
sudo mkdir -p /media/drive_name/boot
Of course, needless to say, you'd have to replace drive_name with the name your drive is mounted with.
Now you have to copy your grub to the boot directory you created. Use the following command to do so.
sudo cp -r /boot/grub /media/drive_name/boot
Now, there is a need to activate the GRUB prompt, to do so simply type
sudo grub
You will notice that the GRUB prompt (GRUB>) appears. Now we need to find where all the GRUB exists. In order to do so, type in the following in the GRUB prompt.
find /boot/grub/stage1
What this command did was that it looked for a file called stage1 (which I know exists in the grub directory) and reports where all it found it. This is what the output should look like,
Now to check out which of the hard-disks is the pen drive. Type in
geometry (hd0)
and it displays something like
drive 0x80: C/H/S = 3841/33/63, The number of sectors = 7987200, /dev/sdb
Partition num: 0, Filesystem type is fat, partition type 0xb
Okay, since I have set my pendrive as number hdd1, this is it. If you see more than one partitions, chances are this is not your flash drive, check out the next one that showed up, until you have found the one that you are sure is your pendrive. Now you don't want to rewrite your MBR when there is not the need to do so, do you?
Now that I know the hdd and partition name (hd0,0) in my case which would be different in your case, we need to specify the grub we need to install in the MBR by:
root (hd0,0)
Now to write the stage1 of the GRUB onto the boot sector of the USB, which would be different in your case
setup (hd0)
which would give a message like
setup (hd0)
Checking if "/boot/grub/stage1" exists... yes
Checking if "/boot/grub/stage2" exists... yes
Checking if "/boot/grub/fat_stage1_5" exists... yes
Running "embed /boot/grub/fat_stage1_5 (hd0)"... 17 sectors are embedded.
Running "install /boot/grub/stage1 (hd0) (hd0)1+17 p (hd0,0)/boot/grub/stage2 /boot/grub/menu.lst"... succeeded
Do I need to tell you that you are done once it says done? Well actually, I wasn't quite done here, but if you weren't facing the problem I was, this is your exit. Type
If you were, then I'm afraid you'd have to read on, since this is the main reason for writing this post. You see, each time you plug in your pendrive, the hd0 and the hd1 get messed up, because the boot order changes. So now, if your pendrive was hd1 like it was initially in my case, it becomes hd0 when it becomes the primary hdd. So now you need to change the grub in your pendrive to modify make this grub run. In order to allow you to make changes to all its files, type in this command in the terminal
sudo chmod -R 777 /media/usbdisk/boot/grub
Disclaimer : What ever I did from here were my own instincts, you could follow the steps since it worked for me, even if the steps don't work, they worst case scenario would be that you mess up the GRUB you copied, that didn't ever work (But make sure it doesn't work before you mess with it)
Now in the grub folder, in the boot folder you made in your pendrive, you will find a file called I simply interchanged the assignment of sda (the hard drive) with the sdb (the pen drive). Then in the menu.lst file, replace the drive numbers with their appropriate ones, like in my case, hd(0,9) was replaced with hd(1,9) in the case of linux booting, and hd(0,0) was replaced by hd(1,0) for the Windows Vista bootloader. But don't let this confuse you, my boot procedure is really messed up. I have a windows vista bootloader which manages XP by default and I added Linux to it using easy BCD. Let me finish my exams n I will sort things out. Instead of replacing the drive number in each place, you could add something like
map (hd0) (hd1)
map (hd1) (hd0)
which simply changes the mapping dynamically. It works, but you have to put it before each root instruction in the menu.lst Any way I guess that is it. In case anybody reading this needs any help, I am pretty sure I'd be proficient with stuff like this by then (going by the number of people who visit this blog). Though it would be a nice idea to join a good community, and ask your doubts there, because there are a lotta knowledgeable people out there, willing to help you with your problems.

Do visit my Linux blog

Monday, April 28, 2008

It really whips the Llama's A$$

As I have already mentioned before, I have now abandoned my windows (XP as well as Vista) installations, and have taken a liking towards Linux (Ubuntu 7.10 Gutsy Gibbon distribution) The one and probably the only problem I have faced with Ubuntu so far is choosing the right music player. After over a month of using, Ubuntu, I was satisfied with the default media player I had been using, Rhythmbox. It was then I realized how used to winamp I had actually become. Although I usually enqueue all my music in my playlist I do sometimes like to make my own playlist too sometimes, a big hassle with Rhythmbox. In the past month I did try to look for an alternative for Rhythmbox, but none were of my liking. So yesterday morning, I started a hunt for the best media player for Ubuntu for AMD64, I specified AMD64 because finding stuff for this version is tougher than it is for the Generic 32bit (i386) one. The first place that I went to look for a player was the add or remove application utility, for obvious reasons, ease of installation n guaranteed compatibility. But lo and behold, the player which apparently looked and worked like winamp, called XMMS player had problems showing text on the buttons. Uninstall time. Next up came Amarok which was pretty much like Rhythmbox. I am not saying that any of these players are bad, just that I was more used to Winamp. So anyway I decided I needed winamp, or nothing else would suffice. Google, Google, n there it was (tears of joy in my eyes) WINAMP FOR LINUX, but wait a minute, what is that, Winamp 3 alpha for linux, last updated 6 years 6 months ago. Damn it! I'll try it out anyway, winamp 3 wasn't that bad, so what if it's an alpha version. Click, download, ok, Woohhaaa!!! WTH? Its a what? A .RPM file. Now what? Google, Google, use alien to convert to a debian package. Oh i know what that is, that is one package you can double-click to install... Sigh of relief. Terminal, sudo blah blah blah, ERROR ERROR... Now what did I do wrong? An hour later it finally struck me. Oh Crap! 6 years 6 months ago there probably wasn't any AMD64, (Checked it out on Wikipedia and I was right. The first AMD64-based processor, the Opteron, was released in April 2003.) that means that this version was meant to be run with the AMD64 version, would have i been better off had I installed the generic i386 version? Naah, 3yrs after I buy a 64bit PC I am using a 64bit OS with it, I shouldn't be having second thoughts about it. But I think I read somewhere there are support libraries you could install to get the generic versions of the softwares to run. Argh! that's why I didn't switch to linux earlier. All about coming out of your comfort zone. Now what? Lets try out wine. Wine is this really cool application that builds this layer which provides support for software meant for windows. Behold, apparently you aren't safe from dll hell even while using Linux. There are a couple of other such softwares I had heard of too, but since Google makes use of wine in it's Picasa for linux, I figured it would be good enough. Went to wine's official site and discovered that a newer version of the package was available there, than that was there in the repository. Installed wine, followed by winamp. Started winamp, and it works, but wait, where have all the title-bars (the bars with the close minimize and maximize options) disappeared? There aren't any borders for the windows either, to distinguish between two windows. CTRL+ALT+BACKSPACE (restarts X) Uninstall. Next came winamp lite 5.53, but it had the same problems. I looked for an older version of winamp n found a 2.9 something Installed it n it worked :)the title bar look a little odd n there was a border there for the winamp window, but it was working. I wasn't satisfied. Uninstall, reinstall new version, uninstall compiz (desktop manager) and now the new version works. Now I am satisfied, enqueued all my songs, pressed J (for jump to file) n the damn thing crashed. Uninstall, Reinstall old version, enqueue songs, J... It crashed again. For the first time I was wondering why I had installed linux. Now to reinstall compiz, but it simply wouldn't reinstall. I remembered I had purged a few folders manually, why do I do such things? Google, Goolge, try this command, Sudo apt blah blah blah and it worked. Now my system is back to normal again. Now I'll stick to the repositories. It was then that I found Beep Media Player(BMP). It looked and felt a bit like winamp, even though it lacked the media list. A little research showed that it was in fact based on the XMMS player. J and the search menu popped up. Great. The features it lacked included the lack of support for WMA format. I did find loads of plugins for it, including those for playing WMA, but they are all in the .TBZ format, and using the TAR utility to extract the package gives a failure. I have kept the files aside for when i learn how to install em. Then came Beep Media Player Experimental(BMPx), a successor to BMP. It had those iTunes type looks I really hated, but the one thing it had was a really cool Internet Radio. It supported all the formats I required too. But it wasn't much of an improvement over Rhythmbox. The hunt continued and then next came Audacious, a fork of BMP. Tried it out n it is just what I wanted. J n the jump to window opened up B and the next song started playing. This is it, I have finally found the ideal player. Audacious Rocks \oo/

Sunday, April 27, 2008

Objects of desire

What is life without materialistic desires? It is only human to want and acquire more, and I am no saint. Though this list does contain what I desire at this frame of time, I am certain, that some items on this list would be struck off before I acquire em, and am pretty sure that a lot more would replace them in due time, for it is desire that fuels a man. So here's a list of objects I desire :

1. Numero Uno on my list of desirable objects wouldn't come as a surprise to those of you who know me. Yes, it is a bike, and yes it is a bullet. It is strikingly similar to my current ride, though it is a lot better. Ladies and gentlemen, I present to you, the 500cc lean burn Bullet Machismo. Although I am going to try to convince my Dad to buy me one, please don't be surprised if I show up on a 350 Bullet electra (new, not my current one) instead.

CTD (Cost to Dad) : Rs 1,15,000/-

2. Numero Dos is something I have already mentioned on my blog. It is a 250GB internal hard drive. I would love to go in for a SATA after I have seen the significant difference in data transfer speeds, but since it would be my secondary hdd, I wouldn't mind going in for a PATA if there is a significant price difference.

CTD : Rs 3000/-

3. Numero Tres comes something which is fueled by my passion for bikes. I believe in safety while riding, that is why I always wear a helmet. But there is a lot more safety equipment that one should use. I am talking about an armoured jacket, the kind with shoulder, back and elbow protectors. At the moment I have identified two companies that make the cheapest protective jacket, DSG and Cramster.

CTD : Rs 4500/-

4. Number four (Uno, dos, tres was all the Espanol I knew, thanks to Ricky Martin) wasn't that easy to decide, but I settled for something similar to number three in a sense. It is a jacket all right, which could be used for protection while riding too, but I want it otherwise too. I am talking about a leather Jacket.

CTD : Rs 5000/-

5. For number five, I come back to computer peripherals. This is something I have been borrowing from a friend each time I needed to use it, but when I heard of its cost, I just had to add it to my list. This, as you see in the picture is a DVD writer. Of course, if and when I buy my 250 GB hdd, this device would not be required for a while after that.

CTD : Rs 1100/-

6. Coming back to bikes, I have always wanted one of those snazzy helmets. My helmet of choice would be a full-face one with a visor and a peak. Most people think that a peak is useless, but it is really effective in cutting down the sun's glare. On the other hand, an improperly designed peak, at high speeds puts a lot of pressure on the neck.

CTD : Rs 5000/-

7. Next up comes RAM. My PC runs on a mere 512mb of RAM and a little more memory would do it good. I have just two slots on my motherboard and the manual that came with stated that I could fit in only 1GB DDR RAM. So i guess the maximum I could go up to would be 2 GB, though 1.5GB wouldn't be too bad either.

CTD : Rs 2000/-

8. Last but not the least, I have always wanted to own a bicycle. I did have one as a kid, and like my motorcycle, I rode it hard. The only thing was that it wasn't mine. It was my sister's, who hadn't ridden it. It was one of those cycles with a sissy handle bar. But luckily, most guys had such bikes and the bike wasn't pink or something ;) it was white n blue. Then when we shifted to the capital, my bike was taken away, since it wasn't safe for kids to ride cycles there. I did set out to check out the bicycles available in the market, a couple of years ago, but unfortunately none were available in my size. They were all too small. This is probably the last thing I would go n buy if i had the money (lest I be thought eccentric), but it is one thing that I would always desire.

CTD : Rs 3000/-

Monday, April 14, 2008

Lonesome again

The last time I wrote a poem, it was called Lonely & Dejected, which was in fact sparked by an incident. I did pen down a few more lines about being lonesome after I had published the poem, lines I had written down over a week. Nothing great about these little lines and no I am no longer lonely and dejected. But I found a piece of crumpled paper that contained this poem I had penned down in class and decided to publish it before i lost it. So here it goes,

Lonesome Again

Why is it that I feel so lonely,
every step in life that I take so boldly?

In an ocean of people I feel left out;
But it isn't something for which I'll pout.

Is it so that I don't fit in?
'cause I feel left out amongst friends n kin.

The more time I spend with a friend,
the more I feel the friendship end.

No explanation can ever suffice,
as to why does friendship slide over thin ice.

Do others feel the same or is it me only?
Am I the only one who feels so lonely?

Sunday, April 13, 2008

A glimpse of the end

There I was, bidding goodbye, to friends and family, to every one that mattered to me. Some were sad, most were crying, but I was at peace. There wasn't any emotion in me, I couldn't fell a thing, it was a very weired experience. I was going, going on a long journey, with no idea of where I was going to end up. I wasn't taking any of my belongings, for none were required for the journey. But then I started breathing again, breathing fast, breathing heavy. I was wet, drenched in sweat. My mouth was dry and longed for water. My head was spinning, and hurting too. I was still alive, in my room. It was dark, it was hot. The fan wasn't spinning. Damn it. I felt better in the dream where I was dead.

Wednesday, April 9, 2008

And then came Linux

Following my recently found obsession for operating systems, I have now installed Ubuntu 7.10 (Gutsy Gibbon) for AMD64 on my system. I now have a triple boot system with XP, Vista and Ubuntu. I have also acquired a copy of Ubuntu 8.04 Beta (Hardy Heron) which I plan to Install after my exams, by when i think the final version would also be out too. So anyway, my plan after my exams is to check out all the other distributions of Linux (I can lay my hands on) as well, comparing each one of then in terms of user friendliness as well as performance. Though in order to implement this plan of mine, I think i will have to buy a new hard-disk... probably a 250/400 GB PATA (cause i believe PATA is cheaper) one would suffice and I could back up my the data from my 160GB hdd onto the new one n use the SATA one that I own as the one on which I install all the OS. One more thing i require is RAM... My system is getting old n it has got a mere 512 MB of RAM... Another 512 MB in the only remaining slot would surely make things faster. But the RAM can wait right now. If my current configuration can run vista with ease, I am sure i don't need more RAM for the time being. I still have little knowledge as to how Linux is working but i hear it is much simpler to understand than in case of windows. My final aim is to tweak a distribution of Linux to a point where it performs better than my XP which i haven't logged on since the Ubuntu install (until today). The last time I installed Linux on my system (about 2 yrs ago), it was too complicated for me to understand, I really couldn't do much with it n it took me a week just to understand how to mount my drives automatically at startup. But Ubuntu 7.10 is simply awesome... for starters you could install it from your windows installation, just like you install your programs. I took a more traditional approach and booted up with the CD which booted up in Ubuntu Live version with access to my hard-drive n all (all drives mounted on their own). On the desktop there was an install icon clicking which i experienced one of the most pleasant OS installation (after the XP auto-setup, which i worked on one summer vacation, one in which u don't have to even be around to install your OS) I was playing Freecell, one of my many vices, and browsing the internet while Ubuntu was installing itself. Even the graphics are really pleasant. I really loved the wobbly window effect n also I am big fan of transparency as u will notice in my screenshots... Another interesting feature of Ubuntu was frequency scaling... What it does is that it lowers the frequency at which your processor is working at and makes your system more power efficient as well as keeping it cooler (not supported by all hardware)... a must for laptops. For eg, my processor is a 1.8 GHz one... but most of the time my system is running on 1.0 GHz (55%)... where the frequency would increase to 1.8 GHz only when the OS needs the processing power. This feature comes switched on by default and there is a meter you could add to your panel to know at what frequency your processor is operating at. The down side of frequency scaling that I have noticed is that sometimes my system is slow to respond and more importantly when i reboot, it gives a CPU over-voltage error quite often. Although you could disable this option from the BIOS, there is also this command you could type in your terminal window, ie,
sudo /etc/init.d/powernowd stop
And of course you replace that stop in the end with a start in case you want to start the service. In case someone is reading this (remote possibility) who has knowledge of advanced stuff (that's almost impossible... I say almost because they say impossible is nothing... yes, i guess i am branded too) could you please guide me how to do toggle the feature on and off using the GUI??? Installing softwares in Ubuntu is pretty simple too (if u have a decent unlimited net connection) there is this cool Synaptic Package Manager which allows you to install packages from the net. You could also add a software repository manually and install really cool stuff... for free... Oh! and the stuff that they say is non-free, doesn't mean that you have to pay for it... It means that its source code is not available for viewing and modification :D I leave you with the sceenshots of the three operating systems which i took using the same wallpaper :
The XP screen:The Vista screen:
The Ubuntu 7.10 screen: