# nknown_domain

## blueribbon

When I start up Gentoo, I get this:

gentoo14.nknown_domain

gentoo14 is my hostaname, but nknown_domain is nothing, how can I get rid of it? My /etc/dnsdomainname is totally empty...

Thanx dudes

----------

## Janne Pikkarainen

If you are using DHCP, change this line from /etc/conf.d/net:

dhcpcd_eth0=""

to be

dhcpcd_eth0="-D"

----------

## blueribbon

I'm not using DHCP  :Sad:  But i'll try it with DHCP to see if it solves the issue.

Thanx!

----------

## illc0mm

See:

https://forums.gentoo.org/viewtopic.php?p=519288#519288

For a possible solution to this.

-illc0mm

----------

## b0fh

Did you solve it? I'm having the same problem here... None of the howtos fixed it  :Sad: 

----------

## blueribbon

I thank illc0mm, but I haven't had time to test this solution... i'm on the middle of an important task!  :Smile: 

I'll tell you once I try to solve it that way.

----------

## KruzeS

Has anybody got a fix of this?

I know it doesn't really mater nor anything but...

Thanks!!

----------

## Genone

Can you post the contents of /etc/dnsdomainname and /etc/resolv.conf and have you added the domainname initscript to your default or boot runlevels ?

----------

## mutex

I'm having this same problem and I've done all of the above. Here's my /etc/dnsdomainname:

tc.ph.cox.net

What gives?

----------

## Genone

does the dnsdomainname command return anything ?

----------

## mutex

Here's the output of dnsdomainname:

bash-2.05b# dnsdomainname

dnsdomainname: Unknown host

----------

## pluto

 *mutex wrote:*   

> Here's the output of dnsdomainname:
> 
> bash-2.05b# dnsdomainname
> 
> dnsdomainname: Unknown host

 

# echo "YourHost" > /etc/hostname

# echo "YourDomain" > /etc/dnsdomainname

# rc-update add domainname boot

# /etc/init.d/domainname start

# sed -i "s:\\o:\\O:" /etc/issue

# logout & login

----------

## mutex

did the above... still same problem.

----------

## Genone

What's the content of your /etc/resolv.conf ?

----------

## mutex

bash-2.05b$ cat /etc/resolv.conf

domain tc.ph.cox.net

nameserver 68.2.16.245

nameserver 68.2.16.30

nameserver 68.6.16.30

----------

## Genone

weird, AFAIK it should work with this config  :Confused: 

----------

## mutex

hmm, should I submit a bug report?

----------

## Genone

Hmm, one last idea: maybe your resolver library is configure wrong, could you post the output of the following command:

```
grep hosts /etc/nssswitch.* /etc/nscd.conf
```

----------

## mutex

Well, I just bought a new hd today and am rebuilding gentoo on the new hd (more space, yummy). So if it happens again I'll do the above. Thanks,

--

mutex

----------

## b0fh

I still have the same problems here:

```
bash-2.05b$ grep hosts /etc/nsswitch.* /etc/nscd.conf

/etc/nsswitch.conf:hosts:       files dns

/etc/nsswitch.conf-winbind:hosts:       files dns

/etc/nsswitch.conf-wins:hosts:       files dns wins

/etc/nscd.conf:# Currently supported cache names (services): passwd, group, hosts

/etc/nscd.conf: enable-cache            hosts           yes

/etc/nscd.conf: positive-time-to-live   hosts           3600

/etc/nscd.conf: negative-time-to-live   hosts           20

/etc/nscd.conf: suggested-size          hosts           211

/etc/nscd.conf: check-files             hosts           yes

```

----------

## Genone

Looks ok too, so go ahead and file a bug (but only if there is none).

----------

## mutex

Even with a fresh and complete rebuild of gentoo I get the same thing.

b0fh, did you already submit the bug report?

----------

## b0fh

No, I don't know how to describe this exactly. If you have an idea how developers easy understand, please do so  :Smile: 

----------

## jlowell

I found a solution to this problem by editing /etc/issue to replace the entry \O with \o

This would almost certainly appear to be bug.

jlowell

----------

## mutex

I'll give it a try tonight when I get home.

----------

## mutex

For me, the \o instead of the \O just puts out "(none)"... so that my login looks like this (given a host name of gentoo):

 This is gentoo.(none) 

