Description of problem:
The constant adding of it during updates is not desirable.
If it must be done as a rpm post script, then it should be aware and only
perform it once.
# sed-fu to add myhostname to the hosts line of /etc/nsswitch.conf
if [ -f /etc/nsswitch.conf ] ; then
sed -i.bak -e '
' /etc/nsswitch.conf >/dev/null 2>&1 || :
With this option, getent resolves ipv6 addresses even if mapping is present in /etc/hosts file.
[root@suresh ~]# grep hosts /etc/nsswitch.conf
#hosts: db files nisplus nis dns
hosts: files dns myhostname
[root@suresh ~]# getent hosts `uname -n`
Even if we remove this option from nsswitch.conf, update of systemd package inserts it again.
This can be workaround by adding [NOTFOUND=return] after dns entry. However, the constant adding of it during updates is not desirable.
Steps to Reproduce:
1. Remove myhostname from /etc/nsswitch.conf file.
2. Update systemd package and it will append myhostname in hosts line again.
*** Bug 1383865 has been marked as a duplicate of this bug. ***
Created attachment 1261514 [details]
This issue seems to persist even when IPV6 is disabled on RHEL7.3 machine.
Steps To reproduce -
Red Hat Enterprise Linux Server release 7.3 (Maipo)
1) Disable IPV6 on RHEL7.3 machine -
# vim /etc/sysctl.d/ipv6.conf
net.ipv6.conf.all.disable_ipv6 = 1
#sysctl -p /etc/sysctl.d/ipv6.conf
2) Execute below command -
[root@client ~]# getent hosts `uname -n`
::1 client.example.com localhost
Any reasons why? Customer need to ascertain why is it so despite of IPV6 disabled on RHEL7.3
Although removing myhostname from nsswitch.conf like described helps.
(In reply to Yogita from comment #14)
> This issue seems to persist even when IPV6 is disabled on RHEL7.3 machine.
This issue has nothing to do with system settings. It's a problem in the spec file and package update.
Since the problem described in this bug report should be
resolved in a recent advisory, it has been closed with a
resolution of ERRATA.
For information on the advisory, and where to find the updated
files, follow the link below.
If the solution does not work for you, open a new bug report.