Bug 13078

Summary: Update /etc/hosts with hostname
Product: [Build System, Metadata & Runtime] OE-Core Reporter: Ross Burton <ross.burton>
Component: coreAssignee: Chen Qi <Qi.Chen>
Status: RESOLVED FIXED QA Contact:
Severity: normal    
Priority: Medium+ CC: matthias.schoepfer, meta.mr.watcher, meta.watcher, randy.macleod, richard.purdie
Version: 2.6   
Target Milestone: 2.7 M4   
Hardware: x86   
OS: Multiple   
Whiteboard:
OS type for building Yocto: --- Type of Regression: ---
Verified: Documentation change: No (bug/feature does not impact docs)
Bug Depends on:    
Bug Blocks: 13077    

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