Description of problem: /var/log/messages has localhost instead of hostname alias Dec 7 16:51:14 localhost logger: Shorewall started Dec 7 16:51:14 localhost shorewall[2373]: done. # hostname --alias wb2 # grep $(hostname --alias) /etc/hosts 192.168.1.100 wb2.home.test wb2 # hostname --ip-address 192.168.1.100 Version-Release number of selected component (if applicable): How reproducible: Always Steps to Reproduce: 1. add space 3 to end kernel line in /boot/grub/menu.lst 2. reboot 3. tail -4 /var/log/messages Hit Left windows key until you find a Login: prompt
Hi, thanks for reporting this bug. As there is no maintainer for this package I added the committers in CC.
CC: (none) => ahmadsamir3891, arnaud.patard, dmorganec, guillomovitch, mageia, mageia, mageia, misc
Quick question, does installing: nss-myhostname fix this issue?
Also does kill -HUP rsyslog fix it up too? (I'm wondering if it just reads the hostname when it's started and doesn't poll for hostname changes)
(In reply to comment #2) > Quick question, does installing: nss-myhostname fix this issue? Not really. # urpmi nss-myhostname Package nss-myhostname-0.3-1.mga2.x86_64 is already installed Marking nss-myhostname as manually installed, it won't be auto-orphaned writing /var/lib/rpm/installed-through-deps.list (In reply to comment #3) > Also does kill -HUP rsyslog fix it up too? # kill -SIGHUP $(cat /var/run/rsyslogd.pid) # tail -1 /var/log/messages Dec 8 14:22:26 localhost rsyslogd: [origin software="rsyslogd" swVersion="5.8.6" x-pid="1265" x-info="http://www.rsyslog.com"] rsyslogd was HUPed # systemctl stop smb.service tail -3 /var/log/messages Dec 8 14:24:19 localhost smbd[2838]: failed to retrieve printer list: NT_STATUS_UNSUCCESSFUL Dec 8 14:25:07 localhost smb[4039]: Shutting down SMB services: [ OK ] Dec 8 14:25:07 localhost smb[4039]: Shutting down NMB services: [FAILED]
(In reply to comment #3) > Also does kill -HUP rsyslog fix it up too? > > (I'm wondering if it just reads the hostname when it's started and doesn't poll > for hostname changes) I would have thought it would read /etc/sysconfig/network for hostname. If not set, check /etc/hostname, maybe /etc/host. When the network comes up dhcp client could change the name. I will have to change /etc/hostname back to installed value to see if my change is causing the problem. $ head -4 /etc/hosts # generated by drakconnect 127.0.0.1 localhost 127.0.0.1 localhost.localdomain 192.168.1.100 wb2.home.test wb2 I am currently rebuilding the system.
I just checked my Mandriva Linux 2011 log. It has the hostname alias and format of /etc/hosts is the same. Same file actually. Problem is not my /etc/hosts file. What is different is I have named running on 2011 and have not been back to reinstalling all my changes.
It checks /etc/hostname first. If it's set that will be the hostname used, but this is the init system, not rsyslog itself. rsyslog just uses the glibc gethostname() fucntion to get the hostname. It should however be informed somehow that the hostname has changed... I reckon a "killall -HUP rsyslog" would likely make it reinit itself, but not sure if there is another mechanism that we should employ to do that automagically.
I've noticed this for a long time, but didn't test as thoroughly as Bit Twister. I assumed that it occurred as a result of the old speedboot thing of not having services wait for the network to come up, e.g. DMs coming up with "localhost" because the processing of a DHCP-returned hostname had not yet happened. But you're right, a re-init should fix it, and better still there should be a hostname-changed event. Even better, syslog should cache until network-up and then fetch the hostname to be used on all of the cached lines, because otherwise apps that post-process syslog can't rely on the hostname as valid.
CC: (none) => ftg
(In reply to comment #8) > But you're right, a re-init should fix it, and better still there should be a > hostname-changed event. Even better, syslog should cache until network-up and > then fetch the hostname to be used on all of the cached lines, because > otherwise apps that post-process syslog can't rely on the hostname as valid. Looking at Mandriva 2011, they appeared to have cached original text to console and waited until system got into the network setup. $ cat /var/log/messages Dec 10 10:10:50 wb NetworkManager[2238]: <info> caught signal 15, shutting down normally. Dec 10 10:10:50 wb NetworkManager[2238]: <warn> quit request received, terminating... Dec 10 10:10:50 wb kernel: Kernel logging (proc) stopped. Dec 10 10:10:50 wb rsyslogd: [origin software="rsyslogd" swVersion="5.8.5" x-pid="2306" x-info="http://www.rsyslog.com"] exiting on signal 15. Dec 10 10:11:49 wb kernel: imklog 5.8.5, log source = /proc/kmsg started. Dec 10 10:11:49 wb rsyslogd: [origin software="rsyslogd" swVersion="5.8.5" x-pid="2295" x-info="http://www.rsyslog.com"] start Dec 10 10:11:48 wb shorewall[1986]: Starting Shorewall.... <snip more shorewall messages> Then we get the console text pushed in Dec 10 10:11:49 wb kernel: Initializing cgroup subsys cpuset Dec 10 10:11:48 wb shorewall[1986]: Running /sbin/iptables-restore... Dec 10 10:11:49 wb kernel: Initializing cgroup subsys cpu Dec 10 10:11:49 wb kernel: Linux version 2.6.38.7-desktop-1mnb2 (thomas@celeste.mandriva.com) (gcc version 4.6.0 20110513 (prerelease) (GCC) ) #1 SMP Sun May 22 19:38:58 UTC 2011 Dec 10 10:11:49 wb kernel: Command line: BOOT_IMAGE=md2011_0_64 root=LABEL=cooker nokmsboot vga=0x0324 3 Dec 10 10:11:49 wb kernel: BIOS-provided physical RAM map: Dec 10 10:11:49 wb kernel: BIOS-e820: 0000000000000000 - 0000000000098c00 (usable)
clean install, applied updates, rebooted. /var/log/messages has node name.
Status: NEW => RESOLVEDResolution: (none) => FIXED
Third system I did a clean install on has localhost instead of node name. :( Other two clean installs has node name. Other than actual hardware, the only difference between the third box is mysqld is running and eth1 is connected to a hub/switch. # diff ifcfg-eth0 ifcfg-eth1 1c1 < DEVICE=eth0 --- > DEVICE=eth1 3c3 < IPADDR=192.168.1.200 --- > IPADDR=169.254.1.1 5c5 < GATEWAY=192.168.1.1 --- > GATEWAY=192.168.1.200 16d15 < NM_CONTROLLED=no 17a17 > PEERDNS=no
Resolution: FIXED => (none)Status: RESOLVED => REOPENED
What is the content of /etc/hostname on the affected machine?
(In reply to comment #12) > What is the content of /etc/hostname on the affected machine? All three machines have localhost in /etc/hostname. Which I did not set that I know of. All systems have same /etc/hosts file and except for HOSTNAME all /etc/sysconfig/network looks like: # cat /etc/sysconfig/network GATEWAYDEV=eth0 GATEWAY=192.168.1.1 NEEDHOSTNAME=no NETWORKING=yes HOSTNAME=mtv.home.test CRDA_DOMAIN=US # host $(hostname) mtv.home.test has address 192.168.1.200 # head -5 /etc/hosts 127.0.0.1 localhost 127.0.0.1 localhost.localdomain 192.168.1.100 wb2.home.test wb2 192.168.1.200 mtv.home.test mtv 192.168.1.132 wb.home.test wb Frap, just booted wb2. and it is back to localhost in /var/log/messages.
(In reply to comment #13) > (In reply to comment #12) > > What is the content of /etc/hostname on the affected machine? > > All three machines have localhost in /etc/hostname. Which I did not set that I > know of. > Frap, just booted wb2. and it is back to localhost in /var/log/messages. Sorry, lost control of my mouse because ksmserver crashed. removed /etc/hostname, rebooted and /var/log/messages has node name instead of localhost. I remember disabling dhcpd on wb2 to see if that caused the problem on wb2, but it was ok. I re-enabled dhcpd and powered off. On wb only thing I did was delete the wan0 connection in via mcc and rebooted. Just checked in my VirtualBox guest. /etc/hostname was set localhost. Removed it, rebooted, and it is fine.
CC: guillomovitch => (none)
You shouldn't really remove this file, but rather "echo myhostname >/etc/hostname"... it's basically the new "standard" (i.e. cross distro) place to keep hostname configuration, but clearly various tools of ours do not update that file when updating the hostname in other places. So likely this is fundamentally a drakxtools bug in some capacity. I'll try and dig into where we update hostname in the old place and make sure the new one is updated too!
(In reply to comment #15) > > So likely this is fundamentally a drakxtools bug in some capacity. I'll try and > dig into where we update hostname in the old place and make sure the new one is > updated too! probably related to: https://bugs.mageia.org/show_bug.cgi?id=2983 https://bugs.mageia.org/show_bug.cgi?id=2983#c12 I attached a patch that still need to be reviewed. https://bugs.mageia.org/attachment.cgi?id=1143&action=diff
Hardware: x86_64 => AllCC: (none) => lmenut
(In reply to comment #16) > (In reply to comment #15) > > > > So likely this is fundamentally a drakxtools bug in some capacity. I'll try and > > dig into where we update hostname in the old place and make sure the new one is > > updated too! > > probably related to: > https://bugs.mageia.org/show_bug.cgi?id=2983 > https://bugs.mageia.org/show_bug.cgi?id=2983#c12 > > I attached a patch that still need to be reviewed. > https://bugs.mageia.org/attachment.cgi?id=1143&action=diff Yup, certainly related... I've actually just written a very similar patch... but a bit different. Will merge your one in too. I'm gonna mark this as a duplicate of that other bug, but feel free to comment on this one again if needs be. *** This bug has been marked as a duplicate of bug 2983 ***
Resolution: (none) => DUPLICATEStatus: REOPENED => RESOLVED