Problems changing hostname


Forum: Networking
Topic: Problems changing hostname
started by: csaunier

Posted by csaunier on June 06 2008,02:26
I'm not having any luck changing my hostname.  I've read all of the posts I can find on this subject, read the wiki and changed every "box" I can find to "my new name".  Now my computer seems to be called (none) and while booting I noticed a line that said
"sudo unable to lookup (none) via gethostbyname"
(without the quotes).  I'm running a frugal install.
What have I done?

Posted by lucky13 on June 06 2008,02:41
What exactly did you do? If you're using frugal grub, just edit your bootcodes so it includes "host=hostname" (whatever hostname you want).

Edit: Look at the wiki page on cheat codes/boot codes. That's also one of the options in F2/F3 when you boot from the CD, fwiw.

Posted by chaostic on June 06 2008,03:34
Quote (csaunier @ June 05 2008,22:26)
I'm not having any luck changing my hostname.  I've read all of the posts I can find on this subject, read the wiki and changed every "box" I can find to "my new name".  Now my computer seems to be called (none) and while booting I noticed a line that said
"sudo unable to lookup (none) via gethostbyname"
(without the quotes).  I'm running a frugal install.
What have I done?

I'm assuming that this is a HD install, or remaster, because the hostname would be set before any dsl-restore things will happen. I will go back to my hd install and check all the places I made the changes. The most obvious ones are using the hostname command, setting the HOSTNAME variable, and the one to fix your SUDO problem, add your hostname to /etc/hosts, on the 127.0.0.1 line:
127.0.0.1     *hostname* localhost
Currently it would be:
127.0.0.1     (none) localhost

The default, without a hostname= bootcode would be
127.0.0.1     box localhost

Mine, on my thinclient, is
127.0.0.1     thinclient box localhost
just incase I forget to set the hostname bootcode, then manually change the hostname, so sudo won't give any errors.

Edit: Didn't see that you were running frugal. Bootcode is best bet, followed by adding the various commands to bootlocal.sh. Even then, your router might latch on to the default "box" hostname before the commands run, so bootcode "hostname="

Posted by lucky13 on June 06 2008,08:25
To follow up on chaostic in case this IS a remaster (or HD install even though you wrote frugal), the three files to edit with the hostname are:
/etc/hostname
/etc/hosts
/etc/init.d/knoppix-autoconfig

The first is straightforward since it's only the hostname and nothing else. The second is like chaostic wrote where your hostname is between 127.0.0.1 and localhost. Line 328 of knoppix-autoconfig has hostname. (Edit: if you're not using an editor with line numbering, use whatever search tool it has to find "hostname." That line should be "hostname whateveryouwant" and all three of the lines need to match caps/lower case.)

If you screwed up a remaster or something, you can update your frugal install or replace /KNOPPIX and you should be back to square one as "box" and then you can use the cheatcode, which is a heck of a lot easier than remastering to change one word in three files.

If you're using grub you can edit your menu.lst or hit "e" on the line you use to boot DSL, hit "e" again on the line that has all the cheatcodes (vga, pcmcia, frugal, etc.) and add "host=whateveryouwant" to it.

Posted by csaunier on June 09 2008,01:39
Thanks for all of your replies.  These are all things I have done and I've gone back to double check the files to make sure I did it right.
I think it's time to start over.

Powered by Ikonboard 3.1.2a
Ikonboard © 2001 Jarvis Entertainment Group, Inc.