Although the /etc/init.d/hostname script correctly sets up the hostname of a machine, the domainname (neither nis nor dns) isn't set at any time and thus reported incorrectly. # hostname localhost # domainname (none) which is *really b0rked. Reproducible: Always Steps to Reproduce: 1. install Gentoo Linux according to the Installation Guide (x86) 2. run /bin/hostname 3. run /bin/domainname Actual Results: shell excerpt: --8<-- snip --8<-- # /bin/hostname myhost # /bin/domainname (none) -->8-- snap -->8-- Expected Results: shell excerpt: --8<-- snip --8<-- # /bin/hostname myhost # /bin/domainname mydomain.mytld -->8-- snap -->8-- user@host $ emerge info Portage 2.0.48 (default-x86-1.4, gcc-3.2.2, glibc-2.3.1-r4) ================================================================= System uname: 2.4.20-xfs-r3 i686 AMD Athlon(tm) Processor GENTOO_MIRRORS="http://gentoo.linux.no/ http://www.ibiblio.org/pub/Linux/distributions/gentoo" CONFIG_PROTECT="/etc /var/qmail/control /usr/share/config /usr/kde/2/share/config /usr/kde/3/share/config /usr/X11R6/lib/X11/xkb:/usr/kde/3.1/share/config:/usr/share/config" CONFIG_PROTECT_MASK="/etc/gconf /etc/env.d" PORTDIR="/usr/portage" DISTDIR="/usr/portage/distfiles" PKGDIR="/usr/portage/packages" PORTAGE_TMPDIR="/var/tmp" PORTDIR_OVERLAY="" USE="directfb aalib nas ggi 3dnow acl acpi alsa -apm arts avi berkdb -bonobo -cdr crypt cups dga dvd -encode -esd fbcon -gdbm gif -gnome gpm -gtk -gtkhtml -guile -imlib -java jikes jpeg kde -ldap -libg++ libwww maildir -mikmod mmx motif -mpeg mpi ncurses nls oav oggvorbis opengl -oss pam pda -pdflib -perl png -python qt quicktime readline samba -scanner sdl -slang spell ssl -svga tcpd -tetex truetype usb X x86 xml2 -xmms xv zlib" COMPILER="gcc3" CHOST="i686-pc-linux-gnu" CFLAGS="-O2 -march=athlon -pipe -fomit-frame-pointer -funroll-loops -fforce-addr -finline-functions -falign-jumps=4 -falign-loops=4 -falign-functions=64 -fprefetch-loop-arrays " CXXFLAGS="-O2 -march=athlon -pipe -fomit-frame-pointer -funroll-loops -fforce-addr -finline-functions -falign-jumps=4 -falign-loops=4 -falign-functions=64 -fprefetch-loop-arrays " ACCEPT_KEYWORDS="x86" MAKEOPTS="-j2" AUTOCLEAN="yes" SYNC="rsync://rsync.gentoo.org/gentoo-portage" FEATURES="ccache sandbox userpriv usersandbox notitles"
which install did you do 1.2 ? 1.4 ? Code listing 19.1: Configuring Hostname # echo mymachine > /etc/hostname Then edit /etc/dnsdomainname so that it contains your DNS domainname, i.e. mydomain.com. Code listing 19.2: Configuring Domainname # echo mydomain.com > /etc/dnsdomainname If you have a NIS domain, you should set it in /etc/nisdomainname. Code listing 19.3: Configuring NIS Domainname # echo nis.mydomain.com > /etc/nisdomainname
I did 1.4 and issued the stated things to my system. However, /etc/issue output is not correct: --8<-- snip --8<-- This is \n.\o, running \m-\s (kernel \r). Welcome to [\l] on \d, \t (\U logged in). -->8-- snap -->8-- expands to --8<-- snip --8<-- This is wallace.(none), running i686-Linux (kernel 2.4.20-xfs-r3). Welcome to [vc/1] on Thu Jun 5 2003, 17:45:08 (0 users logged in). -->8-- snap -->8-- Also, /bin/domainname returns (none). /bin/dnsdomainname seems to work correctly.
BTW, setting the domainname with # domainname mydomain.net fixes this issue. Maybe this should be included into the hostname init script.
For DHCP users (which I suspect is most home users), the domain name is retrieved by the dchpcd client. So I think the proper fix for those folks is to add the -D flag to the /etc/init.d/net.eth0 script. I did this, and it does what I want. This could easily be integrated into a new baselayout.
> For DHCP users (which I suspect is most home users), the domain name is > retrieved by the dchpcd client. So I think the proper fix for those > folks is to add the -D flag to the /etc/init.d/net.eth0 script. I did > this, and it does what I want. This could easily be integrated into a > new baselayout. > Personally I do not see this as an issue, as there is $dhcpcd_eth0, etc that they can add the -D to if needed.
Good point. I'll give it a try. Seems like a better solution than adding it to the startup script. Maybe a comment to this effect could be added to the system default /etc/conf.d/net file?
While dhcp users can add -D if they want, this doesn't resolve the fact that the domainname is never set properly for static IP users. I've done this and it has resolved all issues for me: init.d # diff domainname domainname.old 52d51 < /bin/domainname ${mydnsdomain}
IMHO Gentoo should run the /etc/init.d/domainname script like /etc/init.d/hostname - in /sbin/rc! what's really strange is that you *have to* set /etc/nisdomainname to your dnsdomainname so that the output of 'domainname' (and the /etc/issue as well) shows the domainname you want...
Created attachment 14424 [details, diff] Patch for agetty Patch for agetty (from util-linux-2.11z) to have an option in /etc/issue to show the dns domainname (as this is annoying people). It does not interfere with the NIS domainname.
Created attachment 14425 [details, diff] Patch for agetty manpage Patch to document the new option in /etc/issue
Hmm, nice Marius Mauch - did you send it to the upstream developers for consideration ? Anyhow, in -r6 of util-linux, with 1.8.6.9 that will support this.
no, I didn't, just wrote it as a quick fix (motivated by drobbins). You think I should (it seems rather trivial for me) ?