Patchwork netbase: Adding loop back for machine name in hosts file

login
register
mail settings
Submitter Sujith H
Date July 31, 2014, 2:59 p.m.
Message ID <1406818740-17681-1-git-send-email-sujith.h@gmail.com>
Download mbox | patch
Permalink /patch/77035/
State New
Headers show

Comments

Sujith H - July 31, 2014, 2:59 p.m.
From: Sujith H <Sujith_Haridasan@mentor.com>

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:~#

Signed-off-by: Sujith H <sujith.h@gmail.com>
---
 meta/recipes-core/netbase/netbase_5.2.bb | 1 +
 1 file changed, 1 insertion(+)
Khem Raj - July 31, 2014, 3:42 p.m.
On Thu, Jul 31, 2014 at 7:59 AM, Sujith H <sujith.h@gmail.com> wrote:
> +       echo 127.0.1.1 "             "${MACHINE} >> ${D}${sysconfdir}/hosts

recipe will become MACHNE specific. Can this be done via post
processing funcs instead ?
Mark Hatle - July 31, 2014, 3:48 p.m.
On 7/31/14, 10:42 AM, Khem Raj wrote:
> On Thu, Jul 31, 2014 at 7:59 AM, Sujith H <sujith.h@gmail.com> wrote:
>> +       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
Enrico Scholz - July 31, 2014, 4:20 p.m.
Sujith H <sujith.h-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> writes:

> +	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
Otavio Salvador - July 31, 2014, 8:44 p.m.
On Thu, Jul 31, 2014 at 1:20 PM, Enrico Scholz
<enrico.scholz@sigma-chemnitz.de> wrote:
> Sujith H <sujith.h-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> writes:
>
>> +     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.
Mark Hatle - Aug. 1, 2014, 12:20 a.m.
On 7/31/14, 3:44 PM, Otavio Salvador wrote:
> On Thu, Jul 31, 2014 at 1:20 PM, Enrico Scholz
> <enrico.scholz@sigma-chemnitz.de> wrote:
>> Sujith H <sujith.h-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> writes:
>>
>>> +     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.
>

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
Enrico Scholz - Aug. 1, 2014, 9:22 a.m.
Otavio Salvador <otavio-fKevB0iiKLMBZ+LybsDmbA@public.gmane.org> writes:

>>> +     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
Sujith H - Aug. 4, 2014, 1:57 p.m.
Hi,

I will post the new patch with ROOTFS_POSTPROCESS_COMMAND.

Thanks for the feedback.



On Fri, Aug 1, 2014 at 2:52 PM, Enrico Scholz <
enrico.scholz@sigma-chemnitz.de> wrote:

> Otavio Salvador <otavio-fKevB0iiKLMBZ+LybsDmbA@public.gmane.org> writes:
>
> >>> +     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
> --
> _______________________________________________
> Openembedded-core mailing list
> Openembedded-core@lists.openembedded.org
> http://lists.openembedded.org/mailman/listinfo/openembedded-core
>

Thanks,

Sujith H

Patch

diff --git a/meta/recipes-core/netbase/netbase_5.2.bb b/meta/recipes-core/netbase/netbase_5.2.bb
index ab7ae65..a6fb010 100644
--- a/meta/recipes-core/netbase/netbase_5.2.bb
+++ b/meta/recipes-core/netbase/netbase_5.2.bb
@@ -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"