Bug 13078 - Update /etc/hosts with hostname
Summary: Update /etc/hosts with hostname
Status: RESOLVED FIXED
Alias: None
Product: OE-Core
Classification: Build System, Metadata & Runtime
Component: core (show other bugs)
Version: 2.6
Hardware: x86 Multiple
: Medium+ normal
Target Milestone: 2.7 M4
Assignee: Chen Qi
QA Contact:
URL:
Whiteboard:
Depends on:
Blocks: 13077
  Show dependency tree
 
Reported: 2018-12-12 12:07 UTC by Ross Burton
Modified: 2019-04-03 09:08 UTC (History)
5 users (show)

See Also:
OS type for building Yocto: ---
Type of Regression: ---
Verified:
Documentation change: No (bug/feature does not impact docs)


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Ross Burton 2018-12-12 12:07:31 UTC
If the hostname has been altered, /etc/hosts should be updated to resolve that name to localhost.

Assigning to Chen as he's posted patches for this, but I couldn't find an existing bug.  Feel free to mark as a duplicate if there is an existing bug.
Comment 1 Matthias Schöpfer 2018-12-21 14:04:29 UTC
I see the same problem, but in my case, (systemd with PACKAGECONFIG myhostname), it should work *without* touching /etc/hosts. But still, it does not. I could resolve the issue with this systemd_%.bbappend:

PACKAGECONFIG += "myhostname \
	         "


FILES_${PN} +=  "${libdir}/libnss_myhostname.so.2 \
                "
		
do_install_append() {
    install -m 0644 ${B}/libnss_myhostname.so.2 ${D}${libdir}
}
Comment 2 Matthias Schöpfer 2018-12-21 14:06:46 UTC
If you want me to make a patch for it, let me know.
Comment 3 Ross Burton 2018-12-21 14:24:52 UTC
A patch would be good but I don't think you'll need it, as out of the box it gets packaged into libnss-myhostname.
Comment 4 Matthias Schöpfer 2018-12-21 15:44:20 UTC
Hi Ross!

Thanks for the hint. I still have not found out, how I should know that I need to add libnss-myhostname, but that fixed it for me!

Regards!
Comment 5 Richard Purdie 2019-02-21 16:13:50 UTC
I think the original issue was fixed with http://git.yoctoproject.org/cgit.cgi/poky/commit/?id=53cebfdfcc189a65de82eccdbd18acf4d979e624