<?xml version="1.0" encoding="UTF-8" standalone="yes" ?>
<!DOCTYPE bugzilla SYSTEM "https://bugzilla.yoctoproject.org/page.cgi?id=bugzilla.dtd">

<bugzilla version="5.0.6"
          urlbase="https://bugzilla.yoctoproject.org/"
          
          maintainer="it-coreprojects-helpdesk@linuxfoundation.org"
>

    <bug>
          <bug_id>13339</bug_id>
          
          <creation_ts>2019-05-08 13:42:13 +0000</creation_ts>
          <short_desc>Ruby 2.4.4 does not run with Apalis iMX6</short_desc>
          <delta_ts>2019-05-13 16:55:39 +0000</delta_ts>
          <reporter_accessible>1</reporter_accessible>
          <cclist_accessible>1</cclist_accessible>
          <classification_id>11</classification_id>
          <classification>Runtime</classification>
          <product>General Runtime</product>
          <component>General Runtime</component>
          <version>2.6.2</version>
          <rep_platform>Other</rep_platform>
          <op_sys>arm</op_sys>
          <bug_status>RESOLVED</bug_status>
          <resolution>MOVED</resolution>
          
          
          <bug_file_loc></bug_file_loc>
          <status_whiteboard></status_whiteboard>
          <keywords></keywords>
          <priority>Medium+</priority>
          <bug_severity>normal</bug_severity>
          <target_milestone>2.8 M1</target_milestone>
          
          
          <everconfirmed>1</everconfirmed>
          <reporter name="Nam Nguyen">nam.whoelse</reporter>
          <assigned_to name="Mingli Yu">mingli.yu</assigned_to>
          <cc>randy.macleod</cc>
    
    <cc>ross.burton</cc>
          
          
          <cf_os>---</cf_os>
          <cf_regression_type>---</cf_regression_type>
          
          <cf_docchange>No (bug/feature does not impact docs)</cf_docchange>

      

      

      

          <comment_sort_order>oldest_to_newest</comment_sort_order>  
          <long_desc isprivate="0" >
    <commentid>83735</commentid>
    <comment_count>0</comment_count>
    <who name="Nam Nguyen">nam.whoelse</who>
    <bug_when>2019-05-08 13:42:13 +0000</bug_when>
    <thetext>Preconditions/Environment
-------------------------
Yocto release: rocko (2.6.2)

Additional layers:
meta-freescale (rocko)
meta-freescale-3rdparty (rocko)
meta-toradex-bsp-common (rocko)
meta-toradex-nxp (rocko)

Image recipe: core-image-full-cmdline
Additional package(s): connman connman-client, python3, ruby

Additional configurations in local.conf:
PACKAGE_CLASSES ?= &quot;package_ipk&quot;
KERNEL_IMAGETYPE = &quot;zImage&quot;
DISTRO_FEATURES_append = &quot; systemd&quot;
DISTRO_FEATURES_BACKFILL_CONSIDERED += &quot;sysvinit&quot;
VIRTUAL-RUNTIME_init_manager = &quot;systemd&quot;
VIRTUAL-RUNTIME_initscripts = &quot;systemd-compat-units&quot;
EXTRA_IMAGE_FEATURES += &quot;package-management&quot;

Linux: Linux-toradex, kernel v4.9

Triggering Action/Cause
-----------------------
running &quot;ruby -v&quot; from command line

Expectation
-----------
display the version of ruby installed

Actual Result
-------------
the program hangs. The only way to exit is to use keyboard interrupt

Reproducibility
---------------
20/20</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>83736</commentid>
    <comment_count>1</comment_count>
    <who name="Nam Nguyen">nam.whoelse</who>
    <bug_when>2019-05-08 13:43:49 +0000</bug_when>
    <thetext>Hardware: Toradex Apalis iMX6
MACHINE = &quot;apalis-imx6&quot;</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>83773</commentid>
    <comment_count>2</comment_count>
    <who name="Ross Burton">ross.burton</who>
    <bug_when>2019-05-09 15:43:26 +0000</bug_when>
    <thetext>root@bob:~# ruby  -v
ruby 2.5.3p105 (2018-10-18 revision 65156) [x86_64-linux-gnu]

At least ruby for x86 in master works.

Can you replicate this with master?  Or in a qemu for a different machine?</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>83786</commentid>
    <comment_count>3</comment_count>
    <who name="Nam Nguyen">nam.whoelse</who>
    <bug_when>2019-05-10 14:19:01 +0000</bug_when>
    <thetext>Hi Ross,

I have attempted to run the latest version of ruby 2.5.3. It still yields the same issue. I&apos;ve built it with thud instead of rocko for this test.

Now for qemu, I&apos;ve done some digging and the platform I&quot;m using does not seem to be supported by qemu.

Best regards,

Nam</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>83788</commentid>
    <comment_count>4</comment_count>
    <who name="Ross Burton">ross.burton</who>
    <bug_when>2019-05-10 15:15:35 +0000</bug_when>
    <thetext>Can you try your setup but with MACHINE=qemux86-64 in a qemu to see if it is your distro or your machine that is breaking?  Also installing the debug symbols and attaching gdb would give a hint about where it is hanging.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>83795</commentid>
    <comment_count>5</comment_count>
    <who name="Nam Nguyen">nam.whoelse</who>
    <bug_when>2019-05-13 13:44:50 +0000</bug_when>
    <thetext>Hi Ross,

