Bug 706094

Summary: NetworkManager does not set hostname when DHCP used
Product: [Fedora] Fedora Reporter: Jarmo <rh>
Component: NetworkManagerAssignee: Dan Williams <dcbw>
Status: CLOSED ERRATA QA Contact: Fedora Extras Quality Assurance <extras-qa>
Severity: high Docs Contact:
Priority: unspecified    
Version: 15CC: dcbw, jklimes
Target Milestone: ---   
Target Release: ---   
Hardware: x86_64   
OS: Linux   
Whiteboard:
Fixed In Version: NetworkManager-0.8.9997-4.git20110620.fc15 Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
: 721070 (view as bug list) Environment:
Last Closed: 2011-06-24 03:55:38 UTC Type: ---
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:
Attachments:
Description Flags
Messages file from boot. none

Description Jarmo 2011-05-19 13:33:25 UTC
Description of problem:

NetworkManager does not set hostname when DHCP used.

Version-Release number of selected component (if applicable):


How reproducible:


Steps to Reproduce:
1. Install fedora 15.
2. Ensure /etc/sysconfig/network file has not 'hostname' defined, so have only one line
NETWORKING=yes

Actual results:

'hostname' gives
(none)
and  NetworkManager does not add hostname to /etc/hosts file.

Expected results:

Hostname should be imported from DHCP server.
Works in Fedora 14. In messages file we can see the message
'Setting system hostname to...  ... (from address lookup)

Additional info:

Comment 1 Jirka Klimes 2011-05-23 12:49:14 UTC
Could you include your /var/log/messages file so that we can see the logs?

Comment 2 Jarmo 2011-05-23 15:05:20 UTC
Created attachment 500454 [details]
Messages file from boot.

Comment 3 Jirka Klimes 2011-06-14 11:41:26 UTC
Upstream fix for not using "(none)" as fallback value is
9eaf31f49a3dc579e7765f4774fdcbc79463f1be

However, note that /etc/hosts is not handled by NM any more, and it is up to the administrator to set the file up properly. See the commit message for the rationale:
http://cgit.freedesktop.org/NetworkManager/NetworkManager/commit/?id=39eed50e470d6f41222e40ce0276b898e8c84dc4

(In reply to comment #0)
> Hostname should be imported from DHCP server.
> Works in Fedora 14. In messages file we can see the message
> 'Setting system hostname to...  ... (from address lookup)

"Setting system hostname to...  ... (from address lookup)"
message doesn't mean setting from DHCP server (because there's no host-name option in your case), but from DNS reverse lookup.
Try
$ dig -x <your IP>

Comment 4 Jarmo 2011-06-14 14:31:32 UTC
Can't see much differences with command "dig -x <IP> outputs between F14 and F15.
So can we summarize that this (NetworkManager does not set hostname) is expected behaviour now?

Comment 5 Jirka Klimes 2011-06-15 08:08:55 UTC
(In reply to comment #4)
> Can't see much differences with command "dig -x <IP> outputs between F14 and
> F15.
There should not be any difference in the output. The command just performs reverse DNS lookup and shows you the hostname in ANSWER SECTION.

> So can we summarize that this (NetworkManager does not set hostname) is
> expected behaviour now?

NetworkManager continues to set hostname (via system/library call sethostname()). And that could be checked by 'hostname' command.
The only thing it ceased to do is touching /etc/hosts.

The commit 9eaf31f49a3dc579e7765f4774fdcbc79463f1be fixes the case where the initial hostname was "(none)".

Comment 6 Jarmo 2011-06-15 13:04:56 UTC
Yes, ANSWER SECTION shows hostname in both F14 and F15.
Only difference is second column numbers (25294 vs. 28694).
Does this matter?

Comment 7 Jirka Klimes 2011-06-17 11:47:09 UTC
(In reply to comment #6)
> Yes, ANSWER SECTION shows hostname in both F14 and F15.
> Only difference is second column numbers (25294 vs. 28694).
> Does this matter?

No. The number is time-to-live specifying how long DNS will cache the value yet.
For a dig tutorial see e.g. http://www.madboa.com/geek/dig/

However, the dig command has not much to do with this bug. I just asked for the output to see if there was a hostname by reverse domain resolution.

Comment 8 Fedora Update System 2011-06-21 01:07:41 UTC
NetworkManager-0.8.9997-4.git20110620.fc15 has been submitted as an update for Fedora 15.
https://admin.fedoraproject.org/updates/NetworkManager-0.8.9997-4.git20110620.fc15

Comment 9 Jarmo 2011-06-21 16:11:12 UTC
Applied NetworkManager-0.8.9997-4.git20110620.fc15 and it resolves this bug issue i.e. hostname is correctly set now.
Thank you!

Comment 10 Fedora Update System 2011-06-21 23:53:13 UTC
Package NetworkManager-0.8.9997-4.git20110620.fc15:
* should fix your issue,
* was pushed to the Fedora 15 testing repository,
* should be available at your local mirror within two days.
Update it with:
# su -c 'yum update --enablerepo=updates-testing NetworkManager-0.8.9997-4.git20110620.fc15'
as soon as you are able to, then reboot.
Please go to the following url:
https://admin.fedoraproject.org/updates/NetworkManager-0.8.9997-4.git20110620.fc15
then log in and leave karma (feedback).

Comment 11 Fedora Update System 2011-06-24 03:55:26 UTC
NetworkManager-0.8.9997-4.git20110620.fc15 has been pushed to the Fedora 15 stable repository.  If problems still persist, please make note of it in this bug report.