[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: Persisting a one-off hostname change



On 20120228_081002, Jason Heeris wrote:
> On 28 February 2012 03:28, Paul E Condon <pecondon@mesanetworks.net> wrote:
> > I've been lurking, hoping to learn. Maybe I don't fully understand, but ---
> > Wouldn't you be better off using the MAC address of the interface chip in each computer
> > rather than a random number. The MAC address is supposed to be unique. I know it can be
> > changed in software, but the value stored in ROM should be adequate for your purpose.
> 
> I like that idea! This means it would also be invariant over any
> subsequent re-images.
> 
> I'd still want to have the prefix on the hostname, otherwise it'll
> make life difficult for production staff. But it's still a pattern
> that can be checked.

Well yes. A fixed pattern, prefix or a suffix that can be grepped to
identify these hosts as the special ones for which this special
treatment is being done. I'm not aware of a way to discover the
hardware MAC address, except by running ifconfig. That may not be
available until the boot has already gotten past the point at which an
IP address has been assigned by DHCP, or whatever. I'm suggesting an
idea, not a well worked out implementation.

For me, a big problem with random numbers is that they are all
different most of the time, but not always, and I don't see a way for
the system to fail gracefully when bad luck gives the same random
value on two different executions, just once in the whole time this
system is in operation.

> 
> > And keep in mind that you might want to do the change as a two step process. First do
> > edits that get the computer bootable with a strictly temporary hostname, then when
> > booting with that temporary name, edit and reboot with a more permanent and convenient
> > name for the follow-on use/processing of the individual computer.
> 
> I don't think a two step process is necessary. If a script can check
> check whether the hostname is what it should be... well, why make it
> require manual intervention?

I didn't intend that the two steps be separated by some manual
process. I worry that when you start implementing the system you might
find that the total fix cannot actually be done at one point during
the boot process. If this is so, you can think about writing an
intermediate, bootable, file to disk, with an intermediate name or
some other flag that signals that the second part of the work still
needs to be done, and then reboot and part of the script. I'm worried
that this may have some gotchas that you don't yet know about.

> 
> — Jason
> 

Cheers,
-- 
Paul E Condon           
pecondon@mesanetworks.net


Reply to: