Bug 871521 - Verify hostname configuration for /etc/sysconfig/network change
Summary: Verify hostname configuration for /etc/sysconfig/network change
Keywords:
Status: CLOSED CURRENTRELEASE
Alias: None
Product: Fedora
Classification: Fedora
Component: dhcp
Version: 18
Hardware: Unspecified
OS: Unspecified
unspecified
unspecified
Target Milestone: ---
Assignee: Jiri Popelka
QA Contact: Fedora Extras Quality Assurance
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2012-10-30 15:29 UTC by Daniel Drake
Modified: 2013-10-09 13:17 UTC (History)
3 users (show)

Fixed In Version:
Clone Of:
Environment:
Last Closed: 2013-10-09 13:17:26 UTC
Type: Bug
Embargoed:


Attachments (Terms of Use)

Description Daniel Drake 2012-10-30 15:29:01 UTC
Fedora 18 has changes w.r.t. how the hostname is handled:
http://lists.fedoraproject.org/pipermail/test/2012-October/111230.html

It looks like /usr/sbin/dhclient-script is reading $HOSTNAME from /etc/sysconfig/network and then passing it to /etc/sysconfig/network-scripts/ifup-post so that it is set as the hostname.

However, this may only affect corner cases, I haven't studied the exact behaviour. At least in a trivial setup I couldn't reproduce anything bad: With the hostname already set in /etc/hostname and another one set in /etc/sysconfig/network, I connect to a DHCP network via NetworkManager; the hostname stored in /etc/sysconfig/network is not applied (good).

Comment 1 Jiri Popelka 2012-10-31 10:05:58 UTC
(In reply to comment #0)
> It looks like /usr/sbin/dhclient-script is reading $HOSTNAME from
> /etc/sysconfig/network and then passing it to
> /etc/sysconfig/network-scripts/ifup-post so that it is set as the hostname.

Daniel, I haven't been able to find the part you are talking about.
Can you direct me to it ?

Comment 2 Daniel Drake 2012-10-31 14:19:17 UTC
http://lists.freedesktop.org/archives/systemd-devel/2012-October/007241.html

At a glance: dhclient-script runs ". /etc/sysconfig/network" then executes ifup-posts which inherits the HOSTNAME variable from the environment (presumably on purpose).

Comment 3 Jiri Popelka 2012-10-31 15:16:54 UTC
(In reply to comment #2)
> then executes ifup-posts

This specifically I can't find.
Maybe I'm getting blind so can you tell me which line/part of dhclient-script executes ifup-post ? thanks

Comment 4 marcindulak 2013-01-21 15:45:23 UTC
There may be a problem with handling of /etc/hostname, namely the system does not
seem to set a new hostname from dhcp, but keeps using the one originally (during installation) written into /etc/hostname.
My /etc/hostname contains XXX.YYY.ZZZ and has the same creation time as /root/anaconda-ks.cfg.
The /etc/sysconfig/network contains just NETWORKING=yes
The /etc/hostname does not get modified despite changed dhcp configuration of the host.

There was a lot of confusion about that in earlier Fedoras:
https://bugzilla.redhat.com/show_bug.cgi?id=719100
https://bugzilla.redhat.com/show_bug.cgi?id=875085
The way of "getting the hostname from dhcp" in Fedora 18 needs to be documented.

Comment 5 marcindulak 2013-01-24 09:51:20 UTC
I see that simply removing /etc/hostname file results in the name set according to the dhcp.

Comment 6 Jiri Popelka 2013-01-24 10:06:24 UTC
(In reply to comment #4)
> system does not
> seem to set a new hostname from dhcp, but keeps using the one originally
> (during installation) written into /etc/hostname.

(In reply to comment #5)
> I see that simply removing /etc/hostname file results in the name set
> according to the dhcp.

That corresponds with bug #719100, comment #1.

Comment 7 Jiri Popelka 2013-10-09 13:17:26 UTC
(In reply to Daniel Drake from comment #0)
> I connect to a DHCP network via NetworkManager

In that case the dhclient-script is not used at all, NM has it's own "dhclient-script". This bug seems like duplicate of bug #719100 / bug #875085.
I'm closing it as those NM bugs have already been fixed. If anybody wants to reopen it, feel free to do that and please reassign it to NM because NM handles the "reading hostname from configuration files and passing it to dhclient" part.


Note You need to log in before you can comment on or make changes to this bug.