Installing rlwrap on Linux saves you time

Small Blog entry to spread the word. I hate having to manage a Linux system without this 😉 

rlwrap is an utility that allows you to use up and down arrows in the various commands like sqlplus, rman, adrci, … 
To enable it, you only have to do the following : 

  • Install readline-devel

    (root) # yum install readline-devel

  • Download latest rlwrap from http://utopia.knoware.nl/~hlub/uck/rlwrap/ and unzip it somewhere and Compile it.

    (root) # ./configure
    (root) # make
    (root) # make install

  • For OL6 you can use this RPM instead of manually making it:
         http://rpm.pbone.net/index.php3/stat/4/idpl/15282330/dir/redhat_el_6/com/rlwrap-0.37-1.el6.i686.rpm.html

    Then install it with :

    (root) # yum install rlwrap-0.37-1.el6.i686.rpm

  • Configure aliases in .bash_profile so that rlwrap gets enabled when you start the command

    alias sqlplus=”rlwrap sqlplus”
    alias dgmgrl=”rlwrap dgmgrl”
    alias rman=”rlwrap rman”
    alias lsnrctl=”rlwrap lsnrctl”
    alias asmcmd=”rlwrap asmcmd”
    alias adrci=”rlwrap adrci”
    alias impdp=”rlwrap impdp”
    alias expdp=”rlwrap expdp”

You’ll never go back again 😉

Tips and Tricks for OVM – 2. Fakeuuid it

part 2 in the “Tipd and Tricks for OVM” series. Part 1 is here

The UUID

Every OVM Server receives an unique ID when the agent starts. Without this ID, a server can’t join a cluster and the manager can’t dispatch commands to the agent. But how does this ID get set?

Well if you look into the OVM source RPM’s for the ovs-agent-3.1.1-89.src, you’ll see in the file linux_xen/Extensions/discover.c file the following :

/* agent_unique_id – report a unique 16 byte identifier for this node
*
* Generates a 16 byte response string containing a unique 16 byte
* identifier for this node. Uses the SMBIOS UUID if it appears to be valid.
* Otherwise generate a fallback value based on ethernet MAC addresses.
* Returns non-zero status if no id can be constructed.

And a bit further

/* generate_fallback_unique_id – create a unique ID without using SMBIOS UUID
…
// Try using a sequence of ethernet MAC addresses as the unique ID.
// MAC’s are not good because the NIC could be replaced, or worse
// moved between systems. Using multiple MACs will catch a few
// more cases (unless it’s a multiport NIC, sigh).

So We can conclude that the agent will :

  • Ask SMBIOS for an id and if it’s valid use it. If not valid or no ID then
  • Get the MAC address of physical eth devices on the system and concatenate in an UUID

This poses a great risk because if for some reason you change the motherboard ( other SMBIOS ) or 1 of the network devices on the system ( other MAC ), you’ll have a new UUID.

How to detect a changed UUID?

The following points to a changed uuid :

  • Unable to join cluster after reboot
  • “Unable to send notification” messages on the console
  • The OVM Manager fails to rediscover the server after reboot ( tries 5 times and gives up )
  • The OVM Server in OVM Manager will become in ERROR state with an error that looks like : “The server has changed IP or is unreachable”

Fakeuuid it !

In order to solve this issue, the agent has a ini parameter you can set to ensure the same UUID all the time. You can find it in the file /etc/ovs-agent/agent.ini. Get the server uuid from OVM Manager and set it in this parameter.

[server]
fakeuuid=34:45:4c:4c:5a:00:10:20:80:59:b5:c0:4a:42:35:45

I personally set this on every OVM install i’m doing to ensure there are no issues with this ID changing.