Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

/etc/hosntame->/etc/conf.d/hostname

2 views
Skip to first unread message

Stig Mogensen

unread,
Jun 12, 2005, 10:00:16 AM6/12/05
to
Upon boot, I get the kernel messages saying that etc/hostname should no
longer be used, and I should switch to etc/conf.d/hostname. Same goes for
etc/dnsdomainname and etc/conf.d/domainname.

How is that done?.

Can I jst delete the /etc/hostname and /etc/dnsdomainname files, and add the
appropriate "tux" and "homenetwork" entries as explained in the
installdocs, and keep domainname in my default runlevel?.

/Stig

Paul Bredbury

unread,
Jun 12, 2005, 10:19:57 AM6/12/05
to
Stig Mogensen wrote:
> Upon boot, I get the kernel messages saying that etc/hostname should no
> longer be used, and I should switch to etc/conf.d/hostname. Same goes for
> etc/dnsdomainname and etc/conf.d/domainname.
>
> How is that done?.

Look inside the files you just mentioned in /etc/conf.d/ - the files
themselves contain their setup instructions.

> Can I jst delete the /etc/hostname and /etc/dnsdomainname files, and add the
> appropriate "tux" and "homenetwork" entries as explained in the
> installdocs, and keep domainname in my default runlevel?.

Yes. See
http://groups-beta.google.com/group/alt.os.linux.gentoo/msg/461a37c10c55a03f?hl=en

Stig Mogensen

unread,
Jun 12, 2005, 12:01:08 PM6/12/05
to
Paul Bredbury wrote:

> Stig Mogensen wrote:
>> Upon boot, I get the kernel messages saying that etc/hostname should no
>> longer be used, and I should switch to etc/conf.d/hostname. Same goes for
>> etc/dnsdomainname and etc/conf.d/domainname.
>>
>> How is that done?.
>
> Look inside the files you just mentioned in /etc/conf.d/ - the files
> themselves contain their setup instructions.

Well....I wouldn't call it "instructions":o), but now my etc/conf.d/hostname
contains HOSTNAME="tux", and etc/conf.d/domainname has
DNSDOMAIN="homenetwork".



>> Can I jst delete the /etc/hostname and /etc/dnsdomainname files, and add
>> the appropriate "tux" and "homenetwork" entries as explained in the
>> installdocs, and keep domainname in my default runlevel?.
>
> Yes. See
>
http://groups-beta.google.com/group/alt.os.linux.gentoo/msg/461a37c10c55a03f?hl=en

Excellent...thank you.

/Stig

oldNbald

unread,
Jun 12, 2005, 2:42:21 PM6/12/05
to
And so, Stig Mogensen just had to say ...

>
> [...]and etc/conf.d/domainname has DNSDOMAIN="homenetwork".

But, is that a "FQDN" (fully qualified domain name)?
--
oNb
Warning: abortion has been proven to be fatal to the fetus.

Paul Bredbury

unread,
Jun 12, 2005, 2:57:17 PM6/12/05
to
oldNbald wrote:
>>[...]and etc/conf.d/domainname has DNSDOMAIN="homenetwork".
>
> But, is that a "FQDN" (fully qualified domain name)?

No, it's not. But it is a domain name, and it's fine for a home
network. All the PCs which can't be called something like
"www.kernel.org", still have to have a host name and domain name of some
sort.

oldNbald

unread,
Jun 12, 2005, 5:23:26 PM6/12/05
to
And so, Paul Bredbury just had to say ...

> No, it's not. [...]

So, when you're in CLI, or there's an app which shows your DN, does it go
something like mine ? - codybeau.(none) .
--
oNb

Paul Bredbury

unread,
Jun 12, 2005, 6:33:36 PM6/12/05
to
oldNbald wrote:
> So, when you're in CLI, or there's an app which shows your DN, does it go
> something like mine ? - codybeau.(none) .

Yeah, it shows me "... .(none)" at login, and "domainname" returns
"(none)" instead of "homenetwork".

Then again, I also have a Gentoo server which supposedly has a FQDN,
with which "domainname" also returns "(none)". However, "dnsdomainname"
returns the expected string.

I've just read a little of
http://www.linux-nis.org/nis-howto/HOWTO/glossary.html , since
"domainname" cares about NIS ("Network Information Service") rather than
DNS.

