<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>i.MX Processors中的主题 Re: Run shell script at boot in Android 9.0 on i.MX8M Mini Evk</title>
    <link>https://community.nxp.com/t5/i-MX-Processors/Run-shell-script-at-boot-in-Android-9-0-on-i-MX8M-Mini-Evk/m-p/944825#M141326</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;First I was trying to run a script from from vendor/bin.&lt;/P&gt;&lt;P&gt;Now I am trying to run from system/bin. But still facing same issue.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P style="margin-top: 0; margin-bottom: 0; padding: 0; min-height: 8pt;"&gt;&lt;SPAN&gt;&lt;STRONG style="text-decoration: underline; "&gt;Following are the changes in AOSP:&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin-top: 0; margin-bottom: 0; padding: 0; min-height: 8pt;"&gt;&lt;/P&gt;&lt;P style="margin-top: 0; margin-bottom: 0;"&gt;&lt;STRONG&gt;File : Android_AOSP_build/device/fsl/imx8m/evk_8mm/init.rc &lt;/STRONG&gt;&lt;/P&gt;&lt;P style="margin-top: 0; margin-bottom: 0;"&gt;(Added one service named &lt;EM&gt;gea3appservicefromsystem&lt;/EM&gt; in init.rc)&lt;BR /&gt; &lt;/P&gt;&lt;P style="margin-top: 0; margin-bottom: 0;"&gt;&lt;/P&gt;&lt;DIV&gt;&lt;EM&gt;service gea3appservicefromsystem /system/bin/sh /system/bin/run&lt;BR /&gt; &amp;nbsp;&amp;nbsp;&amp;nbsp; class main&lt;BR /&gt; &amp;nbsp;&amp;nbsp;&amp;nbsp; user root&lt;BR /&gt; &amp;nbsp;&amp;nbsp;&amp;nbsp; group root&lt;BR /&gt; &amp;nbsp;&amp;nbsp;&amp;nbsp; oneshot&lt;/EM&gt;&lt;/DIV&gt;&lt;P style="margin-top: 0; margin-bottom: 0; padding: 0; min-height: 8pt;"&gt;&amp;nbsp;&lt;/P&gt;&lt;P style="margin-top: 0; margin-bottom: 0;"&gt;&lt;STRONG&gt;File : Android_AOSP_build/device/fsl/imx8m/evk_8mm/sepolicy/&lt;SPAN&gt;gea3appservicefromsystem&lt;/SPAN&gt;.te &lt;/STRONG&gt;&lt;/P&gt;&lt;P style="margin-top: 0; margin-bottom: 0;"&gt;(Created new SELinux domain for service )&lt;BR /&gt; &lt;/P&gt;&lt;P style="margin-top: 0; margin-bottom: 0;"&gt;&lt;/P&gt;&lt;DIV&gt;&lt;EM&gt;# gea3app service&lt;BR /&gt; type gea3appservicefromsystem, coredomain, domain;&lt;BR /&gt; type gea3appservicefromsystem_exec, exec_type, file_type;&lt;BR /&gt; init_daemon_domain(gea3appservicefromsystem)&lt;BR /&gt; domain_auto_trans(init, shell_exec, gea3appservicefromsystem)&lt;/EM&gt;&lt;/DIV&gt;&lt;P style="margin-top: 0; margin-bottom: 0; padding: 0; min-height: 8pt;"&gt;&amp;nbsp;&lt;/P&gt;&lt;P style="margin-top: 0; margin-bottom: 0;"&gt;&lt;STRONG&gt;File : Android_AOSP_build/device/fsl/imx8m/evk_8mm/sepolicy/file_contexts&lt;/STRONG&gt;&lt;/P&gt;&lt;P style="margin-top: 0; margin-bottom: 0;"&gt;(&lt;SPAN&gt;To ensure executable properly labeled so SELinux runs the service in the proper domain&lt;/SPAN&gt;)&lt;/P&gt;&lt;P style="margin-top: 0; margin-bottom: 0;"&gt;&lt;STRONG&gt;&lt;BR /&gt; &lt;/STRONG&gt;&lt;/P&gt;&lt;P style="margin-top: 0; margin-bottom: 0;"&gt;&lt;EM&gt;&lt;SPAN&gt;/system/bin/run&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; u:object_r:gea3appservicefromsystem_exec:s0&lt;/SPAN&gt;&lt;/EM&gt;&lt;/P&gt;&lt;P style="margin-top: 0; margin-bottom: 0; padding: 0; min-height: 8pt;"&gt;&lt;/P&gt;&lt;P style="margin-top: 0; margin-bottom: 0; padding: 0; min-height: 8pt;"&gt;&lt;SPAN&gt;&lt;STRONG&gt;File : Android_AOSP_build/out/target/product/evk_8mm/system/bin/run&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin-top: 0; margin-bottom: 0; padding: 0; min-height: 8pt;"&gt;(This is the script which will run at startup)&lt;/P&gt;&lt;P style="margin-top: 0; margin-bottom: 0; padding: 0; min-height: 8pt;"&gt;&lt;BR /&gt; &lt;/P&gt;&lt;DIV&gt;&lt;EM&gt;#!/bin/sh&lt;BR /&gt; mkdir /data/local/tmp/DirFromSystem&lt;BR /&gt; #Run GEA Application in background&lt;BR /&gt; ./gea3app &amp;amp;&lt;/EM&gt;&lt;/DIV&gt;&lt;P style="margin-top: 0; margin-bottom: 0; padding: 0; min-height: 8pt;"&gt;&lt;/P&gt;&lt;P style="margin-top: 0; margin-bottom: 0; padding: 0; min-height: 8pt;"&gt;&lt;STRONG&gt;&lt;SPAN&gt;File : /home/bruvitiadmin/Android_AOSP_build/device/fsl/imx8m/evk_8mm&lt;/SPAN&gt;/BoardConfig.mk&lt;/STRONG&gt;&lt;/P&gt;&lt;P style="margin-top: 0; margin-bottom: 0; padding: 0; min-height: 8pt;"&gt;(Changed mode of SELinux from enforcing mode to permissive mode)&lt;/P&gt;&lt;P style="margin-top: 0; margin-bottom: 0; padding: 0; min-height: 8pt;"&gt;&lt;STRONG&gt;&lt;BR /&gt; &lt;/STRONG&gt;&lt;/P&gt;&lt;P style="margin-top: 0; margin-bottom: 0; padding: 0; min-height: 8pt;"&gt;&lt;SPAN&gt;&lt;EM&gt;BOARD_KERNEL_CMDLINE += androidboot.selinux=permissive&lt;/EM&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin-top: 0; margin-bottom: 0; padding: 0; min-height: 8pt;"&gt;&lt;/P&gt;&lt;P style="margin-top: 0; margin-bottom: 0; padding: 0; min-height: 8pt;"&gt;&lt;STRONG&gt;File : &lt;SPAN&gt; Android_AOSP_build/device/fsl/imx8m/sepolicy&lt;/SPAN&gt;/init.te&lt;/STRONG&gt;&lt;/P&gt;&lt;P style="margin-top: 0; margin-bottom: 0; padding: 0; min-height: 8pt;"&gt;(Allow transition for a service to execute)&lt;/P&gt;&lt;P style="margin-top: 0; margin-bottom: 0; padding: 0; min-height: 8pt;"&gt;&lt;/P&gt;&lt;P style="margin-top: 0; margin-bottom: 0; padding: 0; min-height: 8pt;"&gt;&lt;SPAN&gt;&lt;EM&gt;allow init gea3appservicefromsystem_exec:process {transition};&lt;/EM&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin-top: 0; margin-bottom: 0; padding: 0; min-height: 8pt;"&gt;&lt;BR /&gt; &lt;/P&gt;&lt;P style="margin-top: 0; margin-bottom: 0; padding: 0; min-height: 8pt;"&gt;&lt;/P&gt;&lt;P style="margin-top: 0; margin-bottom: 0; padding: 0; min-height: 8pt;"&gt;We build AOSP and flash image. We found that script runs at bootup but application failed to start.&lt;/P&gt;&lt;P style="margin-top: 0; margin-bottom: 0; padding: 0; min-height: 8pt;"&gt;&lt;/P&gt;&lt;P style="margin-top: 0; margin-bottom: 0; padding: 0; min-height: 8pt;"&gt;&lt;STRONG&gt;Following are the logs:&lt;/STRONG&gt;&lt;/P&gt;&lt;P style="margin-top: 0; margin-bottom: 0; padding: 0; min-height: 8pt;"&gt;&lt;STRONG&gt;&lt;BR /&gt; &lt;/STRONG&gt;&lt;/P&gt;&lt;DIV&gt;[&amp;nbsp;&amp;nbsp; 19.028563] type=1400 audit(25.088:22): avc: denied { getattr } for pid=3082 comm="sh" path="/system/bin/toybox" dev="dm-0" ino=120 scontext=u:r:gea3appservicefromsystem:s0 tcontext=u:object_r:toolbox_exec:s0 tclass=file permissive=1 &lt;BR /&gt; [&amp;nbsp;&amp;nbsp; 19.049710] type=1400 audit(25.088:22): avc: denied { getattr } for pid=3082 comm="sh" path="/system/bin/toybox" dev="dm-0" ino=120 scontext=u:r:gea3appservicefromsystem:s0 tcontext=u:object_r:toolbox_exec:s0 tclass=file permissive=1 &lt;BR /&gt; [&amp;nbsp;&amp;nbsp; 19.070570] type=1400 audit(25.088:23): avc: denied { execute } for pid=3082 comm="sh" name="toybox" dev="dm-0" ino=120 scontext=u:r:gea3appservicefromsystem:s0 tcontext=u:object_r:toolbox_exec:s0 tclass=file permissive=1 &lt;BR /&gt; [&amp;nbsp;&amp;nbsp; 19.090694] type=1400 audit(25.088:23): avc: denied { execute } for pid=3082 comm="sh" name="toybox" dev="dm-0" ino=120 scontext=u:r:gea3appservicefromsystem:s0 tcontext=u:object_r:toolbox_exec:s0 tclass=file permissive=1&lt;/DIV&gt;&lt;P style="margin-top: 0; margin-bottom: 0; padding: 0; min-height: 8pt;"&gt;&lt;/P&gt;&lt;P style="margin-top: 0; margin-bottom: 0; padding: 0; min-height: 8pt;"&gt;&lt;STRONG&gt;When we start service manually in superuser, script run but application fails to start. we get following logs :&lt;/STRONG&gt;&lt;/P&gt;&lt;P style="margin-top: 0; margin-bottom: 0; padding: 0; min-height: 8pt;"&gt;&lt;/P&gt;&lt;DIV&gt;130|evk_8mm:/data/local/tmp # start gea3appservicefromsystem&lt;BR /&gt; [&amp;nbsp; 143.274084] init: Received control message 'start' for 'gea3appservicefromsystem' from pid: 4267 (start gea3appservicefromsystem)&lt;BR /&gt; [&amp;nbsp; 143.286215] init: starting service 'gea3appservicefromsystem'...&lt;BR /&gt; [&amp;nbsp; 143.293347] type=1400 audit(1565344652.192:66): avc: denied { dac_read_search } for pid=4227 comm="main" capability=2 scontext=u:r:zygote:s0 tcontext=u:r:zygote:s0 tclass=capability permissive=1&lt;BR /&gt; [&amp;nbsp; 143.310758] type=1400 audit(1565344745.140:67): avc: denied { dac_read_search } for pid=1 comm="init" capability=2 scontext=u:r:init:s0 tcontext=u:r:init:s0 tclass=capability permissive=1&lt;BR /&gt; [&amp;nbsp; 143.327813] type=1400 audit(1565344745.140:67): avc: denied { dac_read_search } for pid=1 comm="init" capability=2 scontext=u:r:init:s0 tcontext=u:r:init:s0 tclass=capability permissive=1&lt;BR /&gt; [&amp;nbsp; 143.328017] audit: audit_lost=12 audit_rate_limit=5 audit_backlog_limit=64&lt;BR /&gt; [&amp;nbsp; 143.344601] type=1400 audit(1565344745.164:68): avc: denied { getattr } for pid=4268 comm="sh" path="/system/bin/toybox" dev="dm-0" ino=120 scontext=u:r:gea3appservicefromsystem:s0 tcontext=u:object_r:toolbox_exec:s0 tclass=file permissive=1&lt;BR /&gt; [&amp;nbsp; 143.351445] audit: rate limit exceeded&lt;BR /&gt; [&amp;nbsp; 143.373387] type=1400 audit(1565344745.164:68): avc: denied { getattr } for pid=4268 comm="sh" path="/system/bin/toybox" dev="dm-0" ino=120 scontext=u:r:gea3appservicefromsystem:s0 tcontext=u:object_r:toolbox_exec:s0 tclass=file permissive=1&lt;BR /&gt; evk_8mm:/data/local/tmp # [&amp;nbsp; 143.387862] init: Service 'gea3appservicefromsystem' (pid 4268) exited with status 127&lt;BR /&gt; [&amp;nbsp; 143.398021] type=1400 audit(1565344745.164:69): avc: denied { execute } for pid=4268 comm="sh" name="toybox" dev="dm-0" ino=120 scontext=u:r:gea3appservicefromsystem:s0 tcontext=u:object_r:toolbox_exec:s0 tclass=file permissive=1&lt;BR /&gt; [&amp;nbsp; 143.428640] type=1400 audit(1565344745.164:69): avc: denied { execute } for pid=4268 comm="sh" name="toybox" dev="dm-0" ino=120 scontext=u:r:gea3appservicefromsystem:s0 tcontext=u:object_r:toolbox_exec:s0 tclass=file permissive=1&lt;BR /&gt; [&amp;nbsp; 143.449068] type=1400 audit(1565344745.164:70): avc: denied { read open } for pid=4269 comm="sh" path="/system/bin/toybox" dev="dm-0" ino=120 scontext=u:r:gea3appservicefromsystem:s0 tcontext=u:object_r:toolbox_exec:s0 tclass=file permissive=1&lt;BR /&gt; [&amp;nbsp; 143.470883] type=1400 audit(1565344745.164:70): avc: denied { read open } for pid=4269 comm="sh" path="/system/bin/toybox" dev="dm-0" ino=120 scontext=u:r:gea3appservicefromsystem:s0 tcontext=u:object_r:toolbox_exec:s0 tclass=file permissive=1&lt;BR /&gt; [&amp;nbsp; 143.492470] type=1400 audit(1565344745.164:71): avc: denied { execute_no_trans } for pid=4269 comm="sh" path="/system/bin/toybox" dev="dm-0" ino=120 scontext=u:r:gea3appservicefromsystem:s0 tcontext=u:object_r:toolbox_exec:s0 tclass=file permissive=1&lt;/DIV&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Fri, 09 Aug 2019 11:57:54 GMT</pubDate>
    <dc:creator>abhijit_thorat</dc:creator>
    <dc:date>2019-08-09T11:57:54Z</dc:date>
    <item>
      <title>Run shell script at boot in Android 9.0 on i.MX8M Mini Evk</title>
      <link>https://community.nxp.com/t5/i-MX-Processors/Run-shell-script-at-boot-in-Android-9-0-on-i-MX8M-Mini-Evk/m-p/944824#M141325</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;I am using iMX 8 Mini EVK for my Project. I build Android 9.0 from AOSP for this board.&lt;/P&gt;&lt;P&gt;Now I want to run a script at boot.&lt;/P&gt;&lt;P&gt;I did following changes in files but still I am facing an issue.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;File : Android_AOSP_build/device/fsl/imx8m/evk_8mm/init.rc&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;service gea3appservice /vendor/bin/sh /vendor/bin/run.sh&lt;/EM&gt;&lt;BR /&gt;&lt;EM&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; class late_start&lt;/EM&gt;&lt;BR /&gt;&lt;EM&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; user root system&lt;/EM&gt;&lt;BR /&gt;&lt;EM&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; group root system&lt;/EM&gt;&lt;BR /&gt;&lt;EM&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; oneshot&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;File : Android_AOSP_build/device/fsl/imx8m/evk_8mm/sepolicy/gea3appservice.te&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;# gea3app service&lt;/EM&gt;&lt;BR /&gt;&lt;EM&gt;type gea3appservice, domain;&lt;/EM&gt;&lt;BR /&gt;&lt;EM&gt;type gea3appservice_exec, exec_type, vendor_file_type, file_type;&lt;/EM&gt;&lt;BR /&gt;&lt;EM&gt;init_daemon_domain(gea3appservice)&lt;/EM&gt;&lt;BR /&gt;&lt;EM&gt;domain_auto_trans(init, vendor_shell_exec, gea3appservice)&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;File : Android_AOSP_build/device/fsl/imx8m/evk_8mm/sepolicy/file_contexts&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;/vendor/bin/run.sh&amp;nbsp;&amp;nbsp; u:object_r:gea3appservice_exec:s0&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;When I manually run service I get following error :&lt;EM&gt; &lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;[&amp;nbsp; 134.010656] type=1400 audit(1564667688.236:3740): avc: denied { dac_read_search } for pid=1 comm="init" capability=2 scontext=u:r:init:s0 tcontext=u:r:init:s0 tclass=capability permissive=1&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Do anyone know this issue?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I tried with the approach suggested by Android developer site&lt;/P&gt;&lt;P&gt;&lt;A class="link-titled" href="https://source.android.com/security/selinux/device-policy" title="https://source.android.com/security/selinux/device-policy"&gt;Writing SELinux Policy &amp;nbsp;|&amp;nbsp; Android Open Source Project&lt;/A&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;But I get following error&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;libsepol.report_failure: neverallow on line 1002 of system/sepolicy/public/domain.te (or line 11242 of policy.conf) violated by allow gea3appservice gea3appservice_exec:file { execute entrypoint };&lt;/STRONG&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 02 Aug 2019 10:47:12 GMT</pubDate>
      <guid>https://community.nxp.com/t5/i-MX-Processors/Run-shell-script-at-boot-in-Android-9-0-on-i-MX8M-Mini-Evk/m-p/944824#M141325</guid>
      <dc:creator>abhijit_thorat</dc:creator>
      <dc:date>2019-08-02T10:47:12Z</dc:date>
    </item>
    <item>
      <title>Re: Run shell script at boot in Android 9.0 on i.MX8M Mini Evk</title>
      <link>https://community.nxp.com/t5/i-MX-Processors/Run-shell-script-at-boot-in-Android-9-0-on-i-MX8M-Mini-Evk/m-p/944825#M141326</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;First I was trying to run a script from from vendor/bin.&lt;/P&gt;&lt;P&gt;Now I am trying to run from system/bin. But still facing same issue.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P style="margin-top: 0; margin-bottom: 0; padding: 0; min-height: 8pt;"&gt;&lt;SPAN&gt;&lt;STRONG style="text-decoration: underline; "&gt;Following are the changes in AOSP:&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin-top: 0; margin-bottom: 0; padding: 0; min-height: 8pt;"&gt;&lt;/P&gt;&lt;P style="margin-top: 0; margin-bottom: 0;"&gt;&lt;STRONG&gt;File : Android_AOSP_build/device/fsl/imx8m/evk_8mm/init.rc &lt;/STRONG&gt;&lt;/P&gt;&lt;P style="margin-top: 0; margin-bottom: 0;"&gt;(Added one service named &lt;EM&gt;gea3appservicefromsystem&lt;/EM&gt; in init.rc)&lt;BR /&gt; &lt;/P&gt;&lt;P style="margin-top: 0; margin-bottom: 0;"&gt;&lt;/P&gt;&lt;DIV&gt;&lt;EM&gt;service gea3appservicefromsystem /system/bin/sh /system/bin/run&lt;BR /&gt; &amp;nbsp;&amp;nbsp;&amp;nbsp; class main&lt;BR /&gt; &amp;nbsp;&amp;nbsp;&amp;nbsp; user root&lt;BR /&gt; &amp;nbsp;&amp;nbsp;&amp;nbsp; group root&lt;BR /&gt; &amp;nbsp;&amp;nbsp;&amp;nbsp; oneshot&lt;/EM&gt;&lt;/DIV&gt;&lt;P style="margin-top: 0; margin-bottom: 0; padding: 0; min-height: 8pt;"&gt;&amp;nbsp;&lt;/P&gt;&lt;P style="margin-top: 0; margin-bottom: 0;"&gt;&lt;STRONG&gt;File : Android_AOSP_build/device/fsl/imx8m/evk_8mm/sepolicy/&lt;SPAN&gt;gea3appservicefromsystem&lt;/SPAN&gt;.te &lt;/STRONG&gt;&lt;/P&gt;&lt;P style="margin-top: 0; margin-bottom: 0;"&gt;(Created new SELinux domain for service )&lt;BR /&gt; &lt;/P&gt;&lt;P style="margin-top: 0; margin-bottom: 0;"&gt;&lt;/P&gt;&lt;DIV&gt;&lt;EM&gt;# gea3app service&lt;BR /&gt; type gea3appservicefromsystem, coredomain, domain;&lt;BR /&gt; type gea3appservicefromsystem_exec, exec_type, file_type;&lt;BR /&gt; init_daemon_domain(gea3appservicefromsystem)&lt;BR /&gt; domain_auto_trans(init, shell_exec, gea3appservicefromsystem)&lt;/EM&gt;&lt;/DIV&gt;&lt;P style="margin-top: 0; margin-bottom: 0; padding: 0; min-height: 8pt;"&gt;&amp;nbsp;&lt;/P&gt;&lt;P style="margin-top: 0; margin-bottom: 0;"&gt;&lt;STRONG&gt;File : Android_AOSP_build/device/fsl/imx8m/evk_8mm/sepolicy/file_contexts&lt;/STRONG&gt;&lt;/P&gt;&lt;P style="margin-top: 0; margin-bottom: 0;"&gt;(&lt;SPAN&gt;To ensure executable properly labeled so SELinux runs the service in the proper domain&lt;/SPAN&gt;)&lt;/P&gt;&lt;P style="margin-top: 0; margin-bottom: 0;"&gt;&lt;STRONG&gt;&lt;BR /&gt; &lt;/STRONG&gt;&lt;/P&gt;&lt;P style="margin-top: 0; margin-bottom: 0;"&gt;&lt;EM&gt;&lt;SPAN&gt;/system/bin/run&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; u:object_r:gea3appservicefromsystem_exec:s0&lt;/SPAN&gt;&lt;/EM&gt;&lt;/P&gt;&lt;P style="margin-top: 0; margin-bottom: 0; padding: 0; min-height: 8pt;"&gt;&lt;/P&gt;&lt;P style="margin-top: 0; margin-bottom: 0; padding: 0; min-height: 8pt;"&gt;&lt;SPAN&gt;&lt;STRONG&gt;File : Android_AOSP_build/out/target/product/evk_8mm/system/bin/run&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin-top: 0; margin-bottom: 0; padding: 0; min-height: 8pt;"&gt;(This is the script which will run at startup)&lt;/P&gt;&lt;P style="margin-top: 0; margin-bottom: 0; padding: 0; min-height: 8pt;"&gt;&lt;BR /&gt; &lt;/P&gt;&lt;DIV&gt;&lt;EM&gt;#!/bin/sh&lt;BR /&gt; mkdir /data/local/tmp/DirFromSystem&lt;BR /&gt; #Run GEA Application in background&lt;BR /&gt; ./gea3app &amp;amp;&lt;/EM&gt;&lt;/DIV&gt;&lt;P style="margin-top: 0; margin-bottom: 0; padding: 0; min-height: 8pt;"&gt;&lt;/P&gt;&lt;P style="margin-top: 0; margin-bottom: 0; padding: 0; min-height: 8pt;"&gt;&lt;STRONG&gt;&lt;SPAN&gt;File : /home/bruvitiadmin/Android_AOSP_build/device/fsl/imx8m/evk_8mm&lt;/SPAN&gt;/BoardConfig.mk&lt;/STRONG&gt;&lt;/P&gt;&lt;P style="margin-top: 0; margin-bottom: 0; padding: 0; min-height: 8pt;"&gt;(Changed mode of SELinux from enforcing mode to permissive mode)&lt;/P&gt;&lt;P style="margin-top: 0; margin-bottom: 0; padding: 0; min-height: 8pt;"&gt;&lt;STRONG&gt;&lt;BR /&gt; &lt;/STRONG&gt;&lt;/P&gt;&lt;P style="margin-top: 0; margin-bottom: 0; padding: 0; min-height: 8pt;"&gt;&lt;SPAN&gt;&lt;EM&gt;BOARD_KERNEL_CMDLINE += androidboot.selinux=permissive&lt;/EM&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin-top: 0; margin-bottom: 0; padding: 0; min-height: 8pt;"&gt;&lt;/P&gt;&lt;P style="margin-top: 0; margin-bottom: 0; padding: 0; min-height: 8pt;"&gt;&lt;STRONG&gt;File : &lt;SPAN&gt; Android_AOSP_build/device/fsl/imx8m/sepolicy&lt;/SPAN&gt;/init.te&lt;/STRONG&gt;&lt;/P&gt;&lt;P style="margin-top: 0; margin-bottom: 0; padding: 0; min-height: 8pt;"&gt;(Allow transition for a service to execute)&lt;/P&gt;&lt;P style="margin-top: 0; margin-bottom: 0; padding: 0; min-height: 8pt;"&gt;&lt;/P&gt;&lt;P style="margin-top: 0; margin-bottom: 0; padding: 0; min-height: 8pt;"&gt;&lt;SPAN&gt;&lt;EM&gt;allow init gea3appservicefromsystem_exec:process {transition};&lt;/EM&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin-top: 0; margin-bottom: 0; padding: 0; min-height: 8pt;"&gt;&lt;BR /&gt; &lt;/P&gt;&lt;P style="margin-top: 0; margin-bottom: 0; padding: 0; min-height: 8pt;"&gt;&lt;/P&gt;&lt;P style="margin-top: 0; margin-bottom: 0; padding: 0; min-height: 8pt;"&gt;We build AOSP and flash image. We found that script runs at bootup but application failed to start.&lt;/P&gt;&lt;P style="margin-top: 0; margin-bottom: 0; padding: 0; min-height: 8pt;"&gt;&lt;/P&gt;&lt;P style="margin-top: 0; margin-bottom: 0; padding: 0; min-height: 8pt;"&gt;&lt;STRONG&gt;Following are the logs:&lt;/STRONG&gt;&lt;/P&gt;&lt;P style="margin-top: 0; margin-bottom: 0; padding: 0; min-height: 8pt;"&gt;&lt;STRONG&gt;&lt;BR /&gt; &lt;/STRONG&gt;&lt;/P&gt;&lt;DIV&gt;[&amp;nbsp;&amp;nbsp; 19.028563] type=1400 audit(25.088:22): avc: denied { getattr } for pid=3082 comm="sh" path="/system/bin/toybox" dev="dm-0" ino=120 scontext=u:r:gea3appservicefromsystem:s0 tcontext=u:object_r:toolbox_exec:s0 tclass=file permissive=1 &lt;BR /&gt; [&amp;nbsp;&amp;nbsp; 19.049710] type=1400 audit(25.088:22): avc: denied { getattr } for pid=3082 comm="sh" path="/system/bin/toybox" dev="dm-0" ino=120 scontext=u:r:gea3appservicefromsystem:s0 tcontext=u:object_r:toolbox_exec:s0 tclass=file permissive=1 &lt;BR /&gt; [&amp;nbsp;&amp;nbsp; 19.070570] type=1400 audit(25.088:23): avc: denied { execute } for pid=3082 comm="sh" name="toybox" dev="dm-0" ino=120 scontext=u:r:gea3appservicefromsystem:s0 tcontext=u:object_r:toolbox_exec:s0 tclass=file permissive=1 &lt;BR /&gt; [&amp;nbsp;&amp;nbsp; 19.090694] type=1400 audit(25.088:23): avc: denied { execute } for pid=3082 comm="sh" name="toybox" dev="dm-0" ino=120 scontext=u:r:gea3appservicefromsystem:s0 tcontext=u:object_r:toolbox_exec:s0 tclass=file permissive=1&lt;/DIV&gt;&lt;P style="margin-top: 0; margin-bottom: 0; padding: 0; min-height: 8pt;"&gt;&lt;/P&gt;&lt;P style="margin-top: 0; margin-bottom: 0; padding: 0; min-height: 8pt;"&gt;&lt;STRONG&gt;When we start service manually in superuser, script run but application fails to start. we get following logs :&lt;/STRONG&gt;&lt;/P&gt;&lt;P style="margin-top: 0; margin-bottom: 0; padding: 0; min-height: 8pt;"&gt;&lt;/P&gt;&lt;DIV&gt;130|evk_8mm:/data/local/tmp # start gea3appservicefromsystem&lt;BR /&gt; [&amp;nbsp; 143.274084] init: Received control message 'start' for 'gea3appservicefromsystem' from pid: 4267 (start gea3appservicefromsystem)&lt;BR /&gt; [&amp;nbsp; 143.286215] init: starting service 'gea3appservicefromsystem'...&lt;BR /&gt; [&amp;nbsp; 143.293347] type=1400 audit(1565344652.192:66): avc: denied { dac_read_search } for pid=4227 comm="main" capability=2 scontext=u:r:zygote:s0 tcontext=u:r:zygote:s0 tclass=capability permissive=1&lt;BR /&gt; [&amp;nbsp; 143.310758] type=1400 audit(1565344745.140:67): avc: denied { dac_read_search } for pid=1 comm="init" capability=2 scontext=u:r:init:s0 tcontext=u:r:init:s0 tclass=capability permissive=1&lt;BR /&gt; [&amp;nbsp; 143.327813] type=1400 audit(1565344745.140:67): avc: denied { dac_read_search } for pid=1 comm="init" capability=2 scontext=u:r:init:s0 tcontext=u:r:init:s0 tclass=capability permissive=1&lt;BR /&gt; [&amp;nbsp; 143.328017] audit: audit_lost=12 audit_rate_limit=5 audit_backlog_limit=64&lt;BR /&gt; [&amp;nbsp; 143.344601] type=1400 audit(1565344745.164:68): avc: denied { getattr } for pid=4268 comm="sh" path="/system/bin/toybox" dev="dm-0" ino=120 scontext=u:r:gea3appservicefromsystem:s0 tcontext=u:object_r:toolbox_exec:s0 tclass=file permissive=1&lt;BR /&gt; [&amp;nbsp; 143.351445] audit: rate limit exceeded&lt;BR /&gt; [&amp;nbsp; 143.373387] type=1400 audit(1565344745.164:68): avc: denied { getattr } for pid=4268 comm="sh" path="/system/bin/toybox" dev="dm-0" ino=120 scontext=u:r:gea3appservicefromsystem:s0 tcontext=u:object_r:toolbox_exec:s0 tclass=file permissive=1&lt;BR /&gt; evk_8mm:/data/local/tmp # [&amp;nbsp; 143.387862] init: Service 'gea3appservicefromsystem' (pid 4268) exited with status 127&lt;BR /&gt; [&amp;nbsp; 143.398021] type=1400 audit(1565344745.164:69): avc: denied { execute } for pid=4268 comm="sh" name="toybox" dev="dm-0" ino=120 scontext=u:r:gea3appservicefromsystem:s0 tcontext=u:object_r:toolbox_exec:s0 tclass=file permissive=1&lt;BR /&gt; [&amp;nbsp; 143.428640] type=1400 audit(1565344745.164:69): avc: denied { execute } for pid=4268 comm="sh" name="toybox" dev="dm-0" ino=120 scontext=u:r:gea3appservicefromsystem:s0 tcontext=u:object_r:toolbox_exec:s0 tclass=file permissive=1&lt;BR /&gt; [&amp;nbsp; 143.449068] type=1400 audit(1565344745.164:70): avc: denied { read open } for pid=4269 comm="sh" path="/system/bin/toybox" dev="dm-0" ino=120 scontext=u:r:gea3appservicefromsystem:s0 tcontext=u:object_r:toolbox_exec:s0 tclass=file permissive=1&lt;BR /&gt; [&amp;nbsp; 143.470883] type=1400 audit(1565344745.164:70): avc: denied { read open } for pid=4269 comm="sh" path="/system/bin/toybox" dev="dm-0" ino=120 scontext=u:r:gea3appservicefromsystem:s0 tcontext=u:object_r:toolbox_exec:s0 tclass=file permissive=1&lt;BR /&gt; [&amp;nbsp; 143.492470] type=1400 audit(1565344745.164:71): avc: denied { execute_no_trans } for pid=4269 comm="sh" path="/system/bin/toybox" dev="dm-0" ino=120 scontext=u:r:gea3appservicefromsystem:s0 tcontext=u:object_r:toolbox_exec:s0 tclass=file permissive=1&lt;/DIV&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 09 Aug 2019 11:57:54 GMT</pubDate>
      <guid>https://community.nxp.com/t5/i-MX-Processors/Run-shell-script-at-boot-in-Android-9-0-on-i-MX8M-Mini-Evk/m-p/944825#M141326</guid>
      <dc:creator>abhijit_thorat</dc:creator>
      <dc:date>2019-08-09T11:57:54Z</dc:date>
    </item>
    <item>
      <title>Re: Run shell script at boot in Android 9.0 on i.MX8M Mini Evk</title>
      <link>https://community.nxp.com/t5/i-MX-Processors/Run-shell-script-at-boot-in-Android-9-0-on-i-MX8M-Mini-Evk/m-p/944826#M141327</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hello,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Have you remounted Android to have permission to modify the system path?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;You can make it through adb.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Best regards,&lt;/P&gt;&lt;P&gt;Diego&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 09 Aug 2019 21:06:08 GMT</pubDate>
      <guid>https://community.nxp.com/t5/i-MX-Processors/Run-shell-script-at-boot-in-Android-9-0-on-i-MX8M-Mini-Evk/m-p/944826#M141327</guid>
      <dc:creator>diegoadrian</dc:creator>
      <dc:date>2019-08-09T21:06:08Z</dc:date>
    </item>
    <item>
      <title>Re: Run shell script at boot in Android 9.0 on i.MX8M Mini Evk</title>
      <link>https://community.nxp.com/t5/i-MX-Processors/Run-shell-script-at-boot-in-Android-9-0-on-i-MX8M-Mini-Evk/m-p/944827#M141328</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;No. We didn't remount Android.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;But now we change the way to run script.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;We refer below link:&lt;/P&gt;&lt;P&gt;&lt;A class="link-titled" href="https://android.stackexchange.com/questions/184074/selinux-prevents-my-init-rc-exec-command-to-execute" title="https://android.stackexchange.com/questions/184074/selinux-prevents-my-init-rc-exec-command-to-execute"&gt;shell - SELinux prevents my init.rc exec command to execute - Android Enthusiasts Stack Exchange&lt;/A&gt;&amp;nbsp;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 11 Sep 2019 07:39:51 GMT</pubDate>
      <guid>https://community.nxp.com/t5/i-MX-Processors/Run-shell-script-at-boot-in-Android-9-0-on-i-MX8M-Mini-Evk/m-p/944827#M141328</guid>
      <dc:creator>abhijit_thorat</dc:creator>
      <dc:date>2019-09-11T07:39:51Z</dc:date>
    </item>
    <item>
      <title>Re: Run shell script at boot in Android 9.0 on i.MX8M Mini Evk</title>
      <link>https://community.nxp.com/t5/i-MX-Processors/Run-shell-script-at-boot-in-Android-9-0-on-i-MX8M-Mini-Evk/m-p/944828#M141329</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hello,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Did you solve the problem? Or are you willing to disable SELinux?&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Best regards,&lt;/P&gt;&lt;P&gt;Diego.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 11 Sep 2019 20:15:35 GMT</pubDate>
      <guid>https://community.nxp.com/t5/i-MX-Processors/Run-shell-script-at-boot-in-Android-9-0-on-i-MX8M-Mini-Evk/m-p/944828#M141329</guid>
      <dc:creator>diegoadrian</dc:creator>
      <dc:date>2019-09-11T20:15:35Z</dc:date>
    </item>
    <item>
      <title>Re: Run shell script at boot in Android 9.0 on i.MX8M Mini Evk</title>
      <link>https://community.nxp.com/t5/i-MX-Processors/Run-shell-script-at-boot-in-Android-9-0-on-i-MX8M-Mini-Evk/m-p/944829#M141330</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Yes I solved the issue &lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 12 Nov 2019 10:34:34 GMT</pubDate>
      <guid>https://community.nxp.com/t5/i-MX-Processors/Run-shell-script-at-boot-in-Android-9-0-on-i-MX8M-Mini-Evk/m-p/944829#M141330</guid>
      <dc:creator>abhijit_thorat</dc:creator>
      <dc:date>2019-11-12T10:34:34Z</dc:date>
    </item>
    <item>
      <title>Re: Run shell script at boot in Android 9.0 on i.MX8M Mini Evk</title>
      <link>https://community.nxp.com/t5/i-MX-Processors/Run-shell-script-at-boot-in-Android-9-0-on-i-MX8M-Mini-Evk/m-p/944830#M141331</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi ,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;I got same error. can you tell me the solution for this.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Best regards,&lt;/P&gt;&lt;P&gt;N.Suresh.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 12 May 2020 12:17:43 GMT</pubDate>
      <guid>https://community.nxp.com/t5/i-MX-Processors/Run-shell-script-at-boot-in-Android-9-0-on-i-MX8M-Mini-Evk/m-p/944830#M141331</guid>
      <dc:creator>nayanasuresh455</dc:creator>
      <dc:date>2020-05-12T12:17:43Z</dc:date>
    </item>
    <item>
      <title>Re: Run shell script at boot in Android 9.0 on i.MX8M Mini Evk</title>
      <link>https://community.nxp.com/t5/i-MX-Processors/Run-shell-script-at-boot-in-Android-9-0-on-i-MX8M-Mini-Evk/m-p/1523585#M195259</link>
      <description>&lt;P&gt;I got the same error in AOSP12,&amp;nbsp;&lt;SPAN&gt;can plese you tell me the solution for this&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Fri, 16 Sep 2022 10:18:02 GMT</pubDate>
      <guid>https://community.nxp.com/t5/i-MX-Processors/Run-shell-script-at-boot-in-Android-9-0-on-i-MX8M-Mini-Evk/m-p/1523585#M195259</guid>
      <dc:creator>HelloHi</dc:creator>
      <dc:date>2022-09-16T10:18:02Z</dc:date>
    </item>
  </channel>
</rss>

