OS 12.3 - Question about hostname, HOSTNAME, and so on

Hello.
During install, my box receive the hostname : ‘linux-cc07’.

I am playing with my system configuration and I have some questions.

1°)
yast2/network-settings/Network-Card-setup/Address show Hostname as srv-hostname

2°)
I ran the following command :

hostnamectl  --static  set-hostname  "hostname-1"
hostnamectl  --transient  set-hostname  "hostname-2"
hostnamectl  --pretty  set-hostname  "hostname-3"
systemctl restart network.service

No reboot after modification (just run systemctl restart network.service as stated.

Running konsole, the hostname is shown as : hostname-2 (transiant)
uname -n return : hostname-2
echo $HOST return : linux-cc07

hostname-2:~ # echo $HOSTNAME
linux-cc07
hostname-2:~ # uname -n
hostname-2
hostname-2:~ # echo $HOST
linux-cc07
hostname-2:~ # hostname
hostname-2
hostname-2:~ # 

Where is store hostname string from yast2.
Why the value is not in use.

Where is store the string hostname : ‘linux-cc07’ as I don’t found it.

Where is store the transiant hostname string : ‘hostname-2’ as I don’t found it.

From where HOST variable is filled from.

Any help is welcome.

On Tue 07 Apr 2015 11:36:01 AM CDT, jcdole wrote:

Hello.
During install, my box receive the hostname : ‘linux-cc07’.

I am playing with my system configuration and I have some questions.

1°)
yast2/network-settings/Network-Card-setup/Address show Hostname as
srv-hostname

2°)
I ran the following command :

Code:

hostnamectl --static set-hostname “hostname-1”
hostnamectl --transient set-hostname “hostname-2”
hostnamectl --pretty set-hostname “hostname-3”
systemctl restart network.service


No reboot after modification (just run systemctl restart network.service
as stated.

Running konsole, the hostname is shown as : hostname-2 (transiant)
uname -n return : hostname-2
echo $HOST return : linux-cc07

Code:

hostname-2:~ # echo $HOSTNAME
linux-cc07
hostname-2:~ # uname -n
hostname-2
hostname-2:~ # echo $HOST
linux-cc07
hostname-2:~ # hostname
hostname-2
hostname-2:~ #


Where is store hostname string from yast2.
Why the value is not in use.

Where is store the string hostname : ‘linux-cc07’ as I don’t found it.

Where is store the transiant hostname string : ‘hostname-2’ as I don’t
found it.

From where HOST variable is filled from.

Any help is welcome.

Hi
It’s stored in the environment ($SOME_VAR) for the current session, use
env command to see them all. Logout of the root console session and log
back in…


Cheers Malcolm °¿° LFCS, SUSE Knowledge Partner (Linux Counter #276890)
SUSE Linux Enterprise Desktop 12 GNOME 3.10.1 Kernel 3.12.39-47-default
If you find this post helpful and are logged into the web interface,
please show your appreciation and click on the star below… Thanks!

It is not really my question.
Based on starting my thread, I have search for string “'linux-cc07” and never found it.
I have search for string “srv-hostname” and never found it.
So where are set all these data.
Where and is set HOST variable
Where are set variables from these command :

hostnamectl  --static  set-hostname  "hostname-1"
hostnamectl  --transient  set-hostname  "hostname-2"
hostnamectl  --pretty  set-hostname  "hostname-3"

Any help is welcome

Hi
You set it via YaST as you discovered.

If you run;


env | grep HOST

Should show you some, then there is the hosts file and postifx main.cf. YaST propogates to all the right places…

The hostnamectl command is part of systemd it just collects data stored in udev’s hwdb AFAIK.

On 2015-04-07 20:26, jcdole wrote:
> So where are set all these data.

Should be “/etc/HOSTNAME”. There was talk about using “/etc/hostname”
instead, but as SUSE has used the uppercase version for decades, maybe
there is a symlink now in 13.2.


Cheers / Saludos,

Carlos E. R.

(from 13.1 x86_64 “Bottle” (Minas Tirith))

What I have discovered, is :

  • removing /etc/HOSTNAME
  • removing /etc/hostname
  • giving a hostname with yast2
  • setting different hostnames with the command ‘hostnamectl --static, --transient, --pretty’
  • restarting the network with systemctl

Is not sufficient to emerge some new datas ( env HOST keep old data ) : you must reboot.

I know that. This is the reason why I removed /etc/hostname and the link ( /etc/HOSTNAME ).
So ,where are my datas ?

Hello.
Anyway it is not so important.

Thank you very much every body for taking time to read me.

On 2015-04-08 00:06, jcdole wrote:

> I know that. This is the reason why I removed /etc/hostname and the link
> ( /etc/HOSTNAME ).

And you expect things to work?

Restore the file and the link.


Cheers / Saludos,

Carlos E. R.

(from 13.1 x86_64 “Bottle” (Minas Tirith))

The easiest way to change the name is to do it in Yast.

Removing the HOSTNAME and hostname files will undoubtedly break things.

I know that.
But my goal was to find out where does come from the current hostname

At this moment I was just trying to find out where does come from the current hostname. Nothing more.
[LEFT]
[/LEFT]

You probably get the name assigned from your router/DHCP server.

As the installer configured that name, your computer then told the name to the router/DHCP server, which might have remembered it.

To get rid of that, either configure your router/DHCP server to assign you a different host name, or disable the option “Change Hostname via DHCP” in YaST->Network Devices->Network Settings->Hostname/DNS.