Creating a super-pendrive

15 11 2009

Hi,

Its been really long since I blogged. Before going ahead, want to tell you that will be posting my endeavours on running virtual machines soon.

This, however, is my experience/guide for creating a super pen drive (a.k.a. a usb disk that if booted from presents a grub menu with options – GParted, Fedora, .. and any other linux distro hopefully, and has Fedora persistence, and has a spare partition too for you to use it as a normal pen drive).

It wasn’t as straight forward as I thought (like… all other things).

Steps:

  1. Decide the partitioning layout and partition the pen drive.
  2. Install grub on one partition
  3. Install GParted on another
  4. Install Fedora on another
  5. Install grub again on the partition in step 2 :P , and setup grub.conf
  6. Sit back, and enjoy (may need to crouch forward in some cases.. )

A super neat trick:

To check at any time how you pen drive would behave if you boot from it, use the command : qemu -hda /dev/sdb -m 256 -vga std

This command reduced my research time to one third.

1) Decide the partitioning layout

I used GParted on my Fedora installation (on my harddisk) to set up the partition of the pen drive.

2) Install grub on one partition

Make sure you manually mount the grub partition. The /media/something folder in which it gets mounted automatically gave me some trouble. So unmounted it from there, and mounted /dev/sdb5 to /mnt/usbgrub

grub-install –no-floppy –root-directory=/mnt/usbgrub/ /dev/sdb

3) Install GParted on another

Use UNetbootin for GParted

4) Install Fedora on another

Need to make sure that usb disk is ext3 before doing this. When I did this on a vfat disk, I got an “error 22″ when trying to boot from the usb disk.

Use liveusb-creator or live-iso-to-disk for Fedora.

Persistence is buggy according to http://forums.fedoraforum.org/archive/index.php/t-219250.html so instead, a better solution is to directly install fedora on the pen drive on a separate partition, like in http://linuxsoftwareblog.com/blog/?p=156

5) Install grub again on the partition in step 2 :P , and setup grub.conf

mount /dev/sdb5 /mnt/usbgrub/

grub-install –no-floppy –root-directory=usbgrub/ /dev/sdb

Now, to setup the grub menu:

cd /mnt/usbgrub/boot/grub/

cp /boot/grub/grub.conf .

cp /boot/grub/splash.xpm.gz .

gedit grub.conf

# grub.conf generated by anaconda
#
# Note that you do not have to rerun grub after making changes to this file
# NOTICE:  You have a /boot partition.  This means that
#          all kernel and initrd paths are relative to /boot/, eg.
#          root (hd0,1)
#          kernel /vmlinuz-version ro root=/dev/mapper/VGSahil-LVRoot
#          initrd /initrd-version.img
#boot=/dev/sda
default=0
timeout=5
splashimage=(hd0,4)/boot/grub/splash.xpm.gz
hiddenmenu
title Fedora (2.6.30.8-64.fc11.i686.PAE)
root (hd1,1)
kernel /vmlinuz-2.6.30.8-64.fc11.i686.PAE ro root=/dev/mapper/VGSahil-LVRoot rhgb quiet
initrd /initrd-2.6.30.8-64.fc11.i686.PAE.img

title GParted Live
root (hd0,5)
kernel /live/vmlinuz1 boot=live union=aufs    noswap noprompt acpi=off irqpoll noapic noapm nodma nomce nolapic nosmp ip=frommedia vga=normal
initrd /live/initrd1.img

title Omega 11 Live
root (hd0,6)
kernel /syslinux/vmlinuz0 root=/dev/sdb7  rw liveimg quiet  rhgb
initrd /syslinux/initrd0.img





Digikam Caveats – things to make sure using Digikam

14 11 2009

I have been bitten. And so I post this in the hope that some needy soul finds this before he/she/it gets bitten too.

Problem: Digikam saves image tags (ratings/captions that you spend hours editing) in its internal database. When you switch to a newer linux version, lose this information – unless you are careful enough to copy over the digikam.db4 file – which I was. The second problem is that if you move around or copy your files using a file browser, you lose this information ( !!!! ), and digikam doesn’t allow copy of albums (!!).

