Thursday, December 13, 2012

Ruby gem no such file to load — mkmf

Setup GEM on your machine:

When you try to install packages with gem, most of the time it does not work due to the wrong setup. Always do it completely:

sajan@test10:~$ sudo gem install mysql
Building native extensions.  This could take a while...
ERROR:  Error installing mysql:
ERROR: Failed to build gem native extension.

/usr/bin/ruby1.8 extconf.rb
extconf.rb:5:in `require': no such file to load -- mkmf (LoadError)
from extconf.rb:5


Gem files will remain installed in /var/lib/gems/1.8/gems/mysql-2.9.0 for inspection.
Results logged to /var/lib/gems/1.8/gems/mysql-2.9.0/ext/mysql_api/gem_make.out

What are the packages needed: 

1. sudo apt-get install ruby
2. sudo apt-get install rubygems<LateVersion>
3. sudo apt-get install ruby<version>-dev


Things should work now. Enjoy!

Friday, December 7, 2012

DRAC/ILOM SSH/TELNET Command line helps

DRAC SSH/TELNET Command line helps

DRAC (Dell Remote Access Console) is a cool utility for remote server management. Unfortunately Crazy Java may not work properly most of the time, and luckily we have ssh/telnet access to the DRAC and we can do most of the stuffs there with commands.

Note: DRAC ssh/telnet works like serial console server. You may need serial console redirection enabled sometimes.

HOW TO USE:

I am explaining couple of important Utilities with SSH/TELNET

1. ssh/telnet to the DRAC/ILOM IP (Being a Linux guy you should know this :) )
2. You will see a prompt like below:


$ ssh 192.168.75.10 -l root
root@192.168.1.19's password:
/admin1->

3. How to reboot the machine:

/admin1-> cd /admin1/system1
/admin1/system1
/admin1/system1-> reset
/admin1/system1 reset at Sat Dec  8 07:23:51 2012

/admin1/system1-> 

3. How to Connect to Console:

/admin1/system1-> cd /admin1
/admin1
/admin1-> console com2

4. How to PXEBOOT of get other Boot Options:
You will see options displayed like below, Choose the one u need:

Press the spacebar to pause...

KEY MAPPING FOR CONSOLE REDIRECTION:

Use the <ESC><1> key sequence for <F1>
Use the <ESC><2> key sequence for <F2>
Use the <ESC><0> key sequence for <F10>
Use the <ESC><!> key sequence for <F11>
Use the <ESC><@> key sequence for <F12>

Use the <ESC><Ctrl><M> key sequence for <Ctrl><M>
Use the <ESC><Ctrl><H> key sequence for <Ctrl><H>
Use the <ESC><Ctrl><I> key sequence for <Ctrl><I>
Use the <ESC><Ctrl><J> key sequence for <Ctrl><J>

Use the <ESC><X><X> key sequence for <Alt><x>, where x is any letter
key, and X is the upper case of that key

Use the <ESC><R><ESC><r><ESC><R> key sequence for <Ctrl><Alt><Del>

 For More Options, type help on the prompt ;)




Tuesday, November 27, 2012

Linux Machine Up on Multiple Network/VLAN/Subnet



Use Cases to enable multiple subnet/vlan/network on your machine:

Some times you will need your server to be talking through different networks (VLANS) for some reasons. Example, I need to create a hypervisor (Physical server which holds all my Virtual Machines) with KVM which gives VMs in multiple VLANs. Taking this example to explain this setup:


I have two VLAS (Virtual Lan or Two physically different LAN):

1. Production VLAN/SUBNET:

192.169.75.1/24
Gateway: 192.168.75.1

2. Dev QA VLAN:

192.168.76.1/24
GateWay: 192.168.76.1

Need to Create the hypervisor which can Give Virtual Machines on both the VLAN/SUBNET. If we simply bring up the hypervisor with two NICs up on both the VLAN, either of the NICs will be working not both. The ideal setup should be as below:

1. Create two bridge interfaces on the active physical interfaces in "/etc/network/interfaces" file

auto lo
iface lo inet loopback

auto br0
 iface br1 inet static
 address 192.168.75.2
 netmask 255.255.255.0
 network 192.168.75.1
 bridge_ports eth0
 bridge_stp off
 bridge_fd 0
 bridge_maxwait 0
 post-up route add default gw 192.168.75.1 metric 1
 pre-down route del default gw 192.168.75.1

auto br1
 iface br2 inet static
 address 192.168.76.2
 netmask 255.255.255.0
 network 192.168.76.1
 bridge_ports eth1
 bridge_stp off
 bridge_fd 0
 bridge_maxwait 0
 post-up route add default gw 192.168.76.1 metric 2
 pre-down route del default gw 192.168.76.1

2. Restart the Network #/etc/init.d/networking restart
3. There will be rp_filters enabled for the bridge interfaces. Need to disable that. In this case br0 and br1:

As Root
#echo "0" >/proc/sys/net/ipv4/conf/br0/rp_filter
#echo "0" >/proc/sys/net/ipv4/conf/br1/rp_filter
#echo "0" >/proc/sys/net/ipv4/conf/all/rp_filter

This will make sure both the interfaces are active and reachable on the hypervisor.

Make sure the rp_filters are disabled on reboot as well by adding the above commands in some startup files.

You are Done!




Tuesday, October 23, 2012

ssh/su Hung ubuntu

Problem: ssh/su hung on ubuntu:


debug1: Authentications that can continue: publickey,password
debug1: Next authentication method: publickey
debug1: Offering public key: /Users/sajan.tharayil/.ssh/id_rsa
debug1: Server accepts key: pkalg ssh-rsa blen 277
debug1: Authentication succeeded (publickey).
debug1: channel 0: new [client-session]
debug1: Requesting no-more-sessions@openssh.com
debug1: Entering interactive session.

Answer:

This is because of the high CPU utilization of console-kit-daemon on the machine which you are log on to. This is a Bug filed in ubuntu developers forum and fixed in release Jaunty. (Please See Bug). This can be fixed by restarting /etc/init.d/dbus temporarily.

#sudo /etc/init.d/dbus restart

Tuesday, October 16, 2012

Build Debian Packages from source with dh make

I am trying to create a deb package for graphite-web-0.9.9. I followed the steps below:

1. Install dh-make
   apt-get install dh-make
2.  Download graphite-web-0.9.9
   wget http://launchpad.net/graphite/0.9/0.9.9/+download/graphite-web-0.9.9.tar.gz
3. Create the Directory strucure. We have to create the directory as same as the package name with version as in the tar ball. Here "graphite-web-0.9.9.tar.gz" tar ball name and the directory will be "graphite-web-0.9.9":
    mkdir graphite-web-0.9.9
4. Run dh_make inside the directory:
   cd graphite-web-0.9.9; dh_make -f ../graphite-web-0.9.9.tar.gz
5. Edit what ever needed in "./debian" directory. Atleast the control file with maintainer and package version
6. Run "dpkg-buildpackage -rfakeroot"  and your package is ready!