etc

it doesn't say the DNS name.

----------

## digital diesel

This is happening to me too, i'm having the exact same problem, I have followed the same steps.  This sucks   :Evil or Very Mad:  because i need to get this box into production?

----------

## Genone

\o = NIS domainname, specified in /etc/nisdomainname and /etc/domainname

\O = DNS domainname, specified in /etc/dnsdomainname and /etc/resolv.conf

----------

## mutex

Ok, well the only thing I have in resolv.conf is a 'nameserver' entry for my DNS server... what else should I put in there?

----------

## Genone

put your dns domainname in /etc/dnsdomainname and start /etc/init.d/domainname, that should do the necessary changes to /etc/resolv.conf. It's just a line "domain <your-domain-here>"

----------

## mutex

Still not working:

I did /etc/init.d/domainname start, said it updated the domain name, also did rc-udpate add domainname default... rebooted, still no go. Here's some output:

bash-2.05b$ cat /etc/dnsdomainname 

tc.ph.cox.net

bash-2.05b$ cat /etc/resolv.conf 

domain tc.ph.cox.net

nameserver 68.2.16.245

nameserver 68.2.16.30

nameserver 68.6.16.30

And my login says:

This is gentoo.nknown_domain (Linux i686 2.4.20-gentoo-r7) 20:22:59

Smells like a bug  :Razz: .

----------

## jamesrt

 *Genone wrote:*   

> put your dns domainname in /etc/dnsdomainname and start /etc/init.d/domainname, that should do the necessary changes to /etc/resolv.conf. It's just a line "domain <your-domain-here>"

 

I've discovered that if your hostname is not reverse-resolvable thru DNS, then you also need to put both the fully-qualified hostname and short-form in your /etc/hosts file before things work correctly, thus:

```
grep gentoo /etc/hosts

12.34.56.78 gentoo.mydomain.here gentoo
```

To this end, I wrote a dhcpcd.exe script (gets automatically run by dhcpcd when the interface goes up or down) to handle this for me, thus:

```
cat /etc/init.d/dhcpcd.exe

#!/bin/sh

filename="$1"

switch_file() {

        rm -rf /etc/hosts.old

        mv /etc/hosts /etc/hosts.old

        mv /etc/hosts.new /etc/hosts

}

start() {

        source $filename

        cat /etc/hosts > /etc/hosts.new

        echo "$IPADDR   `cat /etc/hostname`.`cat /etc/dnsdomainname` `cat /etc/hostname`" >> /etc/hosts.new

        switch_file

}

stop() {

        grep -v `hostname -s` /etc/hosts > /etc/hosts.new

        switch_file

}

case "$2" in

        up|new) start;;

        down)   stop;;

esac

```

On my machine, this originally had to be in /etc/dhcpc, but now it needs to be in /var/lib/dhcpc (presumably the recent emerge update of dhcpcd changed the directory).  At any rate, I just symlinked it, like this:

```
#ln -s /etc/init.d/dhcpcd.exe /var/lib/dhcpc/dhcpcd.exe
```

----------

## b0fh

But what should I put in dnsdomain if I actually have no domain? local.lan? Nothing?

----------

## mutex

I already have my IP resolving to gentoo.tc.ph.cox.net in the hosts file... so the problem still is happening for me.   :Confused: 

----------

## jamesrt

 *mutex wrote:*   

> I already have my IP resolving to gentoo.tc.ph.cox.net in the hosts file... so the problem still is happening for me.  

 

Ok, does your hosts file have the unqualified hostname (i.e. "gentoo") as well as the FQDN (i.e. "gentoo.tc.ph.cox.net") ? Mine does, and it works for me; didn't work when the unqualified hostname was deleted (blowed if I know why, either!)

Observe the following:

```
# grep gentoo /etc/hosts

12.13.14.15    gentoo.mydomain.com gentoo

# hostname

gentoo

# hostname -s

gentoo

# hostname -f

gentoo.mydomain.com

```

All working - hostname and FQDN both in hosts file.

After editing the hostsfile, to delete the unqualified hostname ONLY, I get the following:

```
# grep gentoo /etc/hosts

12.13.14.15    gentoo.mydomain.com

# hostname

gentoo

# hostname -s

hostname: No address associated with name

# hostname -f

hostname: Unknown host

```