Solution:

  1. Specify the location of your digikam.db4 file as the root directory of you photo library. This way, when you move your library, you have the digikam database with you.This can be configured through digikam Configuration > Collections.
  2. The most important step (which digikam should have made default according to the Principle of least astonishment)
    • Enable the all options starting with “Save” in digikam Configuration > Metadata. This would save all tags, ratings, captions and copyright information directly in the image instead of relying on digikam database for it.
      digikam-metadata-setting
    • Add author and copyright information in digikam Configuration > Identity. I put the following there:
      • Author: Sahil Ahuja
      • Credit: Sahil Ahuja
      • Source: http://sahilahuja.wordpress.com
      • Copyright: CC BY 3.0

      digikam-identity-setting

    These steps will ensure that from now on all you files get properly tagged, the way you mean them to be.

What about the images I have already tagged, captioned and rated?

After these setting are applied, digikam enforces them only for images you write to from now onwards. For images that are already in your library, we need a write operation on them to embed the metadata into the files.

This can can be done by creating a custom search that matches all possible ratings one by one, and right clicking and assigning the same rating again. Do the same for all tags too. And now all your metadata should get embedded in the file. Voila!

digikam-customSearch-rating





httpd with SElinux

22 10 2009

Giving httpd access to other folders (apart from default SElinux allowed folders):

  • system-config-selinux rocks!!
    Go to System-> Administration -> SELinux Management (or system-config-selinux from command line).
    Type httpd in Filter and press enter. You will see that files that allow httpd write access have the Selinux File Type httpd_cache_t:s0. So.. now you know what to do right? Say you want to give httpd write access to folder /var/lib/dokuwiki/data/cache, then add a new file labelling using the Add button with the following details:
    File specifications: /var/lib/dokuwiki/data/cache(/.*)?
    File Type: all files
    SELinux Type: httpd_cache_t
    MLS: s0

    and then
    restorecon /var/lib/dokuwiki/data/cache

    OR

  • Go to /var/lib/dokuwiki/data and apply the selinux file type to cache directorychcon -R -t httpd_cache_t /var/lib/dokuwiki/data/cache

And now, httpd should have write access to this folder.
Running httpd on other ports:
Open /etc/httpd/http.conf and change
Listen 80
to
Listen 81

If you use VirtualHosts, you need to change the ports there instead (<VirtualHost *:81>)
Giving httpd access to other ports:
Go to Network Port in SELinux Administration and filter of “80″ and press enter. You will see an entry for http_port_t. Create a similar new entry for port 81 for SELinux Port type http_port_1.
And that’s it.
Links to posts that helped me:
Dan Walsh’s Blog

Notes on SElinux





Making Fedora rpms/yum work – Offline

22 10 2009

This is guide relevant to those who wish to spread fedora to friends and loved ones who don’t necessarily always have an internet connection (or a good one atleast). The problem faced in such situations, almost always (talking from my experience), is that there are a huge number of rpms that need to be downloaded to make fedora capable of playing media, and fill it with good stuff like k3b, amarok etc.

This isn’t always possible with the skimpy internet connections that our not-so-tech-savvy aunts have. (We’ll assume that it is our aunt on whose system we need to install fedora for the sake of this guide.)

So, I devised a way of spreading fedora to our aunt’s system, without getting embarrassed  by that fact that we weren’t able to run mp3 on their system.

The way to do this, is to install a fresh copy of fedora on our system, and then bring it to perfect shape by installing many more rpms, and while doing this, keeping a copy of the rpms required, and then copying this repository of rpms (which we are sure don’t require any more rpms as dependencies as we install them on our own system in offline mode) on a pen drive and taking it along with the fedora installation media to our aunt’s home. And after installing fedora on her system, we simply install all the rpms on her system.

Steps:
On our system:
Download all rpms required for the extra packages (the package rpms + dependencies)
yumdownloader --destdir=rpmsForAunt --resolve rpmName(s)

OR

create a service pack of all pending updates or certain rpms using gpk-service-pack

yum install gnome-packagekit-extra

OR

Edit /etc/yum.conf and change the value of keepcache to 1. After the update is done, the downloaded rpm files then can be found in (and copied from) subfolders named “packages” in /var/cache/yum. When you’re done with them you can get rid of them to save disk space with yum clean packages.
On our aunt’s system:

  1. Install fedora.
  2. Install the extra downloaded rpms:
    1. You need to disable all repositories before yum localinstall will work without net access. To do so,
      go to System > Administration > Add/Remove Software and go the System > Software Sources and uncheck all sources.
    2. Installing the rpms:(1 : see footnote)
      cd rpmsForAunt
      yumlocalinstall --nogpgcheck *

      The above command is to be run for every category of rpms below after copying the resultant directories on our Aunt’s system.

