[BlueOnyx:24428] Re: strange issue vsite and hostname

Gerrit Haas Gerrit.Haas at blackpoint.de
Wed Oct 28 01:54:43 -05 2020


Good day,
running commands before updating:

[root at abc mail]# uname -a
Linux abc.def.net 3.10.0-1127.19.1.el7.x86_64 #1 SMP Tue Aug 25 17:23:54 UTC
2020 x86_64 x86_64 x86_64 GNU/Linux
[root at abc mail]# hostnamectl
   Static hostname: abc
Transient hostname: abc.def.net
         Icon name: computer-vm
           Chassis: vm
        Machine ID: 61a25cca94654edd804920d9823a9ebd
           Boot ID: 1b05084ebcbb4562a1f1c4697d54e43c
    Virtualization: vmware
  Operating System: CentOS Linux 7 (Core)
       CPE OS Name: cpe:/o:centos:centos:7
            Kernel: Linux 3.10.0-1127.19.1.el7.x86_64
      Architecture: x86-64
[root at abc mail]# nmcli g hostname
Error: NetworkManager is not running.

At this point I installed the updates and set the new hostname.

[root at abc mail]# hostname
abc.xyz.net
[root at abc mail]# nmcli g hostname
Error: NetworkManager is not running.
[root at abc mail]# hostnamectl
   Static hostname: abc
Transient hostname: abc.xyz.net
         Icon name: computer-vm
           Chassis: vm
        Machine ID: 61a25cca94654edd804920d9823a9ebd
           Boot ID: 1b05084ebcbb4562a1f1c4697d54e43c
    Virtualization: vmware
  Operating System: CentOS Linux 7 (Core)
       CPE OS Name: cpe:/o:centos:centos:7
            Kernel: Linux 3.10.0-1127.19.1.el7.x86_64
      Architecture: x86-64
[root at abc mail]# reboot
Hangup

Machine comes back up. 
Aaaand back to
abc.def.net


[root at abc ~]# hostname
abc.def.net
[root at abc ~]# hostnamectl
   Static hostname: abc
Transient hostname: abc.def.net
         Icon name: computer-vm
           Chassis: vm
        Machine ID: 61a25cca94654edd804920d9823a9ebd
           Boot ID: 9625f63cb4ff4adca2576623de1deca2
    Virtualization: vmware
  Operating System: CentOS Linux 7 (Core)
       CPE OS Name: cpe:/o:centos:centos:7
            Kernel: Linux 3.10.0-1127.19.1.el7.x86_64
      Architecture: x86-64


I think we need to fling way more shit on this one ;)
Thanks
Cheers
Gerrit


Mit freundlichen Grüßen aus Bad Vilbel 

Gerrit Haas 
Systemadministrator  

 
blackpoint GmbH – Friedberger Straße 106b – 61118 Bad Vilbel 

Tel.: +49 6101 65788 32 
IT-Support: +49 6101 65788 - 30 
Fax: +49 6101 65788 - 99
eMail: Gerrit.Haas at blackpoint.de
Tel. Rufbereitschaft (Außerhalb der Arbeitszeiten) +49 6101 65788 - 40 

Vertretungsberechtigt Dirk Estenfeld und Mario Di Rienzo HRB 50093 Frankfurt
am Main USt.-IdNr. de210106871 

Besuchen Sie uns im Internet unter www.blackpoint.de
Problemlos Domains registrieren: www.edns.de
Einfach und günstig Daten sichern: Veeam Cloud Connect


Confidentiality Notice: 
This e-mail message, including any attachments,is for the sole use of the
intended recipient(s) and may contain confidential and privileged
information. Any unauthorized review, use, disclosure or distribution is
prohibited. If you are not the intended recipient, please contact the sender
by reply e-mail and destroy all copies of the original message. 

-----Ursprüngliche Nachricht-----
Von: Blueonyx <blueonyx-bounces at mail.blueonyx.it> Im Auftrag von Michael
Stauber
Gesendet: Dienstag, 27. Oktober 2020 23:31
An: blueonyx at mail.blueonyx.it
Betreff: [BlueOnyx:24425] Re: strange issue vsite and hostname

Hi Gerrit,

> From our documentation, the hostname *should* be abc.xyz.net.
> On the server exists a vsite abc.def.net that is actually the same as 
> the hostname.
> I did not expect this to actually work. We do not know, how it got there.
> (Bug, Customer changed it,...)

Yeah, this sure causes problems.

> We tried changing the hostname back to abc.xyz.net. This works in the 
> first place, but after a reboot of the machine hostname abc.def.net is
back.
> Also it seems that the old name still resides in some configuration 
> files in /etc (admserv, hosts, ...)

On reboot the CCE constructor /usr/sausalito/constructor/base/system
uses the Perl module Sys::Hostname::FQDN to determine the servers host and
domain name this way:

($name,$aliases,$addrtype,$length, at addrs)=gethostinfo();
$myhost = short();
$fqdn = fqdn();
@hlist = split(/\s/, $aliases) ;
foreach $line (@hlist) {
    if ($line =~ m/^$myhost\.(.*)$/ig ) {
        unless (($line =~ m/localhost/ig) || ($line =~ m/localdomain/ig)) {
            $fqdn = $line;
        }
    }
}
$mydomain = $fqdn;
$mydomain =~ s/^$myhost\.//;

if ( $myhost eq "" ) {
    $myhost = "localhost";
}
if ( $mydomain eq "" ) {
    $mydomain = "localdomain";
}

So we end up with either the real host and domain name, or
"localdomain.localhost".

To see what the system has stored in regards to the host and domain name you
can use these three commands:

uname -a
hostnamectl
nmcli g hostname

This info is then inserted into CODB and a handler runs the required
commands to tell the system its new name.

HOWEVER: CentOS 7 and CentOS 8 are a bit unique there. In the past the
"hostname" command was sufficient to set a new hostname. But with the
introduction of "static", "transient" and "pretty" hostnames (which can all
be somewhat different from each other) things got messy and just using
"hostname" to set the hostname doesn't stick all that well.

I just published YUM updates for 5209R and 5210R that now use *all* the
bloody methods with which one can set the hostname in the hope that if we
fling enough shit, some will eventually keep sticking to the wall.

Here are the commands that we're using for that:

/bin/hostname $fqdn
/usr/bin/hostnamectl set-hostname $fqdn
/usr/bin/hostnamectl set-hostname $fqdn --static /usr/bin/hostnamectl
set-hostname $fqdn --transient /usr/bin/nmcli g hostname $fqdn
/usr/bin/systemctl restart systemd-hostnamed

But like said: Do a "yum clean all" and "yum update" and then once you
change the hostname via the GUI it should finally stick even through
reboots.

--
With best regards

Michael Stauber
_______________________________________________
Blueonyx mailing list
Blueonyx at mail.blueonyx.it
http://mail.blueonyx.it/mailman/listinfo/blueonyx
-------------- next part --------------
A non-text attachment was scrubbed...
Name: smime.p7s
Type: application/pkcs7-signature
Size: 5537 bytes
Desc: not available
URL: <http://mail.blueonyx.it/pipermail/blueonyx/attachments/20201028/0af307a9/attachment.p7s>


More information about the Blueonyx mailing list