Change Solaris hostid

Hi,

I've searched the UNIX forum looking for a simple procedure how to change\control my Solaris server hostid.

I did found few threads but all of them either have broken links to all kinds of scripts or not described simply for some UNIX beginers user like me.

Can anyone assist me?
I need to change temporarily the hostid of my Solaris somehow to overcome some licenses issue.

# uname -a
SunOS MySun 5.10 Generic_141445-09 i86pc i386 i86pc

Thank you!

this might be helpfull:
Spoofing a hostid on Solaris - Docupedia

Thanks DukeNuke2 but the first option is not reallt working.
As for the second option describde in your link (3ed one is missing) - i can't use gcc on my server.

When i'm trying to run the gcc command it's says:
gcc: command not found.

Any other ideas ?

install gcc...

sorry but i'm still new with this solaris issues...
What is gcc? how can i install it?
Will this work ?

gcc is usually installed on Solaris 10. It's not just in the default PATH.

the first link for "solaris gcc" on google was this:
Hint: How to install gcc on Solaris (easiest way possible - I think)

Now it's says :

./gcc: Invalid argument

I'm trying to run it from /usr/local/bin where i can find the gcc command.

Any other ideas ?

Please assist.
Thanks !

Not sure where "Invalid argument" would come from, but...

# /usr/sfw/bin/gcc
gcc: no input files

Like you, I have:

# uname -a
SunOS sol10 5.10 Generic_141445-09 i86pc i386 i86pc

An 11 years old link is not the best advice.

provide a better link... this was the first which popped up in google and it wasn't reviewed.
criticize other people without better advice isn't helpfull at all...

1 Like

I've managed (i think) to install the gcc.
Now i'm trying to complie this piece of code (which were found in several forums for changing the host id):

#include <stdio.h>
#include <unistd.h>
int main(int argc, char *argv[])
{
if(argc < 2)
{
fprintf(stderr,"Single argument: Target hostid\n",argv[0]);
return 1;
}
sethostid(
strtoul(argv[1],NULL,16) );
return 0;
}

but now i'm getting this kind of an error:

# gcc change_hostid.c -o change_hostid
Undefined first referenced
symbol in file
sethostid /var/tmp//ccEX9dSj.o
ld: fatal: Symbol referencing errors. No output written to change_hostid
collect2: ld returned 1 exit status

As i mentioned i've quite new with the Solaris and really i'm not a code guy.
Any idea what can be the problem for this simple code not to compile ?

BTW, i've managed to compile this short code successfully on a RedHat Linux server.

Please kindly advise.

Agreed, sorry for the unhelpful/rude comment. I guess I was in bad mood been stuck by snow ...

Anyway, gcc is part of the default Solaris installation if you select one of these software groups: Developer, Entire, Entire plus OEM. These choices are certainly the most frequent ones, compared to End User, Core or Core with reduced network. The fact is a large majority of people complaining about a missing gcc on Solaris 10 are just missing to add /usr/sfw/bin to their PATH.

And to sethostid:

The Open Group Base Specifications Issue 7

sethostid - Linux Command - Unix Command

As i mentioned previously - UNIX code is not my area.

Scott - the links you have posted seems to be relevant but i really don't know what should i do...

Can you please elaborate ?

Maybe in the end i'll succeed to change my hostid - Thank !

As you aren't familiar with this stuff, why not asking the licensed software vendor to provide a solution ?

I'm trying currently to avoid it since this is only a temporarely solution.

Can someone please reply to my question ?
(I could also not use Solaris and then i had no problem - No ? :slight_smile: )

There are several ways to workaround applications locked to a specific hostid. Not every solution works with each of them. What application are you using ? Why do you want to install it on another machine ?

We're working with a dedicated vendor which created a special application for us so i can't really expose the name of the application nor it will be familiar for anyone.
I need to install it on another machine since we need to test in on another environment while the real server is currently unavailable.

Can you specify the several ways of the workaround you are mentioning?
I didn't manage to find even one (at least working).

As I already wrote, you should try to fix the issue with the software vendor. Either he agrees to send you a temporary license for testing or he doesn't and you are asking how to crack a software protection.

1 Like