opensuse 12.3 - dhcp error during startup

Hello.
Iam not able to use some script which use the command hostname -s.
I have two notebook with 12.3 and I got the same problem
This problem does not appear until 12.3
So I could not finish my install on my server.
And this because I am installing 12.3 on my server that I encountered this problem.

When I tried the command on cli I got this error :

LINUX-TEST-XYZ:~ # hostname
**LINUX-TEST-XYZ**
LINUX-TEST-XYZ:~ # 

LINUX-TEST-XYZ:~ # hostname -s
**hostname: Name or service not known**
LINUX-TEST-XYZ:~ # 

This is systemd journal :

Sep 18 09:34:17 LINUX-TEST-XYZ systemd[1]: Started Network Manager Script Dispatcher Service.
Sep 18 09:34:17 LINUX-TEST-XYZ avahi-daemon[593]: Loading service file /etc/avahi/services/sftp-ssh.service.
Sep 18 09:34:17 LINUX-TEST-XYZ avahi-daemon[593]: Loading service file /etc/avahi/services/ssh.service.
Sep 18 09:34:17 LINUX-TEST-XYZ avahi-daemon[593]: Network interface enumeration completed.
Sep 18 09:34:17 LINUX-TEST-XYZ avahi-daemon[593]: Registering HINFO record with values 'X86_64'/'LINUX'.
Sep 18 09:34:17 LINUX-TEST-XYZ avahi-daemon[593]: Server startup complete. Host name is LINUX-TEST-XYZ.local. Local service cookie is 3723176704.
Sep 18 09:34:17 LINUX-TEST-XYZ avahi-daemon[593]: Service "LINUX-TEST-XYZ" (/etc/avahi/services/ssh.service) successfully established.
Sep 18 09:34:17 LINUX-TEST-XYZ avahi-daemon[593]: Service "LINUX-TEST-XYZ" (/etc/avahi/services/sftp-ssh.service) successfully established.
Sep 18 09:34:17 LINUX-TEST-XYZ systemd-logind[602]: New seat seat0.
Sep 18 09:34:17 LINUX-TEST-XYZ systemd[1]: Started Login Service.
Sep 18 09:34:18 LINUX-TEST-XYZ systemd-logind[602]: Watching system buttons on /dev/input/event3 (Power Button)
Sep 18 09:34:18 LINUX-TEST-XYZ systemd-logind[602]: Watching system buttons on /dev/input/event2 (Power Button)
Sep 18 09:34:18 LINUX-TEST-XYZ network[606]: Setting up network interfaces:
Sep 18 09:34:18 LINUX-TEST-XYZ network[606]: lo
Sep 18 09:34:18 LINUX-TEST-XYZ ifup[909]: lo
Sep 18 09:34:18 LINUX-TEST-XYZ ifup[931]: lo
Sep 18 09:34:18 LINUX-TEST-XYZ ifup[934]: IP address: 127.0.0.1/8
Sep 18 09:34:18 LINUX-TEST-XYZ network[606]: lo        IP address: 127.0.0.1/8
Sep 18 09:34:18 LINUX-TEST-XYZ ifup[936]: 
Sep 18 09:34:18 LINUX-TEST-XYZ network[606]: ..done    eth0      device: Realtek Semiconductor Co., Ltd. RTL8111/8168
Sep 18 09:34:18 LINUX-TEST-XYZ ifup[1019]: eth0      device: Realtek Semiconductor Co., Ltd. RTL8111/8168
Sep 18 09:34:19 LINUX-TEST-XYZ network[606]: WARNING: Deprecated config file /etc/modprobe.conf, all config files belong into /etc/modprobe.d/.
Sep 18 09:34:19 LINUX-TEST-XYZ kernel: NET: Registered protocol family 17
Sep 18 09:34:19 LINUX-TEST-XYZ kernel: r8169 0000:02:00.0 eth0: link down
Sep 18 09:34:19 LINUX-TEST-XYZ kernel: r8169 0000:02:00.0 eth0: link down
Sep 18 09:34:19 LINUX-TEST-XYZ kernel: IPv6: ADDRCONF(NETDEV_UP): eth0: link is not ready
Sep 18 09:34:21 LINUX-TEST-XYZ kernel: r8169 0000:02:00.0 eth0: link up
Sep 18 09:34:21 LINUX-TEST-XYZ kernel: IPv6: ADDRCONF(NETDEV_CHANGE): eth0: link becomes ready
Sep 18 09:34:21 LINUX-TEST-XYZ ifup-dhcp[1589]: eth0      Starting DHCP4 client
Sep 18 09:34:21 LINUX-TEST-XYZ dhcpcd[1591]: eth0: dhcpcd 3.2.3 starting
Sep 18 09:34:21 LINUX-TEST-XYZ dhcpcd[1591]: eth0: hardware address = 00:24:1d:c1:99:ba
Sep 18 09:34:21 LINUX-TEST-XYZ dhcpcd[1591]: eth0: broadcasting for a lease
Sep 18 09:34:21 LINUX-TEST-XYZ dhcpcd[1591]: eth0: offered 192.168.130.100 from 192.168.130.230
Sep 18 09:34:21 LINUX-TEST-XYZ dhcpcd[1591]: eth0: checking 192.168.130.100 is available on attached networks
Sep 18 09:34:21 LINUX-TEST-XYZ ifup-dhcp[1615]: .
Sep 18 09:34:22 LINUX-TEST-XYZ dhcpcd[1591]: eth0: leased 192.168.130.100 for infinity
Sep 18 09:34:22 LINUX-TEST-XYZ dhcpcd[1591]: eth0: adding IP address 192.168.130.100/24
Sep 18 09:34:22 LINUX-TEST-XYZ avahi-daemon[593]: Joining mDNS multicast group on interface eth0.IPv4 with address 192.168.130.100.
Sep 18 09:34:22 LINUX-TEST-XYZ avahi-daemon[593]: New relevant interface eth0.IPv4 for mDNS.
Sep 18 09:34:22 LINUX-TEST-XYZ avahi-daemon[593]: Registering new address record for 192.168.130.100 on eth0.IPv4.
Sep 18 09:34:22 LINUX-TEST-XYZ dhcpcd[1591]: eth0: adding default route via 192.168.130.230 metric 0
Sep 18 09:34:22 LINUX-TEST-XYZ ifdown[1821]: eth0      device: Realtek Semiconductor Co., Ltd. RTL8111/8168 PCI Express Gigabit Ethernet controller (rev 02)
**Sep 18 09:34:23 LINUX-TEST-XYZ dhcpcd[1591]: eth0: Failed to lookup hostname via DNS: Name or service not known**
Sep 18 09:34:23 LINUX-TEST-XYZ ifup[1921]: eth0      device: Realtek Semiconductor Co., Ltd. RTL8111/8168 PCI Express Gigabit Ethernet controller (rev 02)
Sep 18 09:34:23 LINUX-TEST-XYZ dhcpcd[1591]: eth0: exiting
Sep 18 09:34:23 LINUX-TEST-XYZ network[606]: eth0      Starting DHCP4 client.
Sep 18 09:34:23 LINUX-TEST-XYZ ifup-dhcp[1996]: 
Sep 18 09:34:23 LINUX-TEST-XYZ network[606]: eth0      IP address: 192.168.130.100/24
Sep 18 09:34:23 LINUX-TEST-XYZ ifup-dhcp[1999]: eth0      IP address: 192.168.130.100/24
Sep 18 09:34:23 LINUX-TEST-XYZ network[606]: ..doneSetting up service network  .  .  .  .  .  .  .  .  .  .  .  .  ...done
Sep 18 09:34:23 LINUX-TEST-XYZ systemd[1]: Started LSB: Configure network interfaces and set up routing.
Sep 18 09:34:23 LINUX-TEST-XYZ systemd[1]: Starting Network.
Sep 18 09:34:23 LINUX-TEST-XYZ systemd[1]: Reached target Network.
Sep 18 09:34:23 LINUX-TEST-XYZ systemd[1]: Starting Command Scheduler...
Sep 18 09:34:23 LINUX-TEST-XYZ systemd[1]: Started Command Scheduler.
Sep 18 09:34:23 LINUX-TEST-XYZ systemd[1]: Starting Host and Network Name Lookups.
Sep 18 09:34:23 LINUX-TEST-XYZ systemd[1]: Reached target Host and Network Name Lookups.

It would be great if somebody can help me.

On my 12.3 system:

beelden:~ # hostname
beelden.henm.xs4all.nl
beelden:~ # hostname -s
beelden
beelden:~ # 

So I can not reproduce :frowning:

You seem not to have a domainname, it may be that there is a bug when you haven’t.

What does using the long option do

hostname --short
LINUX-TEST-XYZ:~ # hostname --short
hostname: Name or service not known
LINUX-TEST-XYZ:~ # hostname -f
hostname: Name or service not known
LINUX-TEST-XYZ:~ #

Same error before I change host name in yast2 which was linux-kfpw.site

This problem is new for me with 12.3

I can reproduce (though currently on an “open” connection in a coffee shop):


laptop:~ # hostname
laptop.knurpht
laptop:~ # hostname -s
hostname: Name or service not known
laptop:~ # hostname --short
hostname: Name or service not known


Could this be related to the “Change hostname through DHCP” setting?

Now these are some wild guesses. It seems that your hostname interpretes the argument quite different from what we expect. Are you executing the correct tool? Check
with

beelden:~ # which hostname
/bin/hostname
beelden:~ #

I do not understand now the consequences, but I started reading more extensive in

man hostname

There it says:

The function gethostname(2) is used to get the hostname. Only when the hostname -s is called will gethostbyname(3) be called. The difference in gethostname(2) and gethostbyname(3) is that gethostbyname(3) is network aware, so it consults /etc/nsswitch.conf and /etc/host.conf to decide whether to read information in /etc/sysconfig/network or /etc/hosts the hostname is also set when the network interface is brought up.

