Skip to contentSkip to conversation

netbase: Adding loop back for machine name in hosts file

PATCH In review Sujith H 5 participants 8 messages Jul 31, 2014 – Aug 4, 2014

lore
Share & tools
lore

Sujith H

author
#0 lore raw

PATCH 1/1 netbase: Adding loop back for machine name in hosts file

From: Sujith H <[email protected]>

If hostname is not added to /etc/hosts file then rpcinfo command fails when hostname is passed as argument. This was observed when rpcinfo command was tested on freescale target. Below was the output observed without this change.

root@mx6q:~# rpcinfo -s mx6q
rpcinfo: can't contact rpcbind: RPC: (unknown error code)

Below is the output after this change:

root@mx6q:~# rpcinfo -s mx6q
   program version(s) netid(s)                         service     owner
    100000  2,3,4     local,udp,tcp,udp6,tcp6          portmapper  superuser
root@mx6q:~#
---
 meta/recipes-core/netbase/netbase_5.2.bb | 1 +
 1 file changed, 1 insertion(+)
meta/recipes-core/netbase/netbase_5.2.bb +1 -0
index ab7ae65..a6fb010 100644
@@ -18,6 +18,7 @@ do_install () {
 	install -m 0644 etc-rpc ${D}${sysconfdir}/rpc
 	install -m 0644 etc-protocols ${D}${sysconfdir}/protocols
 	install -m 0644 etc-services ${D}${sysconfdir}/services
+	echo 127.0.1.1 "             "${MACHINE} >> ${D}${sysconfdir}/hosts
 }
 
 CONFFILES_${PN} = "${sysconfdir}/hosts"
Signature · 1 line
1.8.4
#1 lore raw
Quoted 1 line · Sujith H

+ echo 127.0.1.1 " "${MACHINE} >> ${D}${sysconfdir}/hosts

recipe will become MACHNE specific. Can this be done via post processing funcs instead ?

#2 lore raw
Quoted 6 lines · Khem Raj
Quoted 1 line · Sujith H

+ echo 127.0.1.1 " "${MACHINE} >> ${D}${sysconfdir}/hosts

recipe will become MACHNE specific. Can this be done via post processing funcs instead ?

I had the same comment. We don't want to do this in the recipe itself. Instead we want to likely add a rootfs/image configuration step, like the zap_root_password and similar actions.

This way it can be enabled/disabled more easily based on user requirements.

--Mark

#3 lore raw
In reply to Sujith H

meta/recipes-core/netbase/netbase_5.2.bb do_install () { · line 21

Quoted 1 line · Sujith H
meta/recipes-core/netbase/netbase_5.2.bb +1 -0
+	echo 127.0.1.1 "             "${MACHINE} >> ${D}${sysconfdir}/hosts

This is a very questionable setup which causes a lot of harm. When really wanted, it should be made optional and not the default.

Enrico

#4 lore raw
Quoted 6 lines · Enrico Scholz
Quoted 1 line · Sujith H

+ echo 127.0.1.1 " "${MACHINE} >> ${D}${sysconfdir}/hosts

This is a very questionable setup which causes a lot of harm. When really wanted, it should be made optional and not the default.

What kind of harm you see?

I think moving this to postinst works for me and does not cause problems I think.

Signature · 3 lines
Otavio Salvador                             O.S. Systems
http://www.ossystems.com.br        http://code.ossystems.com.br
Mobile: +55 (53) 9981-7854            Mobile: +1 (347) 903-9750
#5 lore raw
Quoted 6 lines · Otavio Salvador
Quoted 4 lines · Enrico Scholz
Quoted 1 line · Sujith H

+ echo 127.0.1.1 " "${MACHINE} >> ${D}${sysconfdir}/hosts

Quoted 8 lines
Quoted 2 lines

This is a very questionable setup which causes a lot of harm. When really wanted, it should be made optional and not the default.

What kind of harm you see?

I think moving this to postinst works for me and does not cause problems I think.

The only default configuration for 127.0.0.1 (not 1.1) should be localhost. Anything after that is installation independent and should be configured outside of the 'package' scope...

I recommend ROOTFS_POSTINSTALL_COMMAND...

--Mark

#6 lore raw
In reply to Otavio Salvador
Quoted 6 lines · Otavio Salvador
Quoted 4 lines
Quoted 1 line

+ echo 127.0.1.1 " "${MACHINE} >> ${D}${sysconfdir}/hosts

This is a very questionable setup which causes a lot of harm. When really wanted, it should be made optional and not the default.

What kind of harm you see?

e.g. in sshd_config

| ListenAddress <hostname>

When Fedora had such a setup, I had a lot of trouble with KRB5ized NFS4. See [1] for examples. Generally, external and internal DNS should be consistent.

Beside this... afaik ${MACHINE} can contain '_' and '.' which are either forbidden ('_') or have special meanings in DNS.

Enrico

Footnotes:
[1] https://bugzilla.redhat.com/show_bug.cgi?id=648725

author
#7 lore raw

Hi,

I will post the new patch with ROOTFS_POSTPROCESS_COMMAND.

Thanks for the feedback.

Quoted 25 lines · Enrico Scholz
Quoted 1 line · Otavio Salvador
Quoted 1 line
Quoted 1 line

+ echo 127.0.1.1 " "${MACHINE} >>

${D}${sysconfdir}/hosts

Quoted 5 lines
Quoted 3 lines

This is a very questionable setup which causes a lot of harm. When really wanted, it should be made optional and not the default.

What kind of harm you see?

e.g. in sshd_config

| ListenAddress <hostname>

When Fedora had such a setup, I had a lot of trouble with KRB5ized NFS4. See [1] for examples. Generally, external and internal DNS should be consistent.

Beside this... afaik ${MACHINE} can contain '_' and '.' which are either forbidden ('_') or have special meanings in DNS.

Enrico

Quoted 8 lines

Footnotes:
[1] https://bugzilla.redhat.com/show_bug.cgi?id=648725
--
_______________________________________________
Openembedded-core mailing list [email protected]
http://lists.openembedded.org/mailman/listinfo/openembedded-core

Thanks,

Sujith H

Signature · 5 lines
സുജിത് ഹരിദാസന്
Bangalore
<Project>Contributor to KDE project
http://fci.wikia.com/wiki/Anti-DRM-Campaign
<Blog> http://sujithh.info