Ask Ubuntu is a question and answer site for Ubuntu users and developers. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

What exactly is the hostid? Is it equivalent to the Hwaddr / MAC address or is it a unique identifier that is derived from the Hwaddr addresses?

I am trying to activate the Maple mathematical software but it gives me an error stating that the software was unable to determine the hostid. I have followed all the instructions listed in the following help page from Maplesoft but with no luck so far.

When I enter hostid into Teminal it outputs “007f0101” which is probably incorrect. I read that a hostid is supposed to produce a unique identifier for each unix like machine but I have tried hostid on two different Ubuntu 12.04 installations and they both return the same “007f0101” sequence. Something is amiss I would reckon unless I have misunderstood what a hostid is.

Oh, this Ubuntu installation was done with the WUBI installer so it is technically on a virtual disc which resides in the Windows partition from what I gather. I have a feeling that may be a problem but that doesn' change the fact that the hostid was the same on two different computers, one of which was a standard installation.

Does anyone have any idea what the issue might be with regards to the hostid?


share|improve this question

hostid is your IP address in hex, byteswapped.

For example:

01234567 ->

Or in your case:

007f0101 -> 7f.00.01.01  =

Which is found in /etc/hosts. That's normal if your machine was installed using a DHCP assigned address.

A quick hack is to vi /etc/hosts and put in your IP address instead of But that is a hack... if your IP address changes at the next boot, your hostid will no longer match your IP.

The bottom line is that hostid sucks.


I wrote my own hostid script in perl/shell and put it in path first:

#!/usr/bin/perl -w
printf("%02x%02x%02x%02x\n",(split /\./,`ip addr list|grep " inet "|grep -v " 127.0"|head -1|cut -f1 -d/|rev|cut -f1 -d" "|rev`)[1,0,3,2]);

Notably, it doesn't fall back to using loopback if there are no other interfaces.

share|improve this answer

I have three physical machines all three 12.04 (2 desktop, 1 server), all three AMD64, all three with the same hostid "007f0101".

It seems in the glibc implementation of gethostid (see man gethostid), the hostid is stored in the file /etc/hostid, which is by default absent in 12.04. If this file is non-existent, it then uses the localhost ipv4 address to generate the hostid. If you use DHCP, in the hosts file, localhost is mapped to on all machines, resulting in non-unique hostid's.

You could create the /etc/hostid file with random content to get a unique hostid.

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.