Which means that tinkering with e.g. nsswitch.conf could result in problems. And as nsswitch.conf mentions services (like DNS, NIS) and the error uses that word, that could be the case.

If this does not trigger an Aha from you, you could post the content of /etc/nsswitch.conf /etc/host.conf.

Ah, sorry, didn’t see Knurpht’s post (BTW, what are you doing in a Coffee shop???)

Rereading from the beginning I was wandering why DHCP was in the title of this thread. I saw no connection with the contents of the first post. And then I saw Knurpht’s post.

If you look at my post N°1, I join systemd journal.
You will see this error :

**Sep 18 09:34:23 LINUX-TEST-XYZ dhcpcd[1591]: eth0: Failed to lookup hostname via DNS: Name or service not known**

So I imagined that it should be a good idea to put dhcp in the title.

/etc/host :

LINUX-TEST-XYZ:~ # cat  /etc/hosts                                                                                                             
#                                                                                                                                              
# hosts         This file describes a number of hostname-to-address                                                                            
#               mappings for the TCP/IP subsystem.  It is mostly                                                                               
#               used at boot time, when no name servers are running.                                                                           
#               On small systems, this file can be used instead of a                                                                           
#               "named" name server.                                                                                                           
# Syntax:                                                                                                                                      
#                                                                                                                                              
# IP-Address  Full-Qualified-Hostname  Short-Hostname
#

127.0.0.1       localhost 
192.168.130.100 LINUX-TEST-XYZ

LINUX-TEST-XYZ:~ # 

/etc/host.conf

LINUX-TEST-XYZ:~ # cat /etc/host.conf
#
# /etc/host.conf - resolver configuration file
#
# Please read the manual page host.conf(5) for more information.
#
#
# The following option is only used by binaries linked against
# libc4 or libc5. This line should be in sync with the "hosts"
# option in /etc/nsswitch.conf.
#
order hosts, bind
#
# The following options are used by the resolver library:
#
multi on

LINUX-TEST-XYZ:~ # 

/etc/nsswitch.conf

LINUX-TEST-XYZ:~ # cat /etc/nsswitch.conf
#
# /etc/nsswitch.conf
#
# An example Name Service Switch config file. This file should be
# sorted with the most-used services at the beginning.
#
# The entry '[NOTFOUND=return]' means that the search for an
# entry should stop if the search in the previous entry turned
# up nothing. Note that if the search failed due to some other reason
# (like no NIS server responding) then the search continues with the
# next entry.
#
# Legal entries are:
#
#       compat                  Use compatibility setup
#       nisplus                 Use NIS+ (NIS version 3)
#       nis                     Use NIS (NIS version 2), also called YP
#       dns                     Use DNS (Domain Name Service)
#       files                   Use the local files
#       [NOTFOUND=return]       Stop searching if not found so far
#
# For more information, please read the nsswitch.conf.5 manual page.
#

# passwd: files nis
# shadow: files nis
# group:  files nis

passwd: compat
group:  compat

hosts:          files mdns_minimal [NOTFOUND=return] dns
networks:       files dns

services:       files
protocols:      files
rpc:            files
ethers:         files
netmasks:       files
netgroup:       files nis
publickey:      files

bootparams:     files
automount:      files nis
aliases:        files

LINUX-TEST-XYZ:~ # 

/etc/resolv.conf

LINUX-TEST-XYZ:~ # cat /etc/resolv.conf
### /etc/resolv.conf file autogenerated by netconfig!
#
# Before you change this file manually, consider to define the
# static DNS configuration using the following variables in the
# /etc/sysconfig/network/config file:
#     NETCONFIG_DNS_STATIC_SEARCHLIST
#     NETCONFIG_DNS_STATIC_SERVERS
#     NETCONFIG_DNS_FORWARDER
# or disable DNS configuration updates via netconfig by setting:
#     NETCONFIG_DNS_POLICY=''
#
# See also the netconfig(8) manual page and other documentation.
#
# Note: Manual change of this file disables netconfig too, but
# may get lost when this file contains comments or empty lines
# only, the netconfig settings are same with settings in this
# file and in case of a "netconfig update -f" call.
#
### Please remove (at least) this line when you modify the file!
search lan
nameserver 192.168.2.200
LINUX-TEST-XYZ:~ # 