For getting all updates:
I wrote a script for downloading all updates (after a fresh install) to a directory:
for i in `yum list updates | grep fc11 | cut -d ' ' -f 1`
do
echo Now downloading rpms for package $i
yumdownloader --destdir=localUpdate --resolve $i
done

For getting all media rpms:
rpm -ivh http://rpm.livna.org/livna-release.rpm
rpm --import /etc/pki/rpm-gpg/RPM-GPG-KEY-livna
rpm -ivh http://linuxdownload.adobe.com/adobe-release/adobe-release-i386-1.0-1.noarch.rpm
rpm --import /etc/pki/rpm-gpg/RPM-GPG-KEY-adobe-linux

(the above is required only so that you (and not your aunt) can download the rpms)
yumdownloader --destdir=localRpmsForMedia --resolve libdvdcss vlc flash-plugin xine xine-lib-extras xine-lib-extras-freeworld mplayer mplayer-gui gecko-mediaplayer mencoder amarok rhythmbox gstreamer-plugins-ugly gstreamer-plugins-bad gstreamer-ffmpeg audacious audacious-plugins-freeworld* k3b

A few more rpms that I use:
yumdownloader --destdir=localRpmsOther system-config-lvm gparted digikam m17n-db-*

(1)I faced an issue while bash was updated using this method. It said transaction failed.
To resolve this, I ran
yum-complete-transaction --clean
rpm -e bash

The above command listed two bash versions (I don’t remember the version numbers), on saying rpm -e bash.version1, it said there are many dependencies, then I tried rpm -e bash.version and it worked. Then, I went back to the yumlocalinstall step and then that worked.





India, and Mr. God

29 10 2008

So long since I have written anything. And there’s so much I want to write.

But I ll write about what’s on the top of my mind right now.

Yesterday (Diwali), Rajni aunty, mom’s friend, came to our house. Her son, (Mr. X we’ll call him) went straight to everyone’s feet wishing them Happy Diwali, conjuring a smile on everyone’s face as they blessed him (I know, a strange custom. Hopefully will be prevalent only for one more generation). Then he dashed towards the glass table where we had kept crackers we had dried all day long on the roof. We didn’t buy any crackers this year, we used only what we had from last year.

We had a special matchstick that was a mini-sparkler. Mr. X took that out. I don’t know what possessed him, but what he did next was insane. He lit the match stick, on top of the stack of crackers.

The crackers caught fire. Yes, inside my house. There was a stack of loose electric crackers that caught fire and thus were lighting each other. And all of them started bursting one after the other. The whole commotion went on for around a minute after which the electric crackers ran out. After the smoke settled, I saw a few atom bombs (green coloured crackers filled with gunpowder tightly wrapped with rope) lying on the glass table.

I couldn’t help thinking what might have happened had that the atom bombs gotten lit on the glass table. (Anyone heard of pipe bombs used in delhi blasts? A Hint : Its the shreds that cause the maximum damage. Not the shockwave)

A question to “modern” parents : should children be beaten up for their misdeeds? You decide.

Now, coming back to the title of the post. After the smoke settled, Mom took a broom and swiped all the leftovers to one side. (Our sofa got burnt partially). After swiping the burnt cracker papers to one side, as she was about to swipe them out of the door, Mr. X’s mom says “Don’t swipe them out of the house. It’s considered a sin to clean the house during Diwali.”

After all this. I don’t think God would mind.

Will India ever prosper? Not until our value system and reason is so deeply screwed up with religion and baseless customs.

Here’s an article I read minutes after writing my post, reinforcing what I just wrote.





Talk about punctuality!!

30 06 2008

This wednesday, working at Goldman Sachs, I got a call from Santa Fe. The guy asked me when I wanted him to bring my luggage to my house. I said Saturday (yesterday) around 10 am.

Yesterday, he reached here at 9:55. After everything was brought in and kept at the wanted places, he gave me a feedback form. And boy, the first question was :

Were we on time?

The options were :

a) on time b) 5 min late c) 10 min late d) 30 min late

and nothing after that. They DON’T HAVE a concept of getting late more than half an hour!!

