Wednesday, February 1, 2012

lvremove: Can't remove open logical volume

Working with lvm I have come across many a times when the logical volume removal doesn't work. I am listing down those steps to stop searching solution on google every time. Moreover the information is scattered. So I include all here.

Details
My Volume Groups = deploy
My Logical Volume = relimg

The lvremove command is used to remove. But many a times this might not work in one shot. I use a shell script to do it-
lvremove -f /dev/deploy/relimg_*        while [ $? -ne 0 ];
do
   sleep 1;
   lvremove -f /dev/deploy/
relimg_*;
done

lvremove /dev/deploy/relimg*
  Can't remove open logical volume "relimg_root"
  Can't remove open logical volume "relimg_var"
  Can't remove open logical volume "relimg_swap"

dmsetup ls| grep relimg
deploy-relimg_swap    (253, 28)
deploy-relimg_root    (253, 26)
deploy-relimg_var    (253, 27)

See for each
dmsetup info -c deploy-relimg_var
 Name              Maj Min Stat Open Targ Event  UUID                                                                
deploy-relimg_var 253  30 L--w    1    1      0 LVM-JWRaaEr4Fpx0HGFzDuIXNgy0CDzV4KpWQ9tWYGVu3tT5sR1nAjJPc5FBM2rhT8vF

See that Open as 1 is the problem.
Now you need to use dmsetup to close.

dmsetup remove deploy-relimg_var
lvremove /dev/deploy/relimg_var

You might also get follow error on this command (dmsetup remove deploy-relimg_var)
device-mapper: remove ioctl failed: Device or resource busy
Command failed

If so, following will help
  • lsof, see where device is busy, stop it and do above steps again
  • mount, see if logical volume is mounted, unmount and do above steps again

Saturday, January 21, 2012

Linux: Not Able To SSH

Some very common problems we face related to ssh.
  - Not able to ssh to different machine
  - Not able to ssh in my own machine from somewhere else
  - Ping to My Machine works but not ssh

Solution I present is wrt Ubuntu-

Ensure the following. I am sure this will resolve all your problems
  • Ensure you have both client and server installed in your system to be able to ssh to other machine and ssh back to your machine from somewhere else
    • apt-get install openssh-server openssh-client
  • Ensure you have ssh running in system you wish to ssh
    • /etc/init.d/ssh start
    • service ssh start
  • Even with your ssh running you will not be able to ssh to a machine with firewall enable. Stop it or alternative is to enable your 22 port
    • uwf enable 22

Wednesday, January 18, 2012

Installing & Configuration of Bugzilla (Debian & Ubuntu)

I have jotted down the Experience of Installing & Basic Configuration of Bugzilla and published in case someone needs some assistance.


Distributor ID:    Debian
Description:    Debian GNU/Linux 6.0.3 (squeeze)
Release:    6.0.3
Codename:    squeeze

Won't be different for Ubuntu as well. Except that you will have to search and install package with right version. I tried on 10.04, where some or the version of the required package were not available. I hunted them down and installed manually.

INSTALLATION
===========
Following are the steps. Execute them on your terminal.
  • apt-get install locales
  • dpgk-reconfigure locales (Chose en_US.UTF-8 )
  • apt-get install mysql-server mysql-client
    • You also opt for postgresql or oracle
  • Make sure you set the root password (abc) & Keep note of 
  •  apt-get install apache2
  • cd /var/www
  • wget http://ftp.mozilla.org/pub/mozilla.org/webtools/bugzilla-4.0.3.tar.gz (or whatever you want)
  • tar xfv bugzilla-4.0.3.tar.gz
  • cd bugzilla-4.0.3
  • ./checksetup.pl --check-modules
    • There will be quite many modules which wouldn't be present. You might opt for overlooking the optional though I suggest not to.
    • You need to install one of mysql, postgresql or oracle
    • The end of script output will explain you how you must install those module. For me it did not work well.
So I had to hunt down those package for each module and install them one by one. Tedious stupid task.
  • I have listed them here as package (Modules it provides). Install them each
    Package (Modules it provides)
    libtimedate-perl (TimeDate)
    librose-datetime-perl (DateTime) (DateTime-TimeZone)
    libtemplate-multilingual-perl (Template-Toolkit)
    libemail-send-perl (Email-Send)
    libemail-mime-perl (Email-MIME)
    liburi-perl (URI)
    libchart-perl (GD) (Chart)
    libtemplate-plugin-gd-perl (Template-GD) (GDTextUtil) (GDGraph)
    libmime-tools-perl (MIME-tools)
    libwww-perl (libwww-perl) (HTML-Parser)
    libxml-twig-perl (XML-Twig)
    libauthen-simple-ldap-perl (perl-ldap)
    libauthen-sasl-cyrus-perl (Authen-SASL)
    libauthen-simple-radius-perl (RadiusPerl)
    libsoap-lite-perl (SOAP-Lite)
    libjson-rpc-perl (JSON-RPC)
    libjson-xs-perl (JSON-XS)
    libtest-taint-perl (Test-Taint)
    libhtml-scrubber-perl (HTML-Scrubber)
    libtheschwartz-perl (TheSchwartz)
    libapache-db-perl (mod_perl)
  • Now re-run ./checksetup.pl --check-modules
    • Verify those installed modules are having right version. If not, you need to hunt those packages here
      • Debian: http://www.debian.org/distrib/packages
      • Ubuntu: http://packages.ubuntu.com/
    • It might happen that for you OS version the expected package version is not available. I had installed the higher version by manually downloading the package and it's dependency
  • apt-get install bugzilla3 bugzilla3-doc
  • Fill in right data whatever is needed. Some Pointers
    • Customising status Resolution: Yes
    • Administrators Email Address: Admin_Vivek@hissite.com
    • Administrators Full Name: Vivek Has FullName
    • Bugzilla's Admin Password (twice): xyz
    • Configure database: Yes
      • Though you can do later also. I prefer this
    • Password for mysql root user: abc
      • make sure you provide mysql passwd and not any other
    • Give password for bugzilla user (twice): abc1
    • Now the installation will be done successfully
  • Now re-run ./checksetup.pl but without --check-modules option
    • it will generate localconfig file
  • Now edit localconfig
    •  $webservergroup = 'www-data';
    •  $db_name = <name of your database>;
    •  $db_user = '<user name of your database, no root>';
    •  $db_pass = '<passwd of above db_user>';
  •  Now re-run ./checksetup.pl but without --check-modules option AGAIN
    •  This should go right. If problem reconfirm your above values
  • Now edit your apache file /etc/apache2/httpd.conf
