Bug 4608

Summary: Changed hostname not passed to kdm or Konsole
Product: Mageia Reporter: Doug Laidlaw <laidlaws>
Component: RPM PackagesAssignee: Mageia Bug Squad <bugsquad>
Status: RESOLVED FIXED QA Contact:
Severity: normal    
Priority: Normal CC: ftg, mageia
Version: Cauldron   
Target Milestone: ---   
Hardware: i586   
OS: Linux   
Whiteboard:
Source RPM: CVE:
Status comment:

Description Doug Laidlaw 2012-02-21 03:39:26 CET
Description of problem:  Hostname set at installation is showing in /etc/hosts but not in kdm or Konsole. Both have "localhost."  I notice that the "localhost" is now a separate line; it used to be "dougshost localhost"


Version-Release number of selected component (if applicable):


How reproducible:
  Any fresh installation of Cauldron from DVD.

Steps to Reproduce:
1. Run Mandriva-type installer
2. At Summary page, configure networking
3. At ethernet setup, set hostname other than localhost.localdomain
Comment 1 Bit Twister 2012-02-21 04:53:17 CET
You might want to check /etc/hostname. I noticed it was set differently depending on what/how you did what.  :(

Originally /etc/hostname was set so the node name would show up in log files like /var/log/messages after we were changed to systemd.

You might also notice /etc/hostname is not terminated with a new line, depending on what was done to set it. May depend on static/automatic selection in network setup. I run with a static setup and have customized /etc/hosts 
$ head -3 /etc/hosts
127.0.0.1 localhost
127.0.0.1 localhost.localdomain
192.168.1.132 wb.home.test wb

CC: (none) => junk_no_spam

Comment 2 Doug Laidlaw 2012-02-21 05:16:23 CET
Viewing /etc/hostname  with "less," it has the one word "localhost."  No IP address, and the info line is the next line, i.e. no newline.  I don't fully understand when newline is required, and may ask you elsewhere.  The rule I adopt is: if in doubt, put it in.

Debian-based distros used to set the hostname by editing /etc/hostname.  The file doesn't exist in my Mga 1, and AIRC, never did in Mandriva.
Comment 3 Bit Twister 2012-02-21 06:24:32 CET
(In reply to comment #2)
> Viewing /etc/hostname  with "less," it has the one word "localhost." 

Yup, and I suggest that is root cause for your problem.

> No IP address, 

Absolutely correct, node or FQDN.  man hostname and look under SET NAME

> and the info line is the next line, i.e. no newline.

I think that is a bug, but have not found where it has hurt anything yet.

>  I don't fully
> understand when newline is required, and may ask you elsewhere.  The rule I
> adopt is: if in doubt, put it in.

IIRC it always had a new line anywhere else /etc/hostname was used on systems which used it.


> Debian-based distros used to set the hostname by editing /etc/hostname.  The
> file doesn't exist in my Mga 1, and AIRC, never did in Mandriva.

You are absolutely correct. Mandriva 2011 running systemd does not need/use it to get the node name in logs. At the moment, /etc/hostname is the "solution" to getting the node name in logs. A bit of that history can be seen in bug 3665.

I placed my FQDN in /etc/hostname using the command 
   echo wb.home.test > /etc/hostname
That fixes the log problem and all applications wanting the node name are showing wb.
Comment 4 Frank Griffin 2012-02-21 12:35:01 CET
The hostname you set in drakconnect used to be set during ifup as a result of NEEDSHOSTNAME in the ifcfg file.  Presumably this is now done by NetworkManager, but NM had an early bug where the hostname was set to localhost because that was the value shipped in an NM conf file.  I don't know if this was ever fixed.

I noticed this because I set hostname via DHCP on eth0, which is not controlled by NM.  eth0 would come up, set the hostname from DHCP, and then NM would initialize and reset it even though it wasn't controlling any interfaces.

You might check syslog to see if NM is setting the hostname and when and to what.

CC: (none) => ftg

Comment 5 Doug Laidlaw 2012-02-21 13:05:46 CET
I set hostname via the dialog in the installer, which has DHCP settings as well. On my system I have an ethernet connection to an ADSL modem, so my connection is to eth0 as well.

I edited /etc/hostname until it was correct.  That solved it for me. It is up to the tech guys now to decide whether it is a bug or a feature.

A Debian forum discussed whether the FQDN should be included. The answer was: strictly, no, but one user found that it helped in some circumstances.
Comment 6 Doug Laidlaw 2012-02-21 13:11:11 CET
BTW, I am not a tech but a retired lawyer with a lot of experience "under the hood" of Linux.  I don't know what NM is, or why it is important.  At my age, having to tackle systemd, drakut and Grub 2 is like learning to drive a new OS.
Comment 7 Bit Twister 2012-02-21 14:28:15 CET
(In reply to comment #5)
 
> I edited /etc/hostname until it was correct.

FQDN?

>  That solved it for me. It is up
> to the tech guys now to decide whether it is a bug or a feature.

Yep, that is why I have not pushed very many problem reports.

> A Debian forum discussed whether the FQDN should be included. The answer was:
> strictly, no, but one user found that it helped in some circumstances.

I hear that, mysqld, postfix, sendmail, leafnode, dovecot,. to name a few who do like a FQDN.

In my stupid opinion, the installer sets HOSTNAME=what.ever in /etc/sysconfig/network and everything uses it until told otherwise. As a matter of fact, there is a "service" watching that file. You change the the hostname= and you can lose you GUI until you can get the xserver/desktop manager to know about the new name. :(

> I edited /etc/hostname until it was correct.

But that only hides/creates a problem for systems getting node/FQDN from dhcpd servers.  :(

(In reply to comment #6)
> At my age,having to tackle systemd, drakut and Grub 2 is like learning to drive a new OS.

Heheh, journald is just around the corner. 

(In reply to comment #6)
>Presumably this is now done by NetworkManager, but NM had an early bug where
> the hostname was set to localhost because that was the value shipped in an NM conf file. 

So there is where I saw /etc/hostname changed back to localhost after a bunch of updates. That was just plain rude.

Developers better make it an action item to get the resolution into one piece of code.

Cannot remember where I saw it, but disabling NM was a solution to some network bugs.
Comment 8 Doug Laidlaw 2012-02-21 15:17:42 CET
> >I edited /etc/hostname until it was correct.

> FQDN?

I put "dougshost" on line 1, the FQDN on Line 2 and "localhost" on line 3.  It now displays "dougshost" where it used to show "localhost."

> But that only hides/creates a problem for systems getting node/FQDN from dhcpd
> servers.  :(

Maybe, but as I said, I am not technical enough to work on the basic problem.

I do run Leafnode, but only under Mga 1. It demands a FQDN, and gets it O.K. in my everyday system.  The developer claims that with "localhost.localdomain," because it is not unique, posts can go astray, and users will blame his program.
Comment 9 Bit Twister 2012-02-21 16:21:08 CET
(In reply to comment #8)
> > >I edited /etc/hostname until it was correct.
> 
> > FQDN?
> 
> I put "dougshost" on line 1, the FQDN on Line 2 and "localhost" on line 3.  It
> now displays "dougshost" where it used to show "localhost."

I would recommend just 1 line. Just node or FQDN. I run with FQDN.
You might want to use hostname to set it and see what went into /etc/hostname.

> 
> I do run Leafnode, but only under Mga 1. It demands a FQDN, and gets it O.K. in
> my everyday system. 

Yep, there is a leafnode config keyword where you can set whatever FQDN you would like leafnode to use if you want it to ignore the node's FQDN.
Comment 10 Doug Laidlaw 2012-02-22 01:00:02 CET
I ran "sudo hostname" with my FQDN as argument.  That set my hostname to the FQDN, but made no change to /etc/hostname.  That file still had 3 lines, so I deleted the other two, leaving only the FQDN.  On rebooting, my FQDN appears at the top of KDM.

/etc/hosts now reads as follows:

# generated by drakhosts
127.0.0.1 dougshost2.douglaidlaw.net dougshost2
127.0.0.1 localhost 

That was how I left it after editing.

My standard prompt is "dougshost2" + current directory.
Comment 11 Marja Van Waes 2012-05-26 13:01:48 CEST
Hi,

This bug was filed against cauldron, but we do not have cauldron at the moment.

Please report whether this bug is still valid for Mageia 2.

Thanks :)

Cheers,
marja

Keywords: (none) => NEEDINFO

Comment 12 Doug Laidlaw 2012-05-26 13:15:42 CEST
I don't have a fresh installation of Mga 2, but I just used the RC to put Cauldron back.  The bug is NOT in evidence there.
Bit Twister 2012-05-26 15:44:11 CEST

CC: junk_no_spam => (none)

Comment 13 Doug Laidlaw 2012-06-03 06:40:52 CEST
I now have Mga 2 Official The problem has gone.

I am using 32-bit.  Many bugs that are fixed for me are still giving trouble to 64-bit users.  But from my point of view, this bug can be closed.
Sander Lepik 2012-06-03 09:01:36 CEST

CC: (none) => sander.lepik
Resolution: (none) => FIXED
Status: NEW => RESOLVED
Keywords: NEEDINFO => (none)