care area web page logo

Licensing Problem with LMHOSTID

CAW/SRAM Finder is licensed using Flexera's FLEXLM licensing technology. Our standard practice is to use node locked licensing on the machine executing CAW. The "node" is based on the machine's hostid as returned by the lmhostid utility.

Getting the Machine's Hostid

Do not rely on the system command, "hostid". This will not return the value expected by the flexlm licensing module.

Example

On my Ubuntu Linux installation I run the system command, hostid.

stevedb@asmsc45:/home/cad/caw3631/tools$ hostid
a8c09100

However if I go into the /tools/flexlm/linux64 directory (from the CAW install root) and run lmhostid I get a different value.

stevedb@asmsc45:/home/cad/caw3631/tools/flexlm/linux64$ ./lmhostid

lmhostid - Copyright (c) 1989-2006 Macrovision Corporation. All Rights Reserved.
The FLEXlm host ID of this machine is "1c6f6593b8d6"

You can see that the two values are not the same. If you provide us the value returned by the OS command "hostid" the license codes will not be valid.

Summary

Use lmhostid to obtain the machine's hostid for purposes of licesning CAW/SRAM Finder.


What if LMHOSTID Fails?

It has been reported in the field that sometimes the LMHOSTID utility fails to return a value for hostid. Why?

LMHOSTID gets the hostid (which is used to compute the license strings) based on the MAC address (hardware address) of an ethernet interface. Machines can have multiple ethernet interfaces and they are normally labeled eth0, eth1, eth2 and so on. If a machine only has a single ethernet interface then the hardware is normally assigned to eth0 and everything works as expected:

If I use the command /sbin/ifconfig I can see how the ethernet interface is configured:

stevedb@asmsc45:/home/cad/caw3631/$ /sbin/ifconfig [enter]

eth0      Link encap:Ethernet  HWaddr 1c:6f:65:93:b8:d6  
          inet addr:192.168.0.145  Bcast:192.168.0.255  Mask:255.255.255.0

Notice that

    a) the hardware is linked to eth0

    and

    b) the HWAddr corresponds exactly the hostid returned by LMHOSTID

The Problem

The problem seems to arise when a machine does not use eth0 as the default interface for the network card (or one of the installed network cards.) Instead is uses a different eth or worse, each time it boots it assigns the network card to a different eth.


Assigning the Network Card to the ETH0

The assignment of network card hardware to an eth is done via a file. This file is located in the directory:

/etc/udev/rules.d

The name of the file may vary from flavor to flavor of linux; However the file we are interested in will be the one with the name persistent-net or net-persistent in it. On my Ubuntu system there are two files in this directory:

stevedb@asmsc45:/etc/udev/rules.d$ ls -l

-rw-r--r-- 1 root root  848 2010-12-14 07:22 70-persistent-cd.rules
-rw-r--r-- 1 root root  411 2010-12-14 07:02 70-persistent-net.rules
-rw-r--r-- 1 root root 1157 2010-09-24 05:27 README

If I open the file named 70-persistent-net.rules and examine it I see: (the line has been broken up for clarity)

SUBSYSTEM=="net", 
ACTION=="add", 
DRIVERS=="?*", 
ATTR{address}=="1c:6f:65:93:b8:d6", 
ATTR{dev_id}=="0x0", 
ATTR{type}=="1", 
KERNEL=="eth*", 
NAME="eth0"

You can see that this line assigns the address "1c:6f:65:93:b8:d6" to eth0. Therefore when we run lmhostid and it accesses eth0 it returns 1c:6f:65:93:b8:d6.



Editing the Persistent-Net Rules File

To verify that the rules file controls assignment of the eth to the hardware I edited the file as follows:
SUBSYSTEM=="net", 
ACTION=="add", 
DRIVERS=="?*", 
ATTR{address}=="1c:6f:65:93:b8:d6", 
ATTR{dev_id}=="0x0", 
ATTR{type}=="1", 
KERNEL=="eth*", 
NAME="eth5"   <--- changed eth0 to eth5

I then shut down the workstation and restarted it (Note: just using the restart option in Ubuntu did not seem to update the assignment from eth0 to eth5. However after completely shutting down and restarting the new assignment was in place.

Running /sbin/ifconfig now reports:

stevedb@asmsc45:~$ /sbin/ifconfig

eth5      Link encap:Ethernet  HWaddr 1c:6f:65:93:b8:d6  
          inet addr:192.168.0.145  Bcast:192.168.0.255  Mask:255.255.255.0

and now that I run LMHOSTID I get the null value I expected since eth0 is no longer assigned ...

stevedb@asmsc45:/home/cad/caw3631/tools/flexlm/linux64$ ./lmhostid [enter]

lmhostid - Copyright (c) 1989-2006 Macrovision Corporation. All Rights Reserved.
The FLEXlm host ID of this machine is ""

By editing the 70-persistent-net.rules file and setting the eth assignment back to eth0, rebooting the workstation and running ifconfig and lmhostid I am back to "normal."