<Directory “/var/www/bugzilla”>
AddHandler cgi-script cgi
DirectoryIndex index.cgi
Options +Indexes +ExecCGI -MultiViews +SymLinksIfOwnerMatch +FollowSymLinks
AllowOverride None
Order allow,deny
Allow from all
</Directory>
  • service apache2 stop;
  • service apache2 start;

CONFIGURATION
============
Now Open Your browser, and this is your bugzilla IP.
http://<IP Of Your System>/bugzilla3

Do the following-
  • Click on Login and put in Admin credentials
    • Admin Username= Admin_Vivek@hissite.com
    • Admin Password= xyz
  • Click Administration Option
  • Click Parameter Option
  • Under Index --> Required Settings change
    • urlbase = http://<IP Of Your System>/bugzilla3
    • Change other option only if you know them
  • Under Index --> Email change
    • Choose mail_delivery_method from drop down (I used smtp)
    • Choose some mail_from entry like  Product-BUG@hissite.com
    • Choose other otions accordingly.
    •  Enable Mail Debug Option. It helps in email debugging
  • Save the changes
Now your Bugzilla is ready.
Logs are available with apache2 log.

Tuesday, September 20, 2011

Enable Wireless Greyed Out-Ubuntu 10.04

Since Yesterday I had great trouble enabling my Wireless on one Flintstone laptop. I unchecked the Enable Wireless option shown at Network Connection icon and I don't know how it Greyed out that option. So when i wanted my Wireless Back, I couldn't.
iwconfig showed wireless interface off
iwlist scan would scan nothing
Trying all possible solution shed by google pages. I got some hints and did it hard way.
Solution: Worked For Me
I had to Go to Machine BIOS to Enable My Wireless Back.
Didn't find command line solution :-(

Friday, July 8, 2011

git howto & Help

I faced some challenge to get started with git. Adding insult to injury I was behind firewall.
And while I started I found no straight forward information. Long assistance with Prof. Google ;-) I got some scattered help. So to make sure I never forget it I thought to keep it posted on my page.
Note: This is no tutorial but my meandering experiences and learning when I started to work with git.


I was working with gitorious so all my instruction are wrt gitorious.org
The first thing you ask is what is git. Well ask the Professor I mentioned above you will get loads of information.

Now after your first question got answered you might want to know how to get started with git?

So here is how you get along with it.
Step 1: install git. Run the following command as root.
Opensuse: zypper install git
Ubuntu: apt-get install git-core

Step 2: Generate ssh key. Run the following command.
ssh-keygen (enter few time if you wish to take default options)
You get some message like this in the end
Your public key has been saved in /home/<username>/.ssh/<someid or id_rsa if taken default>.pub

Step 3: Create an account in Gitorious
  • You will get logged into it once create (or login to your gitorious account)
  • Go to Dash Board
  • got to Manage SSH keys option
  • Click Add SSH key & you will find one text editable area
  • Go to a terminal and run cat /home/<username>/.ssh/<someid or id_rsa if taken default>.pub
  • paste this output to the text editable area.
  • Save it
  • After adding you might find a X (cross) under "Ready ?" row.
  • Refresh the page it will turn into be a tick option (It's for your confirmation. It's ok if this step is not done)
Now you can work with git.

Trouble-Shoot 1:: You might face problem in accessing the content (git clone ...). When you try first time you may end up getting some error like this
fatal unable to connect ... return code 22 bla bla
Follow are some pointers for help
  • Check your proxy setting (env|grep _proxy)
  • Check if you are behind the firewall. If so-
    • Either Disable firewall
    • or Tunnel through it if you know right port and host
      • Here is the script. Put this script in ~/.ssh/config
      • host proxy
        HostName <hostname>
        user <username>
        Compression no
        LocalForward 2224 gitorious.org:22

        host gitorious.org
        HostKeyAlias gitorious.org
        User git
        IdentityFile <~/.ssh/id_rsa (default, if yours is different put different file)>
        HostName 127.0.0.1
        Port 2224

      • Run ssh -N -f proxy
      • It would ask for few authentications etc. Do that. Now your git commands will run like a hot wire in butter
Trouble-Shoot 2:: When after making your changes you do git push. You are unable to push it. The trouble shoot is similar as above but one extra.
  • Check if you have push access right to that repository
How to clone a branch?
- You always clone the master. It will bring branch anyways.