LINUX-TEST-XYZ:~ # which hostname
/bin/hostname
LINUX-TEST-XYZ:~ # 


What do you mean ?

Don’t forgot :
1°) This is new for me from 12.3 and because I just reinstall my server with 12.3
2°) I use linux the same way for years. So until I learn something more, I may repeat the same error. I always configure the network device by validating “Change hostname from DHCP” and unvalidating “Assign hostname to loopback IP”

You are correct, I missed that in the long listing and your bold line was not scrolled into visibilaty by me.

In any case, it is logical that it can’t be found through DNS as it is not a correct host-domainname. But I think we have to contemplate what Knurpht found and how it can influence this. Is missing a domain part influentual?

“hostname -s” calls gehostbyname() on result of gethostname() to find FQDN. "Name or service not known" simply means that no name service could provide FQDN, that’s all. It is not an error (and it has absolutely nothing to do with dhcp “error” during startup).

What actual problem are you trying to solve? What does not work except “hostname -s” not returning anything (which is likely the case for most users at home)?

systemd journal :

**Sep 18 09:34:23 LINUX-TEST-XYZ dhcpcd[1591]: eth0: Failed to lookup hostname via DNS: Name or service not known**
  1. : I never encountered this problem up to 12.2. So I would like to know why this happens now.
  2. : I have upgrade my server from 12.2 to 12.3.

I use a script which configure nx client and use a lot of hostname command .
Here partial screen output.

+ createNXsession
++ hostname -s
hostname: Name or service not known
+ printf '\033[32;1m - writing nx session file %s.nxs\033[37;0m
'
 - writing nx session file .nxs
+ '[' 11945 ']'
+ '' 11945 ']'
+ port=11945
+ port=11945
+ cat
++ hostname -s
hostname: Name or service not known
++ hostname -f
hostname: Name or service not known
++ hostname -f
hostname: Name or service not known
++ hostname -f
hostname: Name or service not known
++ cat /var/lib/nxserver/home/.ssh/client.id_dsa.key
+ NXsessionClientMsg
+ cat
++ hostname -s
hostname: Name or service not known
++ hostname -s
hostname: Name or service not known

A session file for  including the client key has been written in
/var/lib/nxserver/home/.nxs. You may copy this file to your client ~/.nx/config
directory and change this session settings in Nomachine client to suit your
needs.
+ '' yes ']'
+ startfreenx
+ '' '' ']'
+ systemd-analyze time
+ '' -f /etc/init.d/freenx-server ']'
linux-1dhl:~ # 

There is no output file because hostname -s or hostname -f retrurn nothing.
THis never happens until now.
Why ?

On 2013-09-18 15:46, jcdole wrote:
> Why ?

No DNS?


Cheers / Saludos,

Carlos E. R.
(from 12.3 x86_64 “Dartmouth” at Telcontar)

The simplest way to “fix” it is to add FQDN to /etc/hosts.

I did an upgrade from 12.2 from 12.3 and indeed something did change in the way the DSN resolving works depending on if you allow or not the changes to resolv.conf.

I see in the log that you get an IP from a DHCP server - who does your DNS-ing? Is it the same server running a DNS service? Which it seems that it does not work currently.

On this site there were no serveur acting as dns server.
It is a local network and dns request are process thru the DSL modem routeur.
The network configuration is the same for years.

The only things that as changed is opensuse version from 12.2 to 12.3

On 2013-09-19 20:06, jcdole wrote:
>
> robin_listas;2585968 Wrote:
>> On 2013-09-18 15:46, jcdole wrote:
>>> Why ?
>>
>> No DNS?

> On this site there were no serveur acting as dns server.
> It is a local network and dns request are process thru the DSL modem
> routeur.
> The network configuration is the same for years.
>
> The only things that as changed is opensuse version from 12.2 to 12.3

Mmm.

I just found out recently that it is terribly easy to setup dnsmasq as
local dns server. Instead of the proper set of domain configuration
files, it simply reads the “/etc/hosts” file (dnsmasq is installed by
default on openSUSE, just not enabled).

The configuration changes are these two:

/etc/resolv.conf: Tell the system to query local DNS server



search valinor
#nameserver 192.168.1.1
nameserver 127.0.0.1


/etc/dnsmasq.conf: Tell dnsmasq to ask the router or isp or whatever.



server=192.168.1.1


And then start the service. Try if those commands still fail - if they
work, then you know the reason. Then enable the service to start
automatically.


Cheers / Saludos,

Carlos E. R.
(from 12.3 x86_64 “Dartmouth” at Telcontar)

I will try this to day