Mailinglist Archive: opensuse-bugs (16652 mails)

< Previous Next >
[Bug 440809] Can't change hostname with the 'hostname' command
  • From: bugzilla_noreply@xxxxxxxxxx
  • Date: Fri, 21 Nov 2008 21:12:35 -0700 (MST)
  • Message-id: <20081122041235.D0D52CC7D4@xxxxxxxxxxxxxxxxxxxxxx>
https://bugzilla.novell.com/show_bug.cgi?id=440809

User gfarrell@xxxxxxxxxxxxxxx added comment
https://bugzilla.novell.com/show_bug.cgi?id=440809#c11





--- Comment #11 from Geoff Farrell <gfarrell@xxxxxxxxxxxxxxx> 2008-11-21
21:12:32 MST ---
To use dynamic hostname (ie, update it from DHCP, PPP, ...), set
DHCLIENT_SET_HOSTNAME=yes in /etc/sysconfig/network/dhcp.

I wouldn't want to do that, because of the warning in
/etc/sysconfig/network/dhcp:

# Should the DHCP client set the hostname? (yes|no)
#
# When it is likely that this would occur during a running X session,
# your DISPLAY variable could be screwed up and you won't be able to open
# new windows anymore, then this should be "no".

I am happy that my current hostname setting is sent automatically:

# By default the current hostname is sent ("AUTO"), if one is defined in
# /etc/HOSTNAME.
# Use this variable to override this with another hostname, or leave empty
# to not send a hostname.
#
DHCLIENT_HOSTNAME_OPTION="AUTO"

The difficulty here is that if I have changed my hostname with the 'hostname'
command, it won't have changed in /etc/HOSTNAME, as the command currently
works.

Fixed in beta5. I removed the hacks from
/etc/NetworkManager/nm-system-settings.conf and implemented monitoring of
/etc/HOSTNAME.

That's a good move as far as NetworkManager's configuration goes, but it
doesn't solve my problem.

Problem: hostname 'linux' persists despite attempts to rename it to something
else.

The issue is that no one tool available to the user changes the hostname in all
the places referenced by various programs:

1. /etc/HOSTNAME
2. /etc/hosts
3. /proc/sys/kernel/hostname

The 'hostname' command affects only /proc/sys/kernel/hostname. The remaining
two locations can be edited manually, but a re-boot is required to effect the
changes throughout the system (or alternatively, re-start the X-server and the
network service). This is not a suitable solution, especially for inexperienced
users.

The GUI tool (YaST-> Network Devices-> Network Settings) is able to change all
three locations, but when NetworkManager is in control, the user is warned off
using YaST for any purpose except changing the method to 'ifup'. For example,
the hostname settings are ghosted and can not be edited.

I have seen in bug #444967 the policy re changing network settings (that YaST
should not change network settings when NetworkManager is in control) and agree
with the logic. In an effort to provide a solution to this bug, I wrote a
simple script (attached) that could be used to change the hostname in those
three files listed above. It's not an acceptable long-term solution, but it
might save having to re-write YaST to counter NetworkManager's present
deficiency in time for a 11.1 release. Maybe all that would be needed is a
Release Note pointing users to the script (suggest /bin/change-hostname) if
they need to change the hostname following installation.

In this light, I request that this bug be re-opened, and my suggested
resolution be examined.


--
Configure bugmail: https://bugzilla.novell.com/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are on the CC list for the bug.

< Previous Next >
References