RHEL Engineering is moving the tracking of its product development work on RHEL 6 through RHEL 9 to Red Hat Jira (issues.redhat.com). If you're a Red Hat customer, please continue to file support cases via the Red Hat customer portal. If you're not, please head to the "RHEL project" in Red Hat Jira and file new tickets here. Individual Bugzilla bugs in the statuses "NEW", "ASSIGNED", and "POST" are being migrated throughout September 2023. Bugs of Red Hat partners with an assigned Engineering Partner Manager (EPM) are migrated in late September as per pre-agreed dates. Bugs against components "kernel", "kernel-rt", and "kpatch" are only migrated if still in "NEW" or "ASSIGNED". If you cannot log in to RH Jira, please consult article #7032570. That failing, please send an e-mail to the RH Jira admins at rh-issues@redhat.com to troubleshoot your issue as a user management inquiry. The email creates a ServiceNow ticket with Red Hat. Individual Bugzilla bugs that are migrated will be moved to status "CLOSED", resolution "MIGRATED", and set with "MigratedToJIRA" in "Keywords". The link to the successor Jira issue will be found under "Links", have a little "two-footprint" icon next to it, and direct you to the "RHEL project" in Red Hat Jira (issue links are of type "https://issues.redhat.com/browse/RHEL-XXXX", where "X" is a digit). This same link will be available in a blue banner at the top of the page informing you that that bug has been migrated.
Bug 1368929 - [SPEC] systemd adds myhostname option from post script of package
Summary: [SPEC] systemd adds myhostname option from post script of package
Keywords:
Status: CLOSED ERRATA
Alias: None
Product: Red Hat Enterprise Linux 7
Classification: Red Hat
Component: systemd
Version: 7.2
Hardware: All
OS: Linux
medium
high
Target Milestone: rc
: ---
Assignee: systemd-maint
QA Contact: Frantisek Sumsal
URL:
Whiteboard:
: 1383865 (view as bug list)
Depends On:
Blocks: 1298243 1380361 74systemd 1393867
TreeView+ depends on / blocked
 
Reported: 2016-08-22 07:10 UTC by Suresh
Modified: 2020-09-10 09:44 UTC (History)
14 users (show)

Fixed In Version: systemd-219-36.el7
Doc Type: If docs needed, set a value
Doc Text:
Clone Of:
Environment:
Last Closed: 2017-08-01 09:09:52 UTC
Target Upstream Version:
Embargoed:


Attachments (Terms of Use)
patch (403 bytes, patch)
2017-03-09 11:36 UTC, Jan Synacek
no flags Details | Diff


Links
System ID Private Priority Status Summary Last Updated
Red Hat Knowledge Base (Solution) 2766251 0 None None None 2016-11-14 16:19:40 UTC
Red Hat Product Errata RHBA-2017:2297 0 normal SHIPPED_LIVE systemd bug fix and enhancement update 2017-08-01 12:40:16 UTC

Description Suresh 2016-08-22 07:10:08 UTC
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 '
/^hosts:/ !b
/\<myhostname\>/ b
s/[[:blank:]]*$/ myhostname/
' /etc/nsswitch.conf >/dev/null 2>&1 || :
fi

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`               
fe80::ae16:2dff:xxxx:xxxx HOSTNAME
fe80::ae16:2dff:xxxx:xxxx HOSTNAME

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. 

How reproducible:
Everytime

Steps to Reproduce:
1. Remove myhostname from /etc/nsswitch.conf file.
2. Update systemd package and it will append myhostname in hosts line again.

Comment 3 John Ruemker 2016-12-12 20:56:15 UTC
*** Bug 1383865 has been marked as a duplicate of this bug. ***

Comment 12 Jan Synacek 2017-03-09 11:36:52 UTC
Created attachment 1261514 [details]
patch

Comment 14 Yogita 2017-04-24 10:42:00 UTC
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)
iptables-1.4.21-17.el7.x86_64

How reproducible:
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
#dracut -f

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.

Comment 15 Jan Synacek 2017-04-24 11:16:31 UTC
(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.

Comment 17 errata-xmlrpc 2017-08-01 09:09:52 UTC
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.

https://access.redhat.com/errata/RHBA-2017:2297


Note You need to log in before you can comment on or make changes to this bug.