Modify the Hostid in a Solaris 11 Global Zone running on VMWare

Hi Folks,

I've been presented with an unexpected problem and I'm not sure if I can resolve it without some input from people.

I have on this site 3 license servers running Solaris, one at;

SunOS xxxxxx 5.8 Generic_117350-08 sun4u sparc SUNW,Ultra-5_10

One at;

SunOS yyyyyy 5.7 Generic_106541-05 sun4u sparc SUNW,Ultra-5_10

And one at;

SunOS zzzzzz 5.6 Generic_105181-21 sun4u sparc SUNW,Ultra-250

As any of you will see they have been around a while, in reality these machines only run

lmgrd

and Netscape Server 4.0 - I can hear you all laughing now. But I'm going to continue, it is Easter Sunday after all.

My original thoughts were that I'd create a Solaris 10 or 11 virtual machine on VMWare and then run the three licence servers as zones, as I could have explicitly set the hostid within the zone. However my trusted leaders have expressly prohibited "virtuals within virtuals", I have done some prliminary testing and that seems to work OK - the setting the hostid bit.

These licenses were "Perpetual Licences", costing $100K per seat - however it would seem that the perpetual refered the life of the original company granting them not the user! So it is not possible to have the licence files regenerated for some of the applications hence the issue. Add to that that this cheapskate outfit doesn't have support with any of our vendors, some of you I'm sure will understand.

I have tried the instructions here but to no avail, although it does change the hostid - the hostid command sees an invalid id as it would appear that the code in the example only works for a hostid starting with zero.

So these are hopefully going to be moved to virtual machines like this, I think that I have all the x86 binaries required.

SunOS aaaaaa 5.11 11.1 i86pc i386 i86pc

I've not really had a problem like this before, especially with the intransigent management refusing to take the advice offered.

Anyone have any ideas - other than find an other employer:mad:

MTIA Gull04

I've read your post a few times but still don't quite understand what you are trying to achieve. You have 3 SPARCs but also mention x86 platforms???

You want to change the hostid on a Solaris base (global) zone on what?

If you're moving from SPARC to x86, do you have the 'lmgrd' x86 binary?

Did you try specifying hostid in the zonecfg prompt?

set hostid=<your host id>

Hi Folks,

Sorry for any confusion on this one, just to clarify a bit here is some more information.

@hicksd8

The current systems are Sparc systems, they are being virtualised on an x86 platform. So yes I need to change the hostid in the Global to be what it was on the original server.

I do have the x86 binaries, however many of the licences require a specific hostid.

The original intention was to virtualise these systems in zones, which would work just fine - however as the global will be a virtual running under VMWare this approach has been expressly forbiden.

@bartus11,

That is the approach I had originally intended, just use the "set hostid=XXXXXXXX" in zonecfg. But I'm not being allowed to do that, as the use of "virtualisation within virtualisation" is out!

Regards

Gull04

Right, I understand the situation. I have had many a confrontation with lmgrd, etc.

I published the code for changing the hostid on Solaris 10 x86 on this forum sometime ago:

The problem is that (1) I have never tested this code on Solaris 11, and (2) I have never been able to get a licence file from SPARC platform to work on a x86 platform; I've always assumed that they must be cut differently.

Therefore no stock answer I'm afraid but perhaps some information to allow you to research further. It would help us if you determine answers to (1) or (2) above so please do post back your progress.

1 Like

Hi Folks,

Just a quick update - here is the code that I ended up with - it does work on Solaris 11.1 I have hard coded the hostid I wanted "80b6400d" into the script - I'll post the whole script when I complete it.

