Page 1 of 3 123 LastLast
Results 1 to 10 of 21

Thread: two different host names?

  1. #1

    Question two different host names?

    My DHCP client is sending DHCPREQUEST packets with OPTION: 12 ( 10) Host name set to the original hostname generated automatically during installation, and not to the current user-friendly hostname reset using Yast -> Network Settings.

    This means that my local DNS server (router dnsmasq) has the wrong name for my PC and reverse lookups by other network devices (eg reporting previous logins) show and log the wrong name.

    Yast has updated /etc/HOSTNAME and the hostname string in all files that I can scan with grep (recursively from the filesystem root as superuser). I can find no remaining instance of the old hostname. I have rebooted (several times).

    My single network interface is managed by wicked; I believe that dhclient is not used.

    So where is wicked getting the old hostname from? And how do I reset it?


    Maybe I should report this as a bug, but I thought I'd ask here first. This issue seems similar to the recent thread 'Leap 42.3: twee verschillende hostnamen?' in the Dutch forum. Hopefully this forum will give larger exposure to the issue.

  2. #2

    Default Re: two different host names?

    It is possible for multiple hostname to be specified in Yast; Run the
    following:

    Code:
    sudo /sbin/yast lan
    Once in there look both under the 'Hostname/DNS tab, as well as under the
    network interface cards (NIC) under Overview. Perhaps one of those has a
    static hostname while the other is using another one.

    --
    Good luck.

    If you find this post helpful and are logged into the web interface,
    show your appreciation and click on the star below.

    If you want to send me a private message, please let me know in the
    forum as I do not use the web interface often.

  3. #3
    Join Date
    Jun 2008
    Location
    Netherlands
    Posts
    29,742

    Default Re: two different host names?

    Maybe it should be added that it is almost impossible now to set the wanted network parameter hostname to an installation. The former "No automatic configuration" checkbox is gone. The result is IP addresses, hostname, router and all that set to the whim of the installer.

    Of course one can change all that after installation (not that that is seen as a good solution by many ), but when it now becomes impossible to set the hostname to ones liking there is a more serious problem IMHO.
    Henk van Velden

  4. #4

    Default Re: two different host names?

    After writing the above, I have found a work-around:


    1. Yast -> Network Settings: set Hostname via DHCP = yes (formerly, no)
    2. In DHCP server: set static DHCP address for my MAC address with the new hostname and a short expiry time
    3. Cycle my network interface down/up, to force renewal of DHCP lease


    This does change the hostname to the new value everywhere (including after reboot). Then:


    1. Wait for several DHCP expiry lifetimes.
    2. Reset Yast -> Network Settings: set Hostname via DHCP = no
    3. In DHCP server: remove static DHCP address for my MAC address
    4. Cycle my network interface down/up, to force renewal of DHCP lease


    The new hostname now persists.

    So presumably wicked was reusing the old hostname from the DHCP lease, which had not been reset by Yast. This seems to me to be more like a bug.

    All thoughts will be very welcome.

  5. #5
    Join Date
    Jun 2008
    Location
    Netherlands
    Posts
    29,742

    Default Re: two different host names?

    Quote Originally Posted by ab View Post
    It is possible for multiple hostname to be specified in Yast; Run the
    following:

    Code:
    sudo /sbin/yast lan
    Once in there look both under the 'Hostname/DNS tab, as well as under the
    network interface cards (NIC) under Overview. Perhaps one of those has a
    static hostname while the other is using another one.

    --
    Good luck.

    If you find this post helpful and are logged into the web interface,
    show your appreciation and click on the star below.

    If you want to send me a private message, please let me know in the
    forum as I do not use the web interface often.
    The information in this thread is not complete I am afraid. There is some more in the Dutch thread.

    The Dutch OP states that changing the hostname using YaST (something that is advised here often) worked as intended in 42.2. But that it doesn't in 42.3

    Thus the case is that the "normal" way to do this is known, but in 42.3 it does not work anymore.

    I promised to check this (I have a 42.2 system here and want to update it to 42.3, thus I hope I can recreate the problem and document it), but lacked the time until now.

    BTW the Dutch OP solved this by reinstalling with a pulled out network cable. That seems to be the only way to switch the installer to ask for network parameters (including hostname) and thus to configure them to one's needs.
    This is mentioned in other threads here on the forum. A nasty and ugly way to get your system up and running, but the only one known now.
    Henk van Velden

  6. #6

    Default Re: two different host names?

    Quote Originally Posted by ab View Post
    It is possible for multiple hostname to be specified in Yast; Run the
    following:

    Code:
    sudo /sbin/yast lan
    Once in there look both under the 'Hostname/DNS tab, as well as under the
    network interface cards (NIC) under Overview. Perhaps one of those has a
    static hostname while the other is using another one.
    .

    'yast lan' gives me the same panel in a text-console GUI, as Yast[2] -> Network Settings which I mentioned above. All hostname fields were set correctly to the new hostname, including Yast -> Network Settings -> Global Options -> DHCP Client options -> Hostname to Send, for Wicked Service. But wicked still used the old hostname.

    Thanks for the thought, ab.

  7. #7
    Join Date
    Jun 2008
    Location
    Auckland, NZ
    Posts
    23,698
    Blog Entries
    1

    Default Re: two different host names?

    Hmmm....I'm not currently using wicked but I found a historic bug report where similar unwanted behaviour was mentioned for openSUSE 13.2. Comment #2 is pertinent - In /etc/wicked/extensions/hostname there is code that assumes rcsyslog command is present. I show what is contained in /etc/wicked/extenisons/hostname for openSUSE 42.3.....

    Code:
    if test -s "$defaulthostname" ; then
                    def_hostname=`get_default_hostname`
                    curr_hostname=`get_current_hostname`
                    if test "X${def_hostname}" != "X" -a "X${curr_hostname}" != "X${def_hostname}" ; then
                            /bin/hostname "${def_hostname}" ; rc=$?
    
                            rcsyslog reload &>/dev/null
                    fi
            fi
            exit $rc
    Now, of course on my system rcsyslog (syslog-service package) was missing.....could that be the OP's issue here perhaps? Apologies if on the wrong track.
    Last edited by deano_ferrari; 20-Aug-2017 at 16:43.

  8. #8
    Join Date
    Jun 2008
    Location
    Auckland, NZ
    Posts
    23,698
    Blog Entries
    1

    Default Re: two different host names?

    Scrub that - post #5 sums up...
    Agree with you guys that `rcsyslog restart` is causing the error message.
    To address the error message, we've put together:
    https://github.com/openSUSE/wicked/pull/481

    However, at the point of the reported error, /bin/hostname would have
    already been called and the hostname set from the Wicked extension. So it
    looks like there's a bit more happening here with respect to the interaction
    between Wicked and YaST2/lan.
    Now, if the interface for which this is occurring is configured via DHCP,
    the restart of Wicked will request a new DHCP lease. Depending on DHCP
    server configuration, the client requested hostname (/etc/hostname) may not
    be returned in the response from the server, and thus a different, server
    supplied hostname will be applied to the system by Wicked. /etc/hostname will
    still contain the YaST2/lan version, while /bin/hostname will report what
    Wicked actually set in response to the updated lease.
    Another regression?

  9. #9

    Default Re: two different host names?

    Are you using Btrfs for your filesystem for everything? Care to snapshot
    the before/after your fix to see where the files that are changing reside,
    and how they differ? That can b ea big task, but I've used snapshots a
    few times to figure out these very kinds of "what really changed, blast
    you?" types of questions.


    --
    Good luck.

    If you find this post helpful and are logged into the web interface,
    show your appreciation and click on the star below.

    If you want to send me a private message, please let me know in the
    forum as I do not use the web interface often.

  10. #10

    Default Re: two different host names?

    Quote Originally Posted by deano_ferrari View Post
    Scrub that - post #5 sums up...

    Another regression?
    Seems like it. I don't have syslog.service or rcsyslog installed either, but I wouldn't expect to because Leap 42.3 uses systemd journal. I do have the same /etc/wicked/extensions/hostname script and I'm surprised to see the calls to rcsyslog in it. Clearly these won't help.

    My systemd journal entries show a systemd hostname service (org.freedesktop.hostname1', and several systemd 'set hostname' commands. It is not clear to me whether these commands were issued by yast or by wicked.

    The wiki at www.freedesktop.org describes plenty of room for hostname duplication:

    systemd 25 and newer include systemd-hostnamed. This is a tiny daemon that can be used to control the host name and related machine meta data from user programs. It currently offers access to five variables:

    The current host name (Example: dhcp-192-168-47-11)
    The static (configured) host name (Example: lennarts-computer)
    The pretty host name (Example: Lennart's Computer)
    A suitable icon name for the local host (Example: computer-laptop)
    A chassis type (Example: "tablet")

    See systemd-hostnamed.service(8) for more information.

    The daemon is accessible via D-Bus:

    $ gdbus introspect --system --dest org.freedesktop.hostname1 --object-path /org/freedesktop/hostname1

    ........
    The gdbus command on my system is showing the correct hostname.

    However, the bash 'hostname' command also returned the updated host name correctly.

Page 1 of 3 123 LastLast

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •