You are not logged in.

#1 2016-06-04 17:43:58

daivolt
Member
Registered: 2016-06-04
Posts: 5

[solved] Static hostname changed by nm-applet

Hi
Yes, I'm very very newbie

I configured my hostnamectl with --static option because there's a problem each time that nm-appelt connect to a network. Because trasient hostname always messing with my X apps.

But today I wake up my system and XFCE didn't start. After checking my hostname in command line, it appers to be named "dhcppc64"

Then I typed again > hostnamectl set hostname --static localhost

and then too> hostname localhost

after that I killed my lightdm and restarted X and I was able to enter my XFCE desktop

but if nm-applet connect to a network it changes my hostname again to "dhcppc64" then my hostnamectl didn't take any effect

Where is the problem? In hostnamectl or nm-applet?

Thank you for your patience

Last edited by daivolt (2016-06-05 06:16:16)

Offline

#2 2016-06-04 17:50:21

x33a
Forum Fellow
Registered: 2009-08-15
Posts: 4,587

Re: [solved] Static hostname changed by nm-applet

Mod note: Moving to "Networking, server and protection".

Offline

#3 2016-06-04 18:10:24

loqs
Member
Registered: 2014-03-06
Posts: 17,320

Re: [solved] Static hostname changed by nm-applet

man hostnamectl wrote:

If a static hostname is set, and is valid (something other than localhost), then the transient hostname is not used.

Offline

#4 2016-06-04 18:46:07

daivolt
Member
Registered: 2016-06-04
Posts: 5

Re: [solved] Static hostname changed by nm-applet

If I change something other than localhost (ex: localhost.localdomain) what happens is that each time e run a app I get for example:

"Invalid MIT-MAGIC-COOKIE-1 keyQXcbConnection: Could not connect to display :0.0"

I really don't understand why is recommended to have configured "localhost.localdomain" in /etc/hosts, and why my system only works with "localhost" configured with hostname command. My $DISPLAY variable always is ":0.0"

In other distros this never happens, why a transient hostname changing by some app

Offline

#5 2016-06-04 19:04:29

loqs
Member
Registered: 2014-03-06
Posts: 17,320

Re: [solved] Static hostname changed by nm-applet

daivolt wrote:

If I change something other than localhost (ex: localhost.localdomain) what happens is that each time e run a app I get for example:

"Invalid MIT-MAGIC-COOKIE-1 keyQXcbConnection: Could not connect to display :0.0"

Did you change the hostname while the X server was running and not restart it?

Offline

#6 2016-06-04 19:23:38

daivolt
Member
Registered: 2016-06-04
Posts: 5

Re: [solved] Static hostname changed by nm-applet

Yes. Good point
Changed my hostname and restarted solved the problem

But my hostname still is localhost

Last edited by daivolt (2016-06-04 19:24:44)

Offline

#7 2016-06-04 20:17:17

loqs
Member
Registered: 2014-03-06
Posts: 17,320

Re: [solved] Static hostname changed by nm-applet

daivolt wrote:

But my hostname still is localhost

You do not say what you expect it to be.  If you are referencing

daivolt wrote:

If I change something other than localhost (ex: localhost.localdomain) what happens is that each time e run a app I get for example

localhost.localdomain is the hostname localhost followed by the domainname seperator "." followed by the domainname localdomain.
So the hostname part of that string is localhost.

Offline

#8 2016-06-04 20:53:19

daivolt
Member
Registered: 2016-06-04
Posts: 5

Re: [solved] Static hostname changed by nm-applet

Thank you loqs for your support but I'm not going anywhere.

sometimes my hostname is localhost when I typed hostname command, sometimes it is localhost.localdomain and previusly it was dhcppc64. Until now is "localhost.localdomain" and then I have that problem with Apps that doesn't connect to X server.

All the time I need to set hostname to "localhost" manually, even though I set my system with static hostname. I supossed that static hostname doesn't change, but I think I must be wrong

But thank you

Last edited by daivolt (2016-06-04 21:01:28)

Offline

#9 2016-06-04 21:28:53

loqs
Member
Registered: 2014-03-06
Posts: 17,320

Re: [solved] Static hostname changed by nm-applet

daivolt wrote:

Thank you loqs for your support but I'm not going anywhere.

Let me try one last time to explain.

daivolt wrote:

All the time I need to set hostname to "localhost" manually, even though I set my system with static hostname. I supossed that static hostname doesn't change, but I think I must be wrong

From my first post in this thread

loqs wrote:
man hostnamectl wrote:

If a static hostname is set, and is valid (something other than localhost), then the transient hostname is not used.

So localhost is not a valid static hostname.  So the transient hostname will be used.

daivolt wrote:

sometimes my hostname is localhost when I typed hostname command, sometimes it is localhost.localdomain and previusly it was dhcppc64. Until now is "localhost.localdomain" and then I have that problem with Apps that doesn't connect to X server.

It would appear that when you you connect to the network you receive a transient hostname of dhcppc64 this is used instead of the static hostname because the static hostname is set to the invalid value of localhost.
The X server issue then occurs because the hostname has been changed from the invalid static hostname of localhost to the transient hostname of dhcppc64.
If you set the static hostname to a valid value not so not localhost or localhost.localdomain then the transient hostname should stop being used.
Note because setting the static hostname to a valid value will change the hostname the X server will need to be restarted to allow connections.

Offline

#10 2016-06-04 22:33:03

daivolt
Member
Registered: 2016-06-04
Posts: 5

Re: [solved] Static hostname changed by nm-applet

You're rigth.

Trying to set hostname static first time for some reason let dhcppc64 as hostname and I was thinking that it was static, but no
Sencond time when I changed it to "daivolt" I miss that it was alerady transient, then it changed to localhost again automatically.
Now I tried one more time and now is all ok

Thanks

Last edited by daivolt (2016-06-04 22:33:43)

Offline

#11 2016-06-05 04:21:18

x33a
Forum Fellow
Registered: 2009-08-15
Posts: 4,587

Re: [solved] Static hostname changed by nm-applet

Please mark the thread as solved by editing your first post and prepending [solved] to the title.

Offline

Board footer

Powered by FluxBB