Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

I'm using Ubuntu 10.04 LTS, and when I type the command hostname --fqdn, I get the message: hostname: Name or service not known.

Because of this, I cannot install global successfully, and get the following error when I try:

Setting up global (5.7.1-1) ...
hostname: Name or service not known
dpkg: error processing global (--configure):
 subprocess installed post-installation script returned error exit status 1
Errors were encountered while processing:
 global
E: Sub-process /usr/bin/dpkg returned an error code (1)

My /etc/nsswitch.conf is below.

# /etc/nsswitch.conf
#
# Example configuration of GNU Name Service Switch functionality.
# If you have the `glibc-doc-reference' and `info' packages installed, try:
# `info libc "Name Service Switch"' for information about this file.

passwd:         compat
group:          compat
shadow:         compat

hosts:          files dns
networks:       files

protocols:      db files
services:       db files
ethers:         db files
rpc:            db files

netgroup:       nis

Does anyone have any ideas on what this means and how I can fix this?

share|improve this question
1  
Why do you want a FQDN? If you have to ask, you probably don't want one or can't make use of one or both. –  msw Jul 8 '10 at 0:00

2 Answers 2

up vote 10 down vote accepted

Can you provide the content of /etc/nsswitch.conf ?

It looks like /etc/nsswitch.conf has a bad value for the "hosts" line. Does it start with "files" ?

Otherwise the FQDN is set by editing /etc/hosts and putting the FQDN on the line where the hostname appears. Suppose you have an hostname "foo", and you find a line:

127.0.0.1 foo

You would edit it like this:

127.0.0.1 foo.localdomain foo

foo.localdomain would be your new FQDN.

share|improve this answer
    
I have included the contents of that file as you asked! THANKS for the reply!! :) –  RadiantHex Jul 8 '10 at 9:17

edit /etc/hosts to add your FQDN

Information on syntax located here: http://www.faqs.org/docs/securing/chap9sec95.html

update: reading over your question again it almost sounds like you either don't have your path set right, or there is something wrong with the hostname program.

do 'which hostname'

it should return with the path '/bin/hostname'

if that works try the command again like,

'/bin/hostname --fqdn'

share|improve this answer
    
Thanks!!! Sorry if I ask this, but how do I find out my FQDN? –  RadiantHex Jul 7 '10 at 23:07
1  
well this stands for 'Fully Qualified Domain Name' superuser.com is a FQDN. If you own a domain, you could use it, otherwise you can just make up something if you are on an internal network. –  Mudfly Jul 7 '10 at 23:11
1  
Thanks @Mudfly! I tried your instructions, the last commands returns "hostname: Name or service not known" again! –  RadiantHex Jul 7 '10 at 23:12
    
Without more info its hard to know the conditions of your problem. EG: is this a local install, are you logged in over ssh, are you using a user account or logged in root? You might want to visit ubuntuforums.org and search for others who have solved similar issues. –  Mudfly Jul 7 '10 at 23:23
1  
This is taking a wild jump here but, Ubuntu favors using sudo over the use of root. It is quite possible that the shell isnt setup correctly. To test this is very simple. First you can do 'ls -al /root/' and see if you can see a .bashrc Second if you don't have a .bashrc copy it from skel 'cp /etc/skel/.bashrc ./' you can do this even if you already have the file. Third do '/bin/bash' to make sure you are running bash. Finally try your original command again, you should be running in a fully configured bash shell. –  Mudfly Jul 7 '10 at 23:42

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.