Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
[Solved] I can't seem to set the hostname
View unanswered posts
View posts from last 24 hours

 
Reply to topic    Gentoo Forums Forum Index Networking & Security
View previous topic :: View next topic  
Author Message
Galumph
Tux's lil' helper
Tux's lil' helper


Joined: 15 Jul 2010
Posts: 122
Location: Israel

PostPosted: Sat Jul 14, 2012 10:17 pm    Post subject: [Solved] I can't seem to set the hostname Reply with quote

As part of a recent endeavor to fix my old and messy system, I thought I'd tackle a problem that's been bugging me ever since I installed Gentoo, but after a couple of hours of googling I couldn't find an answer. Ever since I installed Gentoo I couldn't get the hostname working right. I've tried setting it under etc and under conf.d but it doesn't seem to work. How do I set it?

Code:
root # cat /etc/hostname
Tux
root # cat /etc/conf.d/hostname
hostname="Tux"
root # /etc/init.d/hostname restart
hostname           | * WARNING: you are stopping a boot service
syslog-ng          | * Stopping syslog-ng ...                                             [ ok ]
hostname           | * Setting hostname to Tux ...                                        [ ok ]
syslog-ng          | * Starting syslog-ng ...                                             [ ok ]
root # hostname -s
hostname: Unknown host


Last edited by Galumph on Sat Jul 14, 2012 10:51 pm; edited 1 time in total
Back to top
View user's profile Send private message
The Doctor
Moderator
Moderator


Joined: 27 Jul 2010
Posts: 2630

PostPosted: Sat Jul 14, 2012 10:42 pm    Post subject: Reply with quote

I think you are confusing two different issues.

I think you want your computer to display a prompt like user@Tux ~$ right?

Then just restart. I don't think your /etc/hostname file does anything, as I don't have one, but if some application installed it, then its probably ok.

Quote:
root # hostname -s
hostname: Unknown host


This is a separate issue that has nothing to do with your hostname file to solve that do this: nano -w /etc/hosts

There should be a line something like this. edit it.

Code:
(This defines the current system)
127.0.0.1     tux.homenetwork tux localhost


for more detail, you can look at chapter 8 of the handbook. Check the section labled Writing Down Network Information
_________________
First things first, but not necessarily in that order.

Apologies if I take a while to respond. I'm currently working on the dematerialization circuit for my blue box.
Back to top
View user's profile Send private message
Galumph
Tux's lil' helper
Tux's lil' helper


Joined: 15 Jul 2010
Posts: 122
Location: Israel

PostPosted: Sat Jul 14, 2012 10:51 pm    Post subject: Reply with quote

The computer does display a user@Tux prompt, I just set it to "user \$". It even sets the $HOSTNAME variable correctly, hostname just doesn't show the host for some reason.

I think I created /etc/hostname at some point after seeing it on old Slackware installation. Setting the hostname in the hosts file does the trick, hostname -s now shows the hostname:

Code:
root # hostname -s
Tux


Thanks
Back to top
View user's profile Send private message
Display posts from previous:   
Reply to topic    Gentoo Forums Forum Index Networking & Security All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum