50

dmesg shows the line

systemd-hostnamed[3964]: Warning: nss-myhostname is not installed. 
Changing the local hostname might make it unresolveable. Please install nss-myhostname!    

But

sudo apt-get install nss-myhostname

says

Paketlisten werden gelesen... Fertig
Abhängigkeitsbaum wird aufgebaut.       
Statusinformationen werden eingelesen.... Fertig
E: Paket nss-myhostname kann nicht gefunden werden.

...meaning "nss-myhostname not found".

Why? Do I have to react on the dmesg message?

2
  • 1
    Does the warning continue after sudo apt-get libnss-myhostname? – jobin Apr 22 '14 at 18:27
  • 1
    I've the same alarm on ubuntu 14.10 desktop edition and after to install that package I don't see that any more – Riccardo Magrini Mar 24 '15 at 10:35
30

There is a confirmed bug logged against systemd-hostnamed saying;

Since nss-myhostname was rejected as being the right approach in https://bugs.launchpad.net/ubuntu/+source/libnss-myhostname/+bug/1162478/comments/6 , we should not print the warning message in the LTS release, even if hostnamed doesn't currently modify /etc/hosts.

Can we please patch this warning out to prevent users from thinking something is wrong on their system and leading them to install libnss-myhostname?.

Even though it may avoid the warning, you may not want to install libnss-myhostname for that purpose only.

Any body seeing the message

 systemd-hostnamed
[16495]: Warning: nss-myhostname is not installed. Changing the local hostname might make it unresolveable. Please install nss-myhostname!

must read this https://bugs.launchpad.net/ubuntu/+source/systemd/+bug/1277608 this https://bugs.launchpad.net/ubuntu/+source/libnss-myhostname/+bug/1162478/comments/6 before installing the nss-myhostname package.

2
  • 1
    so I shouldn't do anything? – Mina Michael May 28 '16 at 16:54
  • As well as the above linked discussions, I would strongly suggest anyone considering installing libnss-myhostname also read this Debian bug report against exim4 that was eventually discovered to have been caused by libnss-myhostname subtly misconfiguring name services in a way that cause exim to fail to deliver local mail. You do not want this package on your system. – Jules Sep 13 '17 at 17:58
27

From here:

nss-myhostname is a plugin for the GNU Name Service Switch (NSS) functionality of the GNU C Library (glibc) providing hostname resolution for the locally configured system hostname as returned by gethostname(2) There are two possible solutions:

  • You may have not (or incorrectely) configured your hostname in /etc/hosts. Correcting that may resolve this.

  • Another way, as the warning suggests, is to install nss-myhostname, which is referred to in debian as libnss-myhostname. This is only a workaround, not the suggested solution to the relevant bug. Install using:

    sudo apt-get install libnss-myhostname
    

Source: 13.04 dmesg: Warning: nss-myhostname is not installed

2
  • 5
    Is there a way to merge answers? I feel your answer does not take into consideration what yoyoma2 highlights in that it is NOT recommended to install that package purely for the purposes of preventing dbus messages requesting it. It is a known bug as yoyoma2 highlights. yoyoma2 also explains the "Why? Do I have to react on the dmesg message?" part of the question asked. I can not see how to edit your answer without completely changing it! – geezanansa Feb 8 '15 at 15:25
  • 1
    Also the ubuntu forums thread linked too in no way shape or form recommends installing (though it is suggested but with no feedback or confirmation or explanation) the package you suggest is good idea. reading the thread suggests other workarounds and explains why! – geezanansa Feb 8 '15 at 15:38
6

I doubt you will want to install those libraries. Seen as it's nothing more than a nuisance you can simply silence the message.

Create a new config file in /etc/rsyslog.d/ and tell the message to be dropped:

$ sudo nano /etc/rsyslog.d/20-systemd-hostnamed.conf

Add the following single line:

:msg, contains, "Warning: nss-myhostname is not installed." stop

Save and close, and restart the daemon:

$ sudo service rsyslog restart

Job done. You can make sure that the messages are being dropped by intentionally trying to spam your syslog:

$ logger -t TEST "Warning: nss-myhostname is not installed."

The message should be silently dropped.

-1

I was having the same issue.

Not a long-term solution by any means - but one that suited me - was to remove the old host names attached to my localhost in /etc/hosts/ as these are no longer used.

The message is no longer served.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.