Compare that to the Indian based relocation services. What options should their feedback forms have ?

How much late were we?

a) 1 day 2) 2 day 3) 1 week 4) 2 weeks 5) luggage lost in transit!





So many things… so less time…

30 06 2008

Hello Banagalore!!!

Anshu came here last week. We had a gr8 time!! He reached here last Saturday. We had an Italian brunch here at a great place named Casa Picolo on CMH road.

We asked Sriram where we could go. He told us about a great place to shop – Brigade road. Me and Anshu first went to MG road and set about searching for his memory card. We found a great lane there to shop which joined M.G. road at the middle from the left. We spent our time till the evening there going from shop to shop. From there, we went to meet one of Anshu’s friend Kriti, at Garuda mall. We took an auto to reach there. At Garuda mall, Anshu bought a few clothes for his interview. After that, she took us to Brigade road. We were walking that road, Anshu stopped suddenly and exclaimed, “I have come here before”. We were on Brigade road the whole afternoon and we didn’t know it!!. And we took an auto to Garuda mall, which was walking distance from there. I wonder which route he took us from. We went to cafe coffee day there, and them came back.

The next day, we went to a great place called Marathalli. It’s a great place for shopping. I got 50% off on my Rebook shoes! And Anshu found the memory card he was searching for the whole day on M.G. the whole day but had found only duplicate, China made cards !

Anshu and Sriram

Next Wednesday my mom is coming, and so now am making a list of places to take her to, and yes, all the above mentioned place are there in the list.

And ya, forgot to mention, I spent the weekend before Anshu’s visit in Google office in K.R. Puram, eating chocos and maggi, and playing pool and foosball.

This album basically summarizes what I did on that week’s Firday (the 13th)  : http://picasaweb.google.com/sahilahuja/ChennaiTripForVISAInterview

Time has flown by since I came to Bangalore. It’s already time for me to get ready for my New York trip!





Fedora 9 Released!!!

22 05 2008

And it rocks!!

The first thing you notice after fedora 9 is the blazing faaaast startup and shutdown times.

Now, before I say anything else about Fedora 9, here are a few screenshots :

Here’s Gnome  in F9 :

Gnome Preview

And here is KDE 4 (finally !!):

KDE 4 Preview

KDE 4 seems to be following the footsteps of some of its latest applications like Basket. The new start menu now acts like that of IPOD. And the inbuilt search as shown in the following video is simply amazing!. The whole desktop has been given a major revamp. And so has been the theme. The widgets on the desktop now act a bit like widgets on Vista.

Among the key features, the feature that i think will prove to be indispensable later in making fedora more famous is the windows fedora live usb creator.

A feature (a release method actually) that really helped me a lot in creating the live DVD is Jigdo. Here is what the official release notes say about Jigdo :

Fedora releases are also available via Jigdo. This distribution method can improve the speed of obtaining the installation ISO images. Instead of waiting for torrent downloads to complete, Jigdo seeks the fastest mirrors it can find via the Fedora Project Mirror Manager infrastructure, and downloads the bits it needs from these mirrors. To optimize seeking these bits, you can tell Jigdo to scan a DVD or CD you already have, and cut down on redundant downloads. This feature becomes particularly useful if you:

1. Download all the test releases and then get the final release, in which case you have 90% of the data already with each subsequent download.

2. Download both the DVD and the CD set, in which case the DVD holds 95% of the data needed for the CD sets.

3. Download any combination of the above.

Anaconda, the installer for fedora, now supports resizing of ntfs, ext3 and ext4 partitions during installation. This will be of great help to windows users. (yes, it supports ext4 now.) Also, it gives an option of installing encrypted partitions. Business users ought to try this, but with caution.
Here is a list of all the new features in fedora 9.





College Nostalgia…

22 05 2008

Here are a few pics and videos I took on the last day of college :

Last night at octa:





The Gods must be crazy..

22 05 2008

Really.


I mean, this is Faridabad.. in MAY!!! Last year this time, it was blazing hot with loo making it’s rounds all over India, with people dying of brain fever.

And now, when I come to Faridabad for 10 days, the last time before my job starts, the weather decides to become stormy, windy and rainy.

I caught a throat infection while coming home via Bhilai from NIT Trichy. I was hoping the heat here would cure the infection. But no, God makes sure the weather is such that it only gets worse.

Thank you, O Lord. (:oloo)