LinuxQuestions.org
Review your favorite Linux distribution.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Software
User Name
Password
Linux - Software This forum is for Software issues.
Having a problem installing a new program? Want to know which application is best for the job? Post your question in this forum.

Notices

Reply
 
Search this Thread
Old 09-02-2006, 05:20 PM   #1
fakie_flip
Senior Member
 
Registered: Feb 2005
Location: san antonio, texas
Distribution: Fedora 64 bit RAID0 + LUKS, CentOS (server), Backtrack, Gentoo Hardened
Posts: 1,441

Rep: Reputation: 80
unable to lookup my hostname via gethostbyname() function


I tried changing my hostname in /etc/hosts before changing it in
/etc/hostname. Now what can I do? I am going to go into single user mode from
grub and boot from a live cd to restore the backup file
/etc/hosts_backup. Is there any way to fix this problem without rebooting? I shouldn't
have to reboot to fix a problem because I am not using windows.
Code:
chris@chris-desktop:~$ sudo vim /etc/hosts
sudo: unable to lookup chris-desktop via gethostbyname()
chris@chris-desktop:~$ sudo vim /etc/host
host.conf     hosts         hosts_backup
hostname      hosts.allow   hosts.deny
chris@chris-desktop:~$ sudo vim /etc/hostname
sudo: unable to lookup chris-desktop via gethostbyname()
chris@chris-desktop:~$ gksu gedit /etc/hostname
sudo: unable to lookup chris-desktop via gethostbyname()

chris@chris-desktop:~$ sudo cp /etc/hosts_backup hosts
sudo: unable to lookup chris-desktop via gethostbyname()
chris@chris-desktop:~$ cat /etc/hosts
127.0.0.1 localhost ubuntu
127.0.1.1 ubuntu

# The following lines are desirable for IPv6 capable hosts
::1 ip6-localhost ip6-loopback
fe00::0 ip6-localnet
ff00::0 ip6-mcastprefix
ff02::1 ip6-allnodes
ff02::2 ip6-allrouters
ff02::3 ip6-allhosts

# websites to be blocked
127.0.0.1 www.google.com

chris@chris-desktop:~$
 
Old 09-02-2006, 06:11 PM   #2
billymayday
Guru
 
Registered: Mar 2006
Location: Sydney, Australia
Distribution: Fedora, CentOS, OpenSuse, Slack, Gentoo, Debian, Arch, PCBSD
Posts: 6,678

Rep: Reputation: 122Reputation: 122
I'd suggest tha tthe hostname may not be set in /etc/hostname. For example, in FC5 it is set in /etc/sysconfig/network.

Have you tried setting it with the hostname command?
 
Old 09-02-2006, 07:31 PM   #3
fakie_flip
Senior Member
 
Registered: Feb 2005
Location: san antonio, texas
Distribution: Fedora 64 bit RAID0 + LUKS, CentOS (server), Backtrack, Gentoo Hardened
Posts: 1,441

Original Poster
Rep: Reputation: 80
I just tried changing my hostname with the hostname command. Hopefully I did it right.

Code:
ubuntu@ubuntu:~/Desktop$ sudo hostname -v chris
After that, I cannot open programs however I can open up another gnome terminal window by pushing control shift n when the terminal window that I had opened is focused.
 
Old 09-02-2006, 07:33 PM   #4
fakie_flip
Senior Member
 
Registered: Feb 2005
Location: san antonio, texas
Distribution: Fedora 64 bit RAID0 + LUKS, CentOS (server), Backtrack, Gentoo Hardened
Posts: 1,441

Original Poster
Rep: Reputation: 80
The new terminal window shows my new hostname, but why can't I open up programs anymore? Now I am getting this error after using the hostname command.

Code:
ubuntu@chris:~/Desktop$ gedit
Xlib: connection to ":0.0" refused by server
Xlib: No protocol specified

cannot open display: (null)
Run 'gedit --help' to see a full list of available command line options.
ubuntu@chris:~/Desktop$ xclock
Xlib: connection to ":0.0" refused by server
Xlib: No protocol specified

Error: Can't open display: :0.0
ubuntu@chris:~/Desktop$
 
Old 09-03-2006, 03:52 AM   #5
tredegar
LQ 5k Club
 
Registered: May 2003
Location: London, UK
Distribution: Debian "Jessie"
Posts: 6,012

Rep: Reputation: 367Reputation: 367Reputation: 367Reputation: 367
Well, your Xserver is tied to your hostname.
So if you change your hostname, you'll loose your connection.
Solution: Restart the Xserver, or reboot.
HTH
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Adding hostname and IP address to DNS for sendmail ip lookup Simon_T Linux - Networking 1 06-04-2006 07:30 AM
Apache log hostname lookup program ? Carlee Linux - Software 1 01-29-2005 05:40 PM
High CPU on gethostbyname() function aravindtj Programming 0 01-17-2005 11:17 PM
Odd hostname lookup problem max_sipos Linux - Networking 3 11-15-2004 11:29 AM
sudo: unable to lookup via gethostbyname() rickenbacherus Linux - General 2 12-07-2003 03:09 PM


All times are GMT -5. The time now is 12:04 AM.

Main Menu
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration