Re: [OE-core] [PATCH] image.bbclass: Adding loop back for machine name in hosts file

2014-08-05 Thread Enrico Scholz
sujith h sujith.h-re5jqeeqqe8avxtiumw...@public.gmane.org writes:

 Is it ok to read from /etc/hostname and then have that in the /etc/hosts
 file, rather than using ${MACHINE}?
 ...
 + echo 127.0.1.1${MACHINE}  
 ${IMAGE_ROOTFS}${sysconfdir}/hosts

I do not see how this can be done while building the image or the
packages.  Both the hostname and the ip address can be configured at
runtime.  As this can happen dynamically e.g. by DHCP and can change
at every boot or even at runtime, there is no generic way (e.g. by
firstboot mechanisms) to add such entries.


Enrico
-- 
___
Openembedded-core mailing list
Openembedded-core@lists.openembedded.org
http://lists.openembedded.org/mailman/listinfo/openembedded-core


Re: [OE-core] [PATCH] image.bbclass: Adding loop back for machine name in hosts file

2014-08-05 Thread Koen Kooi

Op 4 aug. 2014, om 15:57 heeft Sujith H sujit...@gmail.com het volgende 
geschreven:

 From: Sujith H sujith_harida...@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.

Isn't this what nssmyhostname is for?
-- 
___
Openembedded-core mailing list
Openembedded-core@lists.openembedded.org
http://lists.openembedded.org/mailman/listinfo/openembedded-core


Re: [OE-core] [PATCH] image.bbclass: Adding loop back for machine name in hosts file

2014-08-05 Thread sujith h
On Tue, Aug 5, 2014 at 6:17 PM, Koen Kooi k...@dominion.thruhere.net
wrote:


 Op 4 aug. 2014, om 15:57 heeft Sujith H sujit...@gmail.com het volgende
 geschreven:

  From: Sujith H sujith_harida...@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.

 Isn't this what nssmyhostname is for?


Yes adding nss-myhostname would be the cleaner solution. Thanks Koen Kooi.



-- 
സുജിത് ഹരിദാസന്
Bangalore
ProjectContributor to KDE project
http://fci.wikia.com/wiki/Anti-DRM-Campaign
Blog http://sujithh.info
-- 
___
Openembedded-core mailing list
Openembedded-core@lists.openembedded.org
http://lists.openembedded.org/mailman/listinfo/openembedded-core


[OE-core] [PATCH] image.bbclass: Adding loop back for machine name in hosts file

2014-08-04 Thread Sujith H
From: Sujith H sujith_harida...@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
10  2,3,4 local,udp,tcp,udp6,tcp6  portmapper  superuser
root@mx6q:~#

Signed-off-by: Sujith H sujith_harida...@mentor.com
---
 meta/classes/image.bbclass | 8 
 1 file changed, 8 insertions(+)

diff --git a/meta/classes/image.bbclass b/meta/classes/image.bbclass
index 82605f2..7a5a5c1 100644
--- a/meta/classes/image.bbclass
+++ b/meta/classes/image.bbclass
@@ -341,6 +341,14 @@ ssh_disable_dns_lookup () {
fi
 }
 
+ROOTFS_POSTPROCESS_COMMAND += add_machine_name_loop_back;
+
+add_machine_name_loop_back() {
+if [ -n ${MACHINE} ]; then
+ echo 127.0.1.1${MACHINE}  
${IMAGE_ROOTFS}${sysconfdir}/hosts
+fi
+}
+
 # Enable postinst logging if debug-tweaks is enabled
 postinst_enable_logging () {
mkdir -p ${IMAGE_ROOTFS}${sysconfdir}/default
-- 
1.8.4

-- 
___
Openembedded-core mailing list
Openembedded-core@lists.openembedded.org
http://lists.openembedded.org/mailman/listinfo/openembedded-core


Re: [OE-core] [PATCH] image.bbclass: Adding loop back for machine name in hosts file

2014-08-04 Thread sujith h
Hi,

Let me know if any more changes have to be made to make this patch look
better.



On Mon, Aug 4, 2014 at 7:27 PM, Sujith H sujit...@gmail.com wrote:

 From: Sujith H sujith_harida...@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
 10  2,3,4 local,udp,tcp,udp6,tcp6  portmapper
  superuser
 root@mx6q:~#

 Signed-off-by: Sujith H sujith_harida...@mentor.com
 ---
  meta/classes/image.bbclass | 8 
  1 file changed, 8 insertions(+)

 diff --git a/meta/classes/image.bbclass b/meta/classes/image.bbclass
 index 82605f2..7a5a5c1 100644
 --- a/meta/classes/image.bbclass
 +++ b/meta/classes/image.bbclass
 @@ -341,6 +341,14 @@ ssh_disable_dns_lookup () {
 fi
  }

 +ROOTFS_POSTPROCESS_COMMAND += add_machine_name_loop_back;
 +
 +add_machine_name_loop_back() {
 +if [ -n ${MACHINE} ]; then
 + echo 127.0.1.1${MACHINE} 
 ${IMAGE_ROOTFS}${sysconfdir}/hosts
 +fi
 +}
 +
  # Enable postinst logging if debug-tweaks is enabled
  postinst_enable_logging () {
 mkdir -p ${IMAGE_ROOTFS}${sysconfdir}/default
 --
 1.8.4


Thanks,
Sujith H

-- 
സുജിത് ഹരിദാസന്
Bangalore
ProjectContributor to KDE project
http://fci.wikia.com/wiki/Anti-DRM-Campaign
Blog http://sujithh.info
-- 
___
Openembedded-core mailing list
Openembedded-core@lists.openembedded.org
http://lists.openembedded.org/mailman/listinfo/openembedded-core


Re: [OE-core] [PATCH] image.bbclass: Adding loop back for machine name in hosts file

2014-08-04 Thread Paul Eggleton
Hi Sujith,

On Monday 04 August 2014 19:27:08 Sujith H wrote:
 From: Sujith H sujith_harida...@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
 10  2,3,4 local,udp,tcp,udp6,tcp6  portmapper  superuser
 root@mx6q:~#
 
 Signed-off-by: Sujith H sujith_harida...@mentor.com
 ---
  meta/classes/image.bbclass | 8 
  1 file changed, 8 insertions(+)
 
 diff --git a/meta/classes/image.bbclass b/meta/classes/image.bbclass
 index 82605f2..7a5a5c1 100644
 --- a/meta/classes/image.bbclass
 +++ b/meta/classes/image.bbclass
 @@ -341,6 +341,14 @@ ssh_disable_dns_lookup () {
   fi
  }
 
 +ROOTFS_POSTPROCESS_COMMAND += add_machine_name_loop_back;
 +
 +add_machine_name_loop_back() {
 +if [ -n ${MACHINE} ]; then
 + echo 127.0.1.1${MACHINE} 
 ${IMAGE_ROOTFS}${sysconfdir}/hosts +fi
 +}
 +

I think in the earlier discussion the conclusion was that we do not want this 
enabled by default, which the above will do.

The question I have is, if this isn't a good idea, is there a better solution?

Cheers,
Paul

-- 

Paul Eggleton
Intel Open Source Technology Centre
-- 
___
Openembedded-core mailing list
Openembedded-core@lists.openembedded.org
http://lists.openembedded.org/mailman/listinfo/openembedded-core


Re: [OE-core] [PATCH] image.bbclass: Adding loop back for machine name in hosts file

2014-08-04 Thread sujith h
Hi Paul,


On Mon, Aug 4, 2014 at 7:48 PM, Paul Eggleton paul.eggle...@linux.intel.com
 wrote:

 Hi Sujith,

 On Monday 04 August 2014 19:27:08 Sujith H wrote:
  From: Sujith H sujith_harida...@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
  10  2,3,4 local,udp,tcp,udp6,tcp6  portmapper
  superuser
  root@mx6q:~#
 
  Signed-off-by: Sujith H sujith_harida...@mentor.com
  ---
   meta/classes/image.bbclass | 8 
   1 file changed, 8 insertions(+)
 
  diff --git a/meta/classes/image.bbclass b/meta/classes/image.bbclass
  index 82605f2..7a5a5c1 100644
  --- a/meta/classes/image.bbclass
  +++ b/meta/classes/image.bbclass
  @@ -341,6 +341,14 @@ ssh_disable_dns_lookup () {
fi
   }
 
  +ROOTFS_POSTPROCESS_COMMAND += add_machine_name_loop_back;
  +
  +add_machine_name_loop_back() {
  +if [ -n ${MACHINE} ]; then
  + echo 127.0.1.1${MACHINE} 
  ${IMAGE_ROOTFS}${sysconfdir}/hosts +fi
  +}
  +

 I think in the earlier discussion the conclusion was that we do not want
 this
 enabled by default, which the above will do.

 The question I have is, if this isn't a good idea, is there a better
 solution?


I totally agree with the discussion. Is it a good idea to implement like
check made for zap_empty_root_password?
For zap_empty_root_password there is a conditional check if debug-tweaks
are enabled then zap_empty_root_password is
called. So can I use debug-tweaks to handle add_machine_name_loop_back in
the patch?


Cheers,
 Paul

 --

 Paul Eggleton
 Intel Open Source Technology Centre


Thanks,

Sujith H

-- 
സുജിത് ഹരിദാസന്
Bangalore
ProjectContributor to KDE project
http://fci.wikia.com/wiki/Anti-DRM-Campaign
Blog http://sujithh.info
-- 
___
Openembedded-core mailing list
Openembedded-core@lists.openembedded.org
http://lists.openembedded.org/mailman/listinfo/openembedded-core


Re: [OE-core] [PATCH] image.bbclass: Adding loop back for machine name in hosts file

2014-08-04 Thread Paul Eggleton
On Monday 04 August 2014 20:03:09 sujith h wrote:
 Hi Paul,
 
 
 On Mon, Aug 4, 2014 at 7:48 PM, Paul Eggleton paul.eggle...@linux.intel.com
  wrote:
  
  Hi Sujith,
  
  On Monday 04 August 2014 19:27:08 Sujith H wrote:
   From: Sujith H sujith_harida...@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
  
   10  2,3,4 local,udp,tcp,udp6,tcp6  portmapper
   
   superuser
   
   root@mx6q:~#
   
   Signed-off-by: Sujith H sujith_harida...@mentor.com
   ---
   
meta/classes/image.bbclass | 8 
1 file changed, 8 insertions(+)
   
   diff --git a/meta/classes/image.bbclass b/meta/classes/image.bbclass
   index 82605f2..7a5a5c1 100644
   --- a/meta/classes/image.bbclass
   +++ b/meta/classes/image.bbclass
   @@ -341,6 +341,14 @@ ssh_disable_dns_lookup () {
   
 fi

}
   
   +ROOTFS_POSTPROCESS_COMMAND += add_machine_name_loop_back;
   +
   +add_machine_name_loop_back() {
   +if [ -n ${MACHINE} ]; then
   + echo 127.0.1.1${MACHINE} 
   ${IMAGE_ROOTFS}${sysconfdir}/hosts +fi
   +}
   +
  
  I think in the earlier discussion the conclusion was that we do not want
  this
  enabled by default, which the above will do.
  
  The question I have is, if this isn't a good idea, is there a better
  solution?
 
 I totally agree with the discussion. Is it a good idea to implement like
 check made for zap_empty_root_password?
 For zap_empty_root_password there is a conditional check if debug-tweaks
 are enabled then zap_empty_root_password is
 called. So can I use debug-tweaks to handle add_machine_name_loop_back in
 the patch?

No, that would not be right - debug-tweaks is for a specific purpose which is 
unrelated to this.

Cheers,
Paul

-- 

Paul Eggleton
Intel Open Source Technology Centre
-- 
___
Openembedded-core mailing list
Openembedded-core@lists.openembedded.org
http://lists.openembedded.org/mailman/listinfo/openembedded-core


Re: [OE-core] [PATCH] image.bbclass: Adding loop back for machine name in hosts file

2014-08-04 Thread Enrico Scholz
Sujith H sujith.h-re5jqeeqqe8avxtiumw...@public.gmane.org writes:

 If hostname is not added to /etc/hosts file then rpcinfo command fails
 when hostname is passed as argument.
 ...
 root@mx6q:~# rpcinfo -s mx6q
 rpcinfo: can't contact rpcbind: RPC: (unknown error code)

Is this really a common/valid use case?  'rpcinfo' is a debug tool and
when you want information about the local host, you can execute

# rpcinfo -s localhost

IMHO, when using network related functionality, you have to setup
networking.  This means:

- setup the hostname; using ${MACHINE} is ambiguous with more than one
  device and the string can contain chars forbidden by DNS ('_')

- setup name resolving; this can be done by ordinary DNS, (unambiguous)
  /etc/hosts, mDNS


When DNS mapping of ${MACHINE} (or better `hostname`) without working
DNS is really required, 'systemd' contains 'libnss_myhostname.so' (which
is to be registered in /etc/nsswitch) which returns '127.0.0.2' as a
fallback.


Enrico
-- 
___
Openembedded-core mailing list
Openembedded-core@lists.openembedded.org
http://lists.openembedded.org/mailman/listinfo/openembedded-core


Re: [OE-core] [PATCH] image.bbclass: Adding loop back for machine name in hosts file

2014-08-04 Thread sujith h
On Mon, Aug 4, 2014 at 8:19 PM, Paul Eggleton paul.eggle...@linux.intel.com
 wrote:

 On Monday 04 August 2014 20:03:09 sujith h wrote:
  Hi Paul,
 
 
  On Mon, Aug 4, 2014 at 7:48 PM, Paul Eggleton 
 paul.eggle...@linux.intel.com
   wrote:
  
   Hi Sujith,
  
   On Monday 04 August 2014 19:27:08 Sujith H wrote:
From: Sujith H sujith_harida...@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
   
10  2,3,4 local,udp,tcp,udp6,tcp6  portmapper
  
superuser
  
root@mx6q:~#
   
Signed-off-by: Sujith H sujith_harida...@mentor.com
---
   
 meta/classes/image.bbclass | 8 
 1 file changed, 8 insertions(+)
   
diff --git a/meta/classes/image.bbclass b/meta/classes/image.bbclass
index 82605f2..7a5a5c1 100644
--- a/meta/classes/image.bbclass
+++ b/meta/classes/image.bbclass
@@ -341,6 +341,14 @@ ssh_disable_dns_lookup () {
   
  fi
   
 }
   
+ROOTFS_POSTPROCESS_COMMAND += add_machine_name_loop_back;
+
+add_machine_name_loop_back() {
+if [ -n ${MACHINE} ]; then
+ echo 127.0.1.1${MACHINE} 
${IMAGE_ROOTFS}${sysconfdir}/hosts +fi
+}
+
  
   I think in the earlier discussion the conclusion was that we do not
 want
   this
   enabled by default, which the above will do.
  
   The question I have is, if this isn't a good idea, is there a better
   solution?
 
  I totally agree with the discussion. Is it a good idea to implement like
  check made for zap_empty_root_password?
  For zap_empty_root_password there is a conditional check if debug-tweaks
  are enabled then zap_empty_root_password is
  called. So can I use debug-tweaks to handle add_machine_name_loop_back in
  the patch?

 No, that would not be right - debug-tweaks is for a specific purpose which
 is
 unrelated to this.


Ok. How about adding :

ROOTFS_POSTPROCESS_COMMAND += '${@base_contains(TOOLCHAIN_TARGET_TASK,
packagegroup-core-boot, add_machine_name_loop_back; , ,d)}'

Again here the problem is that when packagegroup-core-boot will be added,
this change will be forced to rootfs :(


 Cheers,
 Paul

 --

 Paul Eggleton
 Intel Open Source Technology Centre


Thanks,
Sujith H

-- 
സുജിത് ഹരിദാസന്
Bangalore
ProjectContributor to KDE project
http://fci.wikia.com/wiki/Anti-DRM-Campaign
Blog http://sujithh.info
-- 
___
Openembedded-core mailing list
Openembedded-core@lists.openembedded.org
http://lists.openembedded.org/mailman/listinfo/openembedded-core


Re: [OE-core] [PATCH] image.bbclass: Adding loop back for machine name in hosts file

2014-08-04 Thread sujith h
On Mon, Aug 4, 2014 at 9:05 PM, Enrico Scholz 
enrico.sch...@sigma-chemnitz.de wrote:

 Sujith H sujith.h-re5jqeeqqe8avxtiumw...@public.gmane.org writes:

  If hostname is not added to /etc/hosts file then rpcinfo command fails
  when hostname is passed as argument.
  ...
  root@mx6q:~# rpcinfo -s mx6q
  rpcinfo: can't contact rpcbind: RPC: (unknown error code)

 Is this really a common/valid use case?  'rpcinfo' is a debug tool and
 when you want information about the local host, you can execute

 # rpcinfo -s localhost

 IMHO, when using network related functionality, you have to setup
 networking.  This means:

 - setup the hostname; using ${MACHINE} is ambiguous with more than one
   device and the string can contain chars forbidden by DNS ('_')

 - setup name resolving; this can be done by ordinary DNS, (unambiguous)
   /etc/hosts, mDNS


 When DNS mapping of ${MACHINE} (or better `hostname`) without working
 DNS is really required, 'systemd' contains 'libnss_myhostname.so' (which
 is to be registered in /etc/nsswitch) which returns '127.0.0.2' as a
 fallback.


Is it ok to read from /etc/hostname and then have that in the /etc/hosts
file, rather than using ${MACHINE}?


 Enrico
 --
 ___
 Openembedded-core mailing list
 Openembedded-core@lists.openembedded.org
 http://lists.openembedded.org/mailman/listinfo/openembedded-core




-- 
സുജിത് ഹരിദാസന്
Bangalore
ProjectContributor to KDE project
http://fci.wikia.com/wiki/Anti-DRM-Campaign
Blog http://sujithh.info
-- 
___
Openembedded-core mailing list
Openembedded-core@lists.openembedded.org
http://lists.openembedded.org/mailman/listinfo/openembedded-core


Re: [OE-core] [PATCH] image.bbclass: Adding loop back for machine name in hosts file

2014-08-04 Thread Khem Raj
On 14-08-04 15:18:05, Paul Eggleton wrote:
 Hi Sujith,
 
 On Monday 04 August 2014 19:27:08 Sujith H wrote:
  From: Sujith H sujith_harida...@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
  10  2,3,4 local,udp,tcp,udp6,tcp6  portmapper  superuser
  root@mx6q:~#
  
  Signed-off-by: Sujith H sujith_harida...@mentor.com
  ---
   meta/classes/image.bbclass | 8 
   1 file changed, 8 insertions(+)
  
  diff --git a/meta/classes/image.bbclass b/meta/classes/image.bbclass
  index 82605f2..7a5a5c1 100644
  --- a/meta/classes/image.bbclass
  +++ b/meta/classes/image.bbclass
  @@ -341,6 +341,14 @@ ssh_disable_dns_lookup () {
  fi
   }
  
  +ROOTFS_POSTPROCESS_COMMAND += add_machine_name_loop_back;
  +
  +add_machine_name_loop_back() {
  +if [ -n ${MACHINE} ]; then
  + echo 127.0.1.1${MACHINE} 
  ${IMAGE_ROOTFS}${sysconfdir}/hosts +fi
  +}
  +
 
 I think in the earlier discussion the conclusion was that we do not want this 
 enabled by default, which the above will do.
 
 The question I have is, if this isn't a good idea, is there a better solution?

These things belong to first time install/commissioning of the device
IMO. They are necessary operations but we do not have first time boot
scenario
-- 
___
Openembedded-core mailing list
Openembedded-core@lists.openembedded.org
http://lists.openembedded.org/mailman/listinfo/openembedded-core