Home users would need to "emerge ypserv" to set up NIS, for zero benefit
that I can see. It's for sharing passwords between PCs in a workgroup,
to allow hot-desking, it seems.

I'm surprised that Linux by default uses NIS to determine the domain
name, rather than DNS.

oldNbald

unread,
Jun 12, 2005, 7:03:24 PM6/12/05
to
And so, Paul Bredbury just had to say ...
[...]

> Home users would need to "emerge ypserv" to set up NIS, for zero benefit
> that I can see.[...]

Yes, this is home-based stand-alone system for a single family and there's
no need for ypserv, plus, everything is working as desired. Think I'll
leave well enough alone :)
--
oNb

Arthur Hagen

unread,
Jun 13, 2005, 4:24:46 AM6/13/05
to

Yes, and no. Unfortunately, the switch to /etc/conf.d/domainname was
ill thought out, or rather, the warning message was not thought through.
There's apps that *depend* on /etc/hostname being present, among them
yp-tools.

My advice: Leave the /etc/hostname entry, and duplicate (or create a
symlink/hardlink) in /etc/conf.d/ (until the devs sort out their mess
and revert back for compatibility reasons :-))

Regards,
--
*Art

Arthur Hagen

unread,
Jun 13, 2005, 4:48:56 AM6/13/05
to
Paul Bredbury <i...@hate-spam.com> wrote:
>
> I've just read a little of
> http://www.linux-nis.org/nis-howto/HOWTO/glossary.html , since
> "domainname" cares about NIS ("Network Information Service") rather
> than DNS.
>
> Home users would need to "emerge ypserv" to set up NIS, for zero
> benefit that I can see. It's for sharing passwords between PCs in a
> workgroup, to allow hot-desking, it seems.

NIS (YP) is a lot more than that. It allows sharing any kind of map
files, and the most common use is for sharing a hosts file and automount
maps. It's also useful for other things, like sharing printcap and
aliases.

It's most useful when combined with dhcpd, NFS and autofs.

> I'm surprised that Linux by default uses NIS to determine the domain
> name, rather than DNS.

It doesn't.

The domain name queries carried out by gethostbyname() and
gethostbyaddr() use a combination of any or all of the
name server named(8), a broken out line from /etc/hosts,
and the Network Information Service (NIS or YP), depending
upon the contents of the order line in /etc/host.conf.
(See resolv+(8)). The default action is to query
named(8), followed by /etc/hosts.

Regards,
--
*Art

Paul Bredbury

unread,
Jun 13, 2005, 6:39:29 AM6/13/05
to

I would expect "domainname" to (eventually) read the DNSDOMAIN setting
from /etc/conf.d/domainname, and return "homenetwork" rather than "(none)".

From reading http://lists.debian.org/debian-user/2001/04/msg02814.html I
see that I can make "domainname" return "homenetwork" by running:

echo "homenetwork" > /proc/sys/kernel/domainname

But I would assume that's not the preferred method.

Has anyone managed to get "domainname" to return something other than
"(none)" without using NIS?

Arthur Hagen

unread,
Jun 13, 2005, 9:39:46 AM6/13/05
to
Paul Bredbury <i...@hate-spam.com> wrote:
>
> I would expect "domainname" to (eventually) read the DNSDOMAIN setting
> from /etc/conf.d/domainname, and return "homenetwork" rather than
> "(none)".

Not if the system is told to query NIS, it shouldn't. And
/etc/conf.d/domainname is not a file that is consulted in real time
anyhow, like /etc/hosts is -- it's a Gentoo-abomination that sets the
hostname in the shell that calls it, and no standard utilities will ever
call it, only Gentoo startup scripts do. "domainname" simply uses the
resolver routines, and isn't Gentoo-specific. How the resolver routines
look up a name depends on how you've configured the system.

> Has anyone managed to get "domainname" to return something other than

> "(none)" without using NIS?]

Have you tried removing nis from both /etc/host.conf and
/etc/nsswitch.conf, followed by a dive to single user (or non-network
mode, if Gentoo had had one) and back?

Regards,
--
*Art

Paul Bredbury

unread,
Jun 13, 2005, 10:21:37 AM6/13/05
to
Arthur Hagen wrote:
> Have you tried removing nis from both /etc/host.conf and
> /etc/nsswitch.conf, followed by a dive to single user (or non-network
> mode, if Gentoo had had one) and back?

