no hostname: problem and fix

Greg T Hill greghill at
Mon Jun 5 23:32:41 PDT 2000

I don't know if any one else has had this problem,  but  my hostname was
coming up blank or none on anything that referred to the $HOSTNAME
variable.  Re-running the localnet script did not produce any errors, but
still I had no hostname!  I finally ran /bin/hostname -v --file
/etc/hostname to see what was happenning.  First it set hostname to the
name in /etc/hostname, then set it again to '', and again to ''.  WTF?
Aparrently  /bin/hostname reads each line in the file you feed it and
resets the hostname at each line.  I don't recall if I was using vim or
kedit when I originally created the /etc/hostname file but I guess I had
some newlines after the hostname.  I couldn't seem to fix it with vim, so
I removed the file and did echo XXX>/etc/hostname.  I  re-ran the
localnet script and now when I echo $HOSTNAME I get my hostname back
instead of a blank.  To see if you have the same problem, just do echo
$HOSTNAME. If it doesn't come back with your hostname,  you got it too.
Duh am I the only one?

Mail archive:
IRC access: server: port: 6667 channel: #LFS
News Reader access:
Unsubscribe: email lfs-discuss-request at and put
"unsubscribe" (without the quotation marks) in the body of the message
(no subject is required)

More information about the lfs-dev mailing list