Hi Daniel,

On Tue, Jan 10, 2017 at 2:37 AM, Daniel Wagner <wagi@monom.org> wrote:
>
> Hi Shrikant,
>
> On 01/09/2017 11:22 AM, Shrikant Bobade wrote:
> > seems the connmand hangs much earlier..
>
> And so goes my theory down the toilet. Well, so there is something
> calling gnutls_global_init really early on.
>
> >>> #4  0x76d64dfc in _gnutls_global_init (constructor=constructor@entry=1)
> >>> at ../../gnutls-3.5.3/lib/global.c:307
>
> This time I think I got it(TM). On load of the library the 'constructor'
> of the library is called (see man pages for details: man dlopen) and
> gnutls calls under certain condition _gnutls_global_init() itself.
> That also explains why you don't see an proper stack trace in gdb.
>
ok.
> From lib/global.c:
>
>
> static void _CONSTRUCTOR lib_init(void)
> {
> int ret;
> const char *e;
>
>         if (_gnutls_global_init_skip() != 0)
>                 return;
>
>         e = secure_getenv("GNUTLS_NO_EXPLICIT_INIT");
>         if (e != NULL) {
>                 ret = atoi(e);
>                 if (ret == 1)
>                         return;
>         }
>
>         ret = _gnutls_global_init(1);
>         if (ret < 0) {
>                 fprintf(stderr, "Error in GnuTLS initialization: %s\n", gnutls_strerror(ret));
>                 _gnutls_switch_lib_state(LIB_STATE_ERROR);
>         }
> }
>
> if you start ConnMan with 'GNUTLS_NO_EXPLICIT_INIT=1 ./connmand -n -d' it should work.
>
> Now I cross my fingers :D

yes, with zero entropy and GNUTLS_NO_EXPLICIT_INIT=1
:~# cat /proc/sys/kernel/random/entropy_avail
0
:~#
:~# GNUTLS_NO_EXPLICIT_INIT=1 ./connmand -n -d
connmand[801]: Connection Manager version 1.33
connmand[801]: ../connman-1.33/src/dbus.c:__connman_dbus_init()
connmand[801]: ../connman-1.33/src/inotify.c:__connman_inotify_init()
connmand[801]: ../connman-1.33/src/technology.c:__connman_technology_init()
connmand[801]: ../connman-1.33/src/storage.c:storage_load() Loading /var/lib/connman/settings
connmand[801]: ../connman-1.33/src/storage.c:storage_load() Loading /var/lib/connman/settings
connmand[801]: ../connman-1.33/src/notifier.c:__connman_notifier_init()
connmand[801]: ../connman-1.33/src/agent.c:__connman_agent_init()
connmand[801]: ../connman-1.33/src/service.c:__connman_service_init()
connmand[801]: ../connman-1.33/src/agent.c:connman_agent_driver_register() Registering driver 0xbd1a0 name service
connmand[801]: ../connman-1.33/src/peer_service.c:__connman_peer_service_init()
connmand[801]: ../connman-1.33/src/peer.c:__connman_peer_init()
connmand[801]: ../connman-1.33/src/provider.c:__connman_provider_init()
connmand[801]: ../connman-1.33/src/notifier.c:connman_notifier_register() notifier 0xbd1c4 name provider
connmand[801]: ../connman-1.33/src/network.c:__connman_network_init()
connmand[801]: ../connman-1.33/src/config.c:__connman_config_init()
connmand[801]: ../connman-1.33/src/inotify.c:create_watch() Add directory watch for /var/lib/connman
connmand[801]: ../connman-1.33/src/config.c:read_configs()
connmand[801]: ../connman-1.33/src/device.c:__connman_device_init()
connmand[801]: ../connman-1.33/src/ippool.c:__connman_ippool_init()
connmand[801]: ../connman-1.33/src/iptables.c:__connman_iptables_init()
connmand[801]: ../connman-1.33/src/firewall.c:__connman_firewall_init()
connmand[801]: ../connman-1.33/src/iptables.c:iptables_init() filter
connmand[801]: ../connman-1.33/src/iptables.c:__connman_iptables_commit() filter
connmand[801]: ../connman-1.33/src/iptables.c:iptables_init() mangle
connmand[801]: ../connman-1.33/src/iptables.c:__connman_iptables_commit() mangle
connmand[801]: ../connman-1.33/src/iptables.c:iptables_init() nat
connmand[801]: ../connman-1.33/src/iptables.c:__connman_iptables_commit() nat
connmand[801]: ../connman-1.33/src/nat.c:__connman_nat_init()
connmand[801]: ../connman-1.33/src/notifier.c:connman_notifier_register() notifier 0xbd444 name nat
connmand[801]: ../connman-1.33/src/tethering.c:__connman_tethering_init()
connmand[801]: ../connman-1.33/src/counter.c:__connman_counter_init()
connmand[801]: ../connman-1.33/src/manager.c:__connman_manager_init()
connmand[801]: ../connman-1.33/src/notifier.c:connman_notifier_register() notifier 0xbd174 name manager
connmand[801]: ../connman-1.33/src/stats.c:__connman_stats_init()
connmand[801]: ../connman-1.33/src/clock.c:__connman_clock_init()
connmand[801]: ../connman-1.33/src/timezone.c:__connman_timezone_init()
connmand[801]: ../connman-1.33/src/timezone.c:__connman_timezone_lookup() sysconfig zone (null)
connmand[801]: ../connman-1.33/src/timezone.c:__connman_timezone_lookup() localtime zone Etc/UTC
connmand[801]: ../connman-1.33/src/storage.c:storage_load() Loading /var/lib/connman/settings
connmand[801]: ../connman-1.33/src/ipconfig.c:__connman_ipconfig_init()
connmand[801]: ../connman-1.33/src/rtnl.c:__connman_rtnl_init()
connmand[801]: ../connman-1.33/src/task.c:__connman_task_init()
connmand[801]: ../connman-1.33/src/proxy.c:__connman_proxy_init()
connmand[801]: ../connman-1.33/src/detect.c:__connman_detect_init()
connmand[801]: ../connman-1.33/src/rtnl.c:connman_rtnl_register() rtnl 0xbd1f0 name detect
connmand[801]: ../connman-1.33/src/session.c:__connman_session_init()
.
.
.
got successful ip assignment.

do I need to post complete log some where to share.. or its fine.. as we are getting now expected ip. please advice..

So will move ahead with explicit GNUTLS_NO_EXPLICIT_INIT=1 & remove the rngd dependency(added earlier for ~3k entropy available), will it be  fine ?

>
> cheers,
> daniel