nis is not present in those files - I have an non-customized 2005.0
installation for them:

/etc/host.conf:
order hosts, bind
mdns off
multi off

/etc/nsswitch.conf:
passwd: compat
shadow: compat
group: compat
hosts: files dns
networks: files dns
services: db files
protocols: db files
rpc: db files
ethers: db files
netmasks: files
netgroup: files
bootparams: files
automount: files
aliases: files


Interesting snippets from "man domainname" are:

"domainname - show or set the system's NIS/YP domain name"

"domainname, nisdomainname, ypdomainname will print the name of the
system as returned by the getdomainname(2) function. This is also known
as the YP/NIS domain name of the system."


The simplest answer to all this is that "domainname" only refers to NIS.
So, I'm still surprised that DNS isn't used to calculate the domain
name as shown at a login prompt.

The command "/bin/domainname homenetwork" works - I suppose I could put
that in /etc/conf.d/local.start, to fix the appearance of the PC having
no domain.

Johan Lindquist

unread,
Jun 13, 2005, 10:43:09 AM6/13/05
to
So anyway, it was like, 16:21 CEST Jun 13 2005, you know? Oh, and, yeah,
Paul Bredbury was all like, "Dude,

> The command "/bin/domainname homenetwork" works - I suppose I could
> put that in /etc/conf.d/local.start, to fix the appearance of the PC
> having no domain.

Or you could just set NISDOMAIN in /etc/conf.d/domainname and let the
/etc/init.d/domainname script set it for you, regardless of whether
you're actually going to use NIS.

--
Time flies like an arrow, fruit flies like a banana. Perth ---> *
16:34:41 up 22 days, 21:12, 9 users, load average: 1.00, 1.01, 1.00
Linux 2.6.11.10 x86_64 GNU/Linux Registered Linux user #261729

Anno v. Heimburg

unread,
Jun 13, 2005, 11:36:09 AM6/13/05
to
Paul Bredbury wrote:
> I would expect "domainname" to (eventually) read the DNSDOMAIN setting
> from /etc/conf.d/domainname, and return "homenetwork" rather than
> "(none)".

The "domainname" command, if called without parameters, *always* returns the
NIS domain name. It *does not* look in any other place. Call "domainname
-f" or "domainname -d" to get the FQDN or your domain, respectively.

For more info, call "domainname --help"

Anno

Anno v. Heimburg

unread,
Jun 13, 2005, 11:38:08 AM6/13/05
to
Arthur Hagen wrote:
> The domain name queries carried out by gethostbyname() and
> gethostbyaddr() use a combination of any or all of the
> name server named(8), a broken out line from /etc/hosts,
> and the Network Information Service (NIS or YP), depending
> upon the contents of the order line in /etc/host.conf.
> (See resolv+(8)). The default action is to query
> named(8), followed by /etc/hosts.

Yes, but that is not what the domainname command does. It always returns the
NIS domain if called without parameters.

Read "domainname --help"

Anno.

Paul Bredbury

unread,
Jun 13, 2005, 2:44:00 PM6/13/05
to
Johan Lindquist wrote:
>>The command "/bin/domainname homenetwork" works - I suppose I could
>>put that in /etc/conf.d/local.start, to fix the appearance of the PC
>>having no domain.
>
>
> Or you could just set NISDOMAIN in /etc/conf.d/domainname and let the
> /etc/init.d/domainname script set it for you, regardless of whether
> you're actually going to use NIS.

Yes, setting NISDOMAIN and rebooting does make "domainname" return
something meaningful.

However, at login my PC *still* says "xxxx.(none)". I suppose this is
linked to "dnsdomainname" returning absolutely nothing, although I set
DNSDOMAIN also in /etc/conf.d/domainname.

Running "dnsdomainname homenetwork" gives the response:

"You can't change the DNS domain name with this command. Unless you are
using bind or NIS for host lookups you can change the DNS domain name
(which is part of the FQDN) in the /etc/hosts file."

Ah, I've just found that if /etc/hosts contains:
127.0.0.1 xxxx.homenetwork localhost
Rather than:
127.0.0.1 localhost xxxx.homenetwork

Then "dnsdomainname" immediately starts responding with the proper
answer of "homenetwork". That's funny, I'm sure I've seen it mentioned
several times that "localhost" should be first in the list.

0 new messages