As you confirmed initially, it works in qemu mode (build with MACHINE=qemux86-64).

I forgot to mention one thing. I&apos;m building with the default poky distro.

I&apos;ve built the image again, but this time, adding debug tools and symbols by adding the following options in local.conf

EXTRA_IMAGE_FEATURES += &quot;tools-debug dbg-pkgs&quot;

it&apos;s confirmed during run time by running  &quot;opkg list | grep ruby&quot;

ruby - 2.4.4-r0
ruby-dbg - 2.4.4-r0

The debug symbols are installed by default as expected

I tried to run &quot;ruby -v&quot; again and the program continues to hang.

I proceeded with using gdb by running &quot;gdb /usr/bin/ruby&quot;

Inside gdb mode, I invoke &quot;run -v&quot;, the full output is as following:

GNU gdb (GDB) 8.0
Copyright (C) 2017 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later &lt;http://gnu.org/licenses/gpl.html&gt;
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.  Type &quot;show copying&quot;
and &quot;show warranty&quot; for details.
This GDB was configured as &quot;arm-poky-linux-gnueabi&quot;.
Type &quot;show configuration&quot; for configuration details.
For bug reporting instructions, please see:
&lt;http://www.gnu.org/software/gdb/bugs/&gt;.
Find the GDB manual and other documentation resources online at:
&lt;http://www.gnu.org/software/gdb/documentation/&gt;.
For help, type &quot;help&quot;.
Type &quot;apropos word&quot; to search for commands related to &quot;word&quot;...
Reading symbols from /usr/bin/ruby...Reading symbols from /usr/bin/.debug/ruby...done.
done.
(gdb) run -v
Starting program: /usr/bin/ruby -v
[Thread debugging using libthread_db enabled]
Using host libthread_db library &quot;/lib/libthread_db.so.1&quot;.

It also hangs inside gdb

Best regards,

Nam</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>83796</commentid>
    <comment_count>6</comment_count>
    <who name="Ross Burton">ross.burton</who>
    <bug_when>2019-05-13 13:47:09 +0000</bug_when>
    <thetext>When it hangs inside gdb, control-c it to interrupt and run &apos;bt&apos; to get the stack trace.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>83797</commentid>
    <comment_count>7</comment_count>
    <who name="Nam Nguyen">nam.whoelse</who>
    <bug_when>2019-05-13 14:44:07 +0000</bug_when>
    <thetext>Hi Ross,

Here is the results from running &quot;bt&quot;

(gdb) bt
#0  syscall () at ../sysdeps/unix/sysv/linux/arm/syscall.S:37
#1  0x76e8e5d4 in fill_random_bytes_syscall (seed=seed@entry=0x7efff018, size=size@entry=16, need_secure=need_secure@entry=1) at /usr/src/debug/ruby/2.4.4-r0/ruby-2.4.4/random.c:525
#2  0x76e8f6a8 in fill_random_bytes (need_secure=1, size=16, seed=0x7efff018) at /usr/src/debug/ruby/2.4.4-r0/ruby-2.4.4/random.c:541
#3  fill_random_seed (seed=seed@entry=0x7efff018, cnt=4) at /usr/src/debug/ruby/2.4.4-r0/ruby-2.4.4/random.c:555
#4  0x76e90f90 in Init_RandomSeedCore () at /usr/src/debug/ruby/2.4.4-r0/ruby-2.4.4/random.c:1524
#5  0x76e2d8d4 in rb_call_inits () at /usr/src/debug/ruby/2.4.4-r0/ruby-2.4.4/inits.c:20
#6  0x76e0fcf8 in ruby_setup () at /usr/src/debug/ruby/2.4.4-r0/ruby-2.4.4/eval.c:60
#7  0x76e11270 in ruby_init () at /usr/src/debug/ruby/2.4.4-r0/ruby-2.4.4/eval.c:76
#8  0x00010728 in main (argc=&lt;optimized out&gt;, argv=&lt;optimized out&gt;) at /usr/src/debug/ruby/2.4.4-r0/ruby-2.4.4/main.c:35

Nam</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>83798</commentid>
    <comment_count>8</comment_count>
    <who name="Ross Burton">ross.burton</who>
    <bug_when>2019-05-13 15:11:46 +0000</bug_when>
    <thetext>It&apos;s hanging trying to find enough random data to initialize.

A workaround is to install rng-tools, but that&apos;s very much a workaround unless the hardware has a hardware random number generator that can be used.  I&apos;d approach toradex and check if there is a HW RNG, and if so how to enable it.

As this is a toradex-specific bug and they don&apos;t use this bugzila, I&apos;m closing this bug.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>83801</commentid>
    <comment_count>9</comment_count>
    <who name="Nam Nguyen">nam.whoelse</who>
    <bug_when>2019-05-13 16:55:39 +0000</bug_when>
    <thetext>Hi Ross,

Thanks for the info.

Please let me know if there&apos;s anything I can do to help.

Nam</thetext>
  </long_desc>
      
      

    </bug>

</bugzilla>