ascii=`echo $((0x80b6400d)) | od -t x1 | head -1 | cut -f2-100 -d" "`
echo "hw_serial/v "${ascii:0:$((${#ascii}-2))}"00 0" | mdb -kw
echo "hostid is now set to: "`hostid`;echo " "

Excellent pointer @hicksd8 - Thank you very much.:slight_smile:

gull04

1 Like

@gull04............this is fantastic thanks.......:slight_smile:

I would normally check out the forum profile of the OP but being Easter I couldn't be bothered. I didn't realise you were a major community contributor!!!

It's great when we pro's answer novice's questions and learn from each other, but just giving a pointer to a pro and have him create really useful new knowledge (ie, it works on Solaris 11) is fantastic. Thanks again.

This is why this forum is just the best!

Hi Folks'

Wrote this script earlier and said to hicksd8 that I'd post it here, it's just a quick and dirty hack to change the hostid of a global zone on a Solaris Virtual running under a hypervisor - manes and ID changed to protect the inocent.

#!/usr/bin/bash
################################################################################
#
# Script to change hostid on a Solaris 11.1 virtual machine running in VMWare
# where there is a requirement for the hostid of the GLOBAL zone to be changed.
# If changing the hostid of a non global zone this can be done using the normal
# process for a Solaris Zone.
#
################################################################################
################################################################################
#
# Title         -       Set Hostid
#
# Author        -       Dave Hoojikaflip
# Date          -       19/04/2014
# Version       -       1.00.01
#
################################################################################
# Dependencies.
#
# 1     This script requires standard  Solaris 11.1 install.
#
# 2     This script required the standard logging utility to be in the BINDIR
#
################################################################################
# Deprecated.
#
# 1     No longer requires the hostid to be passed as an argument.
#
################################################################################
#
# History - Please enter changes here - latest at the top.
#
################################################################################
#
# Version 1.00.01
#
# Hostid now embedded in the script, tested on license servers with Solaris 11.1
# and the CAD environment set in anticipation of consolidation excercise.
#
# Version 1.00.00
#
# Created to set hostid manually, will implement as a service with logging when
# time allows. The desired hostid must be passed as an argument, will set a
# default option in a later version of the script.
#
################################################################################

################################################################################
#
# Set Globals here.
#
################################################################################

MAX=0
THISPROG=/usr/local/bin/set_hostid.sh
NAME=`uname -n`
DATE=`date +%m/%d/%y`
export NAME DATE THISPROG MAX

OTYP=`uname`
BINDIR=/usr/local/bin
LIBDIR=/usr/local/lib
TMPDIR=/tmp
MAILFILE=/tmp/hostid_set_ok.txt
export OTYP BINDIR LIBDIR TMPDIR MAILFILE

################################################################################
#
# Set the required hostid below.
#
################################################################################

HOSTID=0x80cfe985

export HOSTID

################################################################################
#
# Setup the logging functions.
#
################################################################################

STARTMSG ()
{
/usr/local/bin/logger.sh "${THISPROG} $* STARTED"
}

MSG ()
{
/usr/local/bin/logger.sh "${THISPROG} $*"
}

JMSG ()
{
echo "${THISPROG} $*"
}

ERR ()
{
/usr/local/bin/logger.sh "${THISPROG} $*"
/usr/local/bin/logger.sh "${THISPROG} FAILS"
exit 1
}

ENDMSG ()
{
/usr/local/bin/logger.sh "${THISPROG} COMPLETED"
exit 0
}
################################################################################
#
# Set the hostid for a Solaris Global in a virtual under VSphere, should work
# for most Hypervisors.
#
################################################################################
################################################################################
#
# Put the start message in the logfile allong with calling script and time stamp.
#
################################################################################

STARTMSG

################################################################################
#
# Print the screen message to advise user of actions.
#
################################################################################

echo "This licence server replaces edinburgh.noobab.com - with a hostid of 80cfe985"
echo ""

################################################################################
#
# Set the hostid here and test results, use standard day log for output.
#
################################################################################
################################################################################
#
# Convert the Hex hostid variable to a sequence of Ascii.
#
################################################################################

ascii=`echo $((${HOSTID})) | od -t x1 | head -1 | cut -f2-100 -d" "`

if [[ $? != "0" ]]
        then
                MSG "Conversion of Hex string to Ascii has failed."
                ERR "Check that the HOSTID variable is formatted as 0xFFFFFFFF."
        else
                MSG "Successful conversion Hex to Ascii."
fi

################################################################################
#
# Open the serial module for writing and insert the new hostid.
#
################################################################################

echo "hw_serial/v "${ascii:0:$((${#ascii}-2))}"00 0" | mdb -kw

if [[ $? != "0" ]]
        then
                MSG "Inserion of hostid in core module has failed."
                ERR "Check that the module debugger is installed."
        else
                MSG "Successful hostid change."
fi

################################################################################
#
# Print the new hostid on the screen and output to logfile.
#
################################################################################

JMSG "hostid is now set to: "`hostid`
MSG "hostid is now set to: "`hostid`
ENDMSG
1 Like

@gull04..........

Once again, thank you for this. Knowing that this technique works on Solaris 11 is new knowledge. I must say for clarity of future reading that this code only applies to Solaris x86. Where did you put this script to execute automatically at boot time?

(If you are in a position to develop and test a Solaris SPARC version then I'll post that code too.)

Hi Hicksd8,

The script is located in /usr/local/bin which is where I tend to put anything that I write to complete an admin function.

At the moment it is a manual job to run the script, however I will probably implement it as a service at some point and I'll put a copy in /etc/init.d just for completeness.

Would quite like to try this with a sparc based M/C and can't actually see why it wouldn't work although it would probably require the adb as against the mdb But right now I have only got access to 2 * Ultra 10's one running 2.6 amd one running 2.7 so not much chance of a proof of concept there.

Obviously it will be the same situation on a sparc and the hostid won't persist across a reboot.

Regards

Dave

Hi gull04,

You're not wrong. On SPARC I use adb to modify the hostid. On both x86 and SPARC I insert lines at the end of /etc/rc2.d/S20sysetup so that they execute every time the machine boots.

Following below is a copy of the S20sysetup file from my SPARC system.

Again, I've not tested this code on Solaris 11 but it works great on Solaris 10.

All this stuff makes a good knowledge base for future readers and also means that you can help out on any hostid and lmgrd questions too. There doesn't seem to be too much knowledge about on this.

Best
hicksd8

---------- Post updated at 07:57 PM ---------- Previous update was at 07:54 PM ----------

Here's my S20sysetup...........(for SPARC)

 
 #!/sbin/sh
#
# Copyright (c) 1984-1998 by Sun Microsystems, Inc.
# All rights reserved.
#
#ident "@(#)sysetup 1.18 98/10/09 SMI"
 if [ -z "$_INIT_PREV_LEVEL" ]; then
 set -- `/usr/bin/who -r`
 _INIT_PREV_LEVEL="$9"
fi
 [ $_INIT_PREV_LEVEL != S -a $_INIT_PREV_LEVEL != 1 ] && exit 0
 # Uncomment this line to print the complete system configuration on startup
#[ -x /usr/sbin/prtconf ] && /usr/sbin/prtconf
 # If there are trademark files, print them.
 [ -d /etc/tm ] && /usr/bin/cat /etc/tm/* 2>/dev/null
 #
# Savecore is enabled by default.
# See dumpadm(1M) on how to customize
# system dump configuration.
#
# **** Additional lines added to this file to set hostid ****
#
# Change Host ID to Hex 807a6e94
# Convert to a decimal value = 2155507348
# Use HEXADECIMAL to BINARY conversion, HEX to Decimal converter, Hexdecimal convertor to do this
#
# Divide into 3 parts: 2155 5073 48
# Hex value of the above ASCII chars
# Use above web site for this too
# 32 31 35 35
# 35 30 37 33
# 34 38
#
# After padding out
# 32313535
# 35303733
# 34380000
#
# o let's set the new hostid
# Comment out the following lines in a virtualised environment
# Container will set the hostid
# hicksd8 14 July 2011
adb -w -k /dev/ksyms /dev/mem /dev/null<<END
hw_serial/W 0x32313535
hw_serial+4/W 0x35303733
hw_serial+8/W 0x34380000
END
# That's it!

 

No wonder license server support people are still asking these types of questions!!! I just dealt with another one (locally).

It seems that people bought extremely expensive perpetual software licenses years ago which are protected by license servers like lmgrd (FlexLM). The hardware it is running on (eg, Sun Ultra1's) are now completely knackered and end-of-life but the original software company has gone bust, been taken over (several times), or the company is trying to sell their new software, and so to get the license file regenerated for a new host is impossible. However, the end user has a legal right to run the software and simply wants to move servers.

The software company simply doesn't understand, or deliberately won't understand the problem.

I hope this thread becomes the definitive place to look for help on this.

Hi,

You and me both, just for completeness - here are the guts of the logger.sh script that all my scripts call to log to a single journal/log file for the day.

# Description.
#
# Callable logging utility allowing all working shell scripts and utilities to
# log to a single log file or journal.
#
# The utility should be called from within the shell scripts that require the
# log function.
#
###############################################################################
#
# History.
#
# Initial Version - 2013/10/03
#
##############################################################################
#
# Check if the calling shell knows about a logfile, if it doesn't create one.
#
##############################################################################
if [ ${LOG} ]
        then
        :
        else
        LOG="/var/log/day_log_`date +%Y``date +%m%d`"
fi
###############################################################################
#
# Set the MSG variable, to log with the calling shell.
#
###############################################################################
MSG="`date '+%d %b %T'`  $*"

###############################################################################
#
# Test if the log is writeable, if not correct it.
#
###############################################################################

if [ -f ${LOG} ]
        then
        :
        else
        touch ${LOG}
        chmod 666 ${LOG}
fi

if echo "`date '+%d %b %T'`  $*"  >> ${LOG}
        then
        :
        else
        ERROR=$?
        echo "LOGGER FAILED TO WRITE TO LOG FILE, error=${ERROR}"
        exit ${ERROR}
fi

This just allows multiple scripts to log as required - all to the same output file - handy for error checking etc.

Regards

Dave