Thursday, 16 February 2012

convert time from command line without going to internet

My linux desktop is in Asia/kolkatta timezone. I used the following command to find the PST of a time in local host. Open bash and enter the following on linux
$TZ=America/Los_Angeles date -d "Thu Feb 16 11:00:00 IST 2012"
and it returns
Wed Feb 15 21:30:00 PST 2012

So with this technique you can use command line to find equivalent time of any timezone to any time zone. date command is awesome. GNU you rock.

Wednesday, 15 February 2012

getting linux to run as a service in windows and accessing linux server through ssh while it runs in the background

I tried to run linux as a service in windows seven professional 64 bit edition. I was successful. I used to virtualbox 4.1.8 to run fedora 14 x86_64. Then i used the VBoxVmService-3.0-Sweet_Potato software to run the vm as a service in background. After downloading and following the instructions for VBoxVmService i faced the following error:
windows service did not start due logon failure
The solution is that add the user account specified in vboxvmservice in that ini file to the local policy as logon service. As described below from

Member Server

If the user is a member of a stand-alone member server:
  1. Start the Local Security Settings MMC snap-in.
  2. Expand Local Policies, and then click User Rights Assignment.
  3. In the right pane, right-click Log on as a service, and then click Security.
  4. Add the user to the policy, and then click OK.
  5. Close the Local Security Settings MMC snap-in.

my efforts to get chromium on rhel5 and more about rpm

I tried to get chromium browser build from source on rhel 5 x86_64 . After a day of struggling i realized that i might hit a road block like others. But in that process i learn couple of things:
If you get this error on centos 5 or rhel 5 when launching gclient, then it means that python version is old and needs to be updated to 2.5 or later.
                              File "/opt/depot_tools/", line 1455
                                        jobs = 1 if sys.platform == 'cygwin' else 8

gclient is the sync tool of the part of depot_tools provided by chromium team to sync the source content after downloading the latest tar file as instructed here.

Then if you upgrade to python2.6 as available in epel repository then you hit a roadblock. The default python is 2.4 which wont work with depot_tools. So you can sym link the python26 to python. This will make depot_tools work but your other tools will fail. most importantly yum wont work any longer. So the solution. rename all references to python in depot_tools to be called as python26 and dont touch default python. I accomplished this by running the command below in depot_tools directory:
for i in `find . -exec egrep -l '/usr/bin/env python$' {} \;`; do
> sed -i 's@#!/usr/bin/env python@#!/usr/bin/env python26@g' $i
> done

and after that in the same directory this, as i noticed that there are some reference to python in files:

for i in `find . -exec grep -l '/usr/bin/env python\\n' {} \;`; do
sed -i 's@#!/usr/bin/env python\\n@#!/usr/bin/env python26\\n@g'$i

 This was the easy part. Now comes the part where i stuck in proceeding:
 Running "gclient sync" in the directory /opt/chromium/src/ might produce the following error when done in rhel 5/centos 5:

Call to 'pkg-config --cflags gio-2.0' returned exit status 1.

The reason for this error is glib2 package in the up to date rhel 5 doesnt have the module gio-2.0 library module. it is provided by a more recent package that is meant for rhel6/centos6. glib2 depends on glibc which in turn depends on glibc-commons. And then there is a circular dependency between glibc and glibc-commons. And these have further dependency on rhel6 version of binutils, prelink and nss.  And all these package version of rhel6 wont install in rhel5. Nobody has backported these packages for rhel5. I dont think anybody will in the near future. So the way out would be to compile them from source. But i read changing glibc is like changing the fundamental system of linux. So will be posting this task to a later date till i figure out the implications of this change. Till then i will stick with the latest version of firefox, which doesnt happen to be such a pain as chromium on rhel 5.

These are some rpm command i learn as a part of trying to get the required dependencies installed:
rpm installlation options:

--replacefiles : usefull if you are installing a later version of pkg in parallel to a older version and hence the file is owned by both the packages and it throws a conflict error.

--replacepkg : install the Package Even If Already Installed

--nodeps : dont do dependency resolution , just install.

These options should not be used unless you know the implication of doing the above.

You can even use yum to install locally downloaded packages and it tried to take care of dependencies also:
yum localinstall /path/to/locally/downlaoded/rpms
yum install /path/to/locally/downlaoded/rpms

yum localinstall is for older version yum and newer verison uses just install.

when doing installation from rpm , and you see something like this,


then , the one in braces mean PayloadIsXz is a module in rpmlib file.

Monday, 13 February 2012

firefox no remote and rhel 5 setting for custom firefox in linux rhel 5.4

Today i understood what -no-remote argument to firefox app does, atleast its implications. So if you have two instances of firefox with two different versions and you want to use them both parallel, then you should be using -no-remote option in one of the them (usually the least used version of firefox). I did a mistake of using no-remote option on both version of firefox and ended up instances firing firefox from other application having problem in locating the firefox. So i used the following option in my primary firefox instance 

                      /home/ashwinke/firefox/firefox -P "ashwin" 

And the following in my secondary version of firefox:

                      /usr/bin/firefox -P "default" -no-remote

With this setting everything seems to work fine. This seems to solve the problem of 

"Firefox is already running, but is not responding. To open a new window, you must first close the existing Firefox process, or restart your system"

This is my setting in my preferened application setting in rhel 5.4

                     System --> preferences --> more prefrences --> prefered application --> web browser is changed to "custom" --> command section is changed as "/home/ashwinke/firefox/firefox -new-tab %s".