Sample Header Ad - 728x90

Adding custom bootup script to Android-x86 Nougat

1 vote
1 answer
1061 views
I've been happy using Android-x86 Nougat on my system. Thanks to everyone who made that work. I'm now trying to make one small change which is that I want to run a custom init script (a shell script) at bootup. It seemed like a simple idea which I've done before on KitKat without problems. I modified init.rc and added a service to start my script. But what happens is on bootup, I see:
04-17 13:16:14.823  1210  1210 I init    : type=1400 audit(0.0:6): avc: denied { execute_no_trans } for path="/system/bin/mystart" dev="loop1" ino=280 scontext=u:r:init:s0 tcontext=u:object_r:system_file:s0 tclass=file permissive=1
That error is a SELinux permission error so I then proceeded to try these solutions: 1. Disabling SElinux write /sys/fs/selinux/enforce 0 And checked that this causes the system to be in permissive mode but at bootup, the same error still occurs. 2. Adding a custom SELinux policy, I added: build/target/board/generic/sepolicy/mystart.te type mystart, domain; type mystart_exec, exec_type, file_type; init_daemon_domain(mystart) But this still doesn't allow the service to proceed. 3. Tried to run it as a post action: on property:dev.bootcomplete=1 exec u:r:shell:s0 shell shell input log adb sdcard_rw sdcard_r net_bt_admin net_bt inet net_bw_stats -- /system/bin/sh /system/bin/mystart This still hits the same avc issue. **Edit:** This issue is for a boot script (not an ELF executable as in the other case) and furthermore, as I mentioned above, turning off SELinux enforce does not permit the script to be run.
Asked by Jaya Kumar (11 rep)
Apr 18, 2019, 10:22 AM
Last activity: Sep 8, 2019, 06:24 AM