Now it isn't working correctly - the hostname command can't resolve the FQDN correctly (even though the FQDN is in the /etc/hosts file).  Go figure.

Also, after editing the hostsfile, to have ONLY the unqualified hostname, I get the following:

```
# grep gentoo /etc/hosts

12.13.14.15    gentoo

# hostname

gentoo

# hostname -s

gentoo

# hostname -f

gentoo

```

At this point, the machine has lost it's domain, but at least the commands don't return errors.

To sum up, ensure that both FQDN and unqualified hostname appear in /etc/hosts (which is what my previous script does).

----------

## jamesrt

 *mutex wrote:*   

> I already have my IP resolving to gentoo.tc.ph.cox.net in the hosts file... so the problem still is happening for me.  

 

Ok, does your hosts file have the unqualified hostname (i.e. "gentoo") as well as the FQDN (i.e. "gentoo.tc.ph.cox.net") ? Mine does, and it works for me; didn't work when the unqualified hostname was deleted (blowed if I know why, either!)

Observe the following:

```
# grep gentoo /etc/hosts

12.13.14.15    gentoo.mydomain.com gentoo

# hostname

gentoo

# hostname -s

gentoo

# hostname -f

gentoo.mydomain.com

```

All working - hostname and FQDN both in hosts file.

After editing the hostsfile, to delete the unqualified hostname ONLY, I get the following:

```
# grep gentoo /etc/hosts

12.13.14.15    gentoo.mydomain.com

# hostname

gentoo

# hostname -s

hostname: No address associated with name

# hostname -f

hostname: Unknown host

```

Now it isn't working correctly - the hostname command can't resolve the FQDN correctly (even though the FQDN is in the /etc/hosts file).  Go figure.

Also, after editing the hostsfile, to have ONLY the unqualified hostname, I get the following:

```
# grep gentoo /etc/hosts

12.13.14.15    gentoo

# hostname

gentoo

# hostname -s

gentoo

# hostname -f

gentoo

```

At this point, the machine has lost it's domain, but at least the commands don't return errors.

To sum up, ensure that both FQDN and unqualified hostname appear in /etc/hosts (which is what my previous script does).

----------

## digital diesel

Thank you for your post, it help resolve my issue, at least half way.

I'm using DHCP on a cable modem from attbi.com

When i say:

mutt -x root

it sends it to root@dallas.attbi.com and i get this error:

sendmail: 553 malformed address: <root@_HOSTNAME_>

But I want it to be from it's hostname -f:

dallas.pmidigital.com

So far in my /etc/conf.d/local.start i have this:

echo 'domain pmidigital.com' >> /etc/resolve.conf

Is there a way not to have DHCP force it's domain on me

----------

## mutex

After adding the hostname to my hosts file as described above, I still have the same problem on 3 seperate machines.

----------

## Tridus

Setting the FQDN in /etc/hosts did it for me, although they had to be in this order:

1.2.3.4  hostname.domain.name hostname

Putting hostname before hostname.domain.name for some reason caused it to not work.

Hopefully that helps somebody.

----------

## Niko_K

Hi,

helped for me!

Thank you jamesrt & Tridus!

Niko

----------

## mucousmachine

if your login is saying mymachine.(none) or mymachine.nknown_domain

then do like jlowell said, 

  just edit /etc/issue, 

  replace the "O" with an "o"

I've looked all over the place, and it was a little thing like this!

----------

## taiger

this is a very strange problem.

I solved this problem by changing the position of occurrence in /etc/hosts

localhost in first position is bud!!!

example:

error:

127.0.0.1       localhost tigrePC.baracca.com tigrePC 

correct:

127.0.0.1       tigrePC.baracca.com tigrePC localhost

----------

## ewtrowbr

553 malformed address: <root@_HOSTNAME_>

to get rid of the _HOSTNAME_ problem, go edit /etc/ssmtp/ssmtp.conf.

Had the same problem, and just found this...

erich

----------

## michaelarch

 *mutex wrote:*   

> bash-2.05b$ cat /etc/resolv.conf
> 
> domain tc.ph.cox.net
> 
> nameserver 68.2.16.245
> ...

 

Hello,

I had the same problem, and after I removed the domain entry in the resolv.conf file, it worked again.  Hope this helps.

V/R,

Michael

----------

