HOSTNAME variable

Hiro Protagonist spam at swisscoast.ch
Mon Jun 18 14:11:02 CEST 2012


thanks for all your tips!

i removed the /etc/hostname file on the nfsroot and got everything 
working again!

i have no idea where the file /etc/hostname (and the "fai-live-host" 
hostname) came from...

thanks again!


On 06/18/2012 01:56 PM, Thomas Neumann wrote:
>>> Find the row and add HOSTNAME=$host:
>>> $append="append $initrd $bootprot $rootfs HOSTNAME=$host $opt_k $flags
>>> $action\n";
>
>> What does the nfsroot's `hostname` command report as the current hostname?
>
>> Is it the same as the content of HOSTNAME or is it the original/unmodified
>> host's name?
>
> I just had a look at the relevant documentation / code for Debian.
>
> $ man hostname
> [...]
> The host name is usually set once at system startup in
> /etc/init.d/hostname.sh (normally by reading the contents of a file which
> contains the
> host name, e.g.  /etc/hostname).
> [...]
>
> $ cat /etc/init.d/hostname.sh
> [...]
> do_start () {
> 	[ -f /etc/hostname ]&&  HOSTNAME="$(cat /etc/hostname)"
>
> 	# Keep current name if /etc/hostname is missing.
> 	[ -z "$HOSTNAME" ]&&  HOSTNAME="$(hostname)"
>
> 	# And set it to 'localhost' if no setting was found
> 	[ -z "$HOSTNAME" ]&&  HOSTNAME=localhost
>
> 	[ "$VERBOSE" != no ]&&  log_action_begin_msg "Setting hostname to
> '$HOSTNAME'"
> 	hostname "$HOSTNAME"
> 	ES=$?
> 	[ "$VERBOSE" != no ]&&  log_action_end_msg $ES
> 	exit $ES
> }
> [...]
>
> So...
>
> If there is a /etc/hostname the hostname will be set to its content.
>
> If there is NO $HOSTNAME then the host's name will be set to whatever
> `hostname` reports. (Most probably the value provided by DHCP.)
>
> If HOSTNAME still does not contain anything, set it to 'localhost'.
>
> undocumented/implicit cases:
>
> If there is NO /etc/hostname AND $HOSTNAME contains something then the
> host's name will be set to $HOSTNAME.
>
> If there is a /etc/hostname AND $HOSTNAME contains something then
> $HOSTNAME is ignored and /etc/hostname's content will be used.
>
>
>
> [Maybe there's a modified /etc/init.d/hostname.sh / /etc/hostname in
> Hiro's initrd, which sets the hostname to fai-live-host?]
>



More information about the linux-fai mailing list