problem with hostname

pkaplan1 at comcast.net pkaplan1 at comcast.net
Thu Jul 9 11:50:02 UTC 2009


----- Original Message ----- 
From: "NoOp" <glgxg at sbcglobal.net> 
To: ubuntu-users at lists.ubuntu.com 
Sent: Wednesday, July 8, 2009 2:04:45 PM GMT -05:00 US/Canada Eastern 
Subject: Re: problem with hostname 

>On 07/06/2009 07:51 PM, pkaplan1 at comcast.net wrote: 
>> When I first set up my box the system prompt read: 
>> 
>> <username>@<hostname>:$ 
>> 
>> Recently it changed to : 
>> 
>> <username>@(none):$ 
>> 
>> When I need to invoke sudo I get: 
>> 
>> <username>@(none):~$ sudo <command> 
>> sudo: unable to resolve host 
>> sudo: unable to resolve host 
>> sudo: unable to resolve host 
>> sudo: unable to resolve host 
>> [sudo] password for <username>: 
>> 
>> I can set the hostname with: 
>> 
>> sudo hostname <hostname> 
>> 
>> but the new hostname is not retained after reboot. 
> 
>It won't, see 'man hostname' 
><quote> 
>SET NAME 
> When called with one argument or with the --file option, the 
>commands set the host name or the NIS/YP domain name. Note that this is 
>effective only until the next reboot. Edit /etc/hostname for 
>permanent change. 
>Note, that only the super-user can change the names. 
></quote> 
> 
>> 
>> Shouldn't the following define my hostname? 
>> 
>> <username>@(none):~$ cat /etc/hosts 
>> 127.0.0.1 localhost 
>> 127.0.1.1 <hostname> 
>... 
>> <username>@(none):~$ cat /etc/hostname 
>> <hostname> 
> 
>The last should (/etc/hostname). If you look at 'cat 
>/etc/rcS.d/S02hostname.sh/ or 'cat /etc/init.d/hostname.sh' you will see 
>that it reads /etc/hostname for a value & if it does not find one it 
>will resort to localhost. 
> 
>I tested by duplicating your /etc/hosts and then blanked out 
>/etc/hostname (removed my hostname from the file). Rebooted and now my 
>system shows as yours: 
> 
><username>@(none):~$ 
> 
>Changed it back & rebooted & now I'm showing: 
> 
><username>@<hostname>:~$ 
> 
>> 
>> How can I restore <hostname> permanently? 

>As Fred pointed out: 
>$ gksu gedit /etc/hostname 
>add the host name you wish in the file. Note: only the hostname, nothing 
>else. Reboot and check 'cat /etc/hostname' again before doing anything. 
> 
>If /etc/hostname is blank, then perhaps your network manager is making 
>the change? 
> 
>What version/flavour of Ubuntu are you using? What permissions are set 
>for /etc/hostname? 
>$ ls -l /etc/hostname 
>-rw-r--r-- 1 root root 6 2008-07-12 13:56 /etc/hostname 
>Also check your user privileges (System|Administration|<username>|User 
>Privileges - see if 'Administer the system' is checked. 
> 

NoOp , 
Thanks for the explanation and effort. 
Although I'm no expert, /etc/rcS.d/S02hostname.sh/ and 'cat /etc/init.d/hostname.sh' appear to point to /etc/hostname and I did not knowingly modify these. 
Currently my /etc/hostname file has a single line containing my intended hostname. 
The file permissions are as you indicate above. 
I do have administration privileges for the system. 

So, still, I'm stumped. My hostname is not being read following reboot, so I have to manually define it after each boot. 

Paul 
-- 
ubuntu-users mailing list 
ubuntu-users at lists.ubuntu.com 
Modify settings or unsubscribe at: https://lists.ubuntu.com/mailman/listinfo/ubuntu-users 
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.ubuntu.com/archives/ubuntu-users/attachments/20090709/d75edb35/attachment.html>


More information about the ubuntu-users mailing list