Adding service to run script in init.rc doesn't run


I researched previous questions with this topic but unfortunately nothing has worked.

I am trying to disable status bar from users sliding from top of device upon bootup with this command to the adb console (which will be re-nabled if you reboot the phone, changes are discarded after reboot):

service call activity 42 s16

so that when my application boots up, they cannot slide from top to see status bar. I put that line in a script called with lines below:

service call activity 42 s16

whenever the user reboots his phone, I want the init.rc file to start a service to run that script every time. I added these lines of code to the end of the init.rc file:

# service to remove status bar
service init_remove /system/etc/
user root

I then recompiled the uramdisk.img file and pushed it to my rooted device. The new init.rc can be seen with the added changes but I can still swipe from top to view status bar.

What am I doing wrong

I now even tried this in init.rc file to start my service from the suggestion below:

on property:init.svc.zygote=running
start init_remove

on property:init.svc.servicemanager=running
start init_remove

but still no change...are my property triggers wrong?


So now I know my service is being noticed when init is running, but cannot be executed because of permissions issues seen below:

init: cannot execve('/system/bin/myscript'): Permission denied

as seen by the output on the console. My updated new service in the init.rc:

on boot
start myscript
service myscript /system/bin/myscript
user system

I run the service as system since supposedly it has rw, and execute permissions: but it still cannot exec. What I think could be the problem is that the mountpoint for the filesystem is listed as read-only, seen by mount command:

/ $ mount
rootfs / rootfs rw,relatime 0 0
tmpfs /dev tmpfs rw,seclabel,nosuid,relatime,mode=755 0 0
devpts /dev/pts devpts rw,seclabel,relatime,mode=600 0 0
proc /proc proc rw,relatime 0 0
sysfs /sys sysfs rw,seclabel,relatime 0 0
selinuxfs /sys/fs/selinux selinuxfs rw,relatime 0 0
none /acct cgroup rw,relatime,cpuacct 0 0
none /sys/fs/cgroup tmpfs rw,seclabel,relatime,mode=750,gid=1000 0 0
tmpfs /mnt/secure tmpfs rw,seclabel,relatime,mode=700 0 0
tmpfs /mnt/asec tmpfs rw,seclabel,relatime,mode=755,gid=1000 0 0
tmpfs /mnt/obb tmpfs rw,seclabel,relatime,mode=755,gid=1000 0 0
tmpfs /mnt/shm tmpfs rw,seclabel,relatime,size=1024k,mode=775,uid=1013,gid=1000 0 0
none /dev/cpuctl cgroup rw,relatime,cpu 0 0
pstore /sys/fs/pstore pstore rw,relatime 0 0
/dev/block/mmcblk3p1 /boot vfat rw,noatime,nodiratime,fmask=0000,dmask=0000,allow_utime=0022,codepage=437,iocharset=iso8859-1,shortname=mixed,errors=remount-ro 0 0
/dev/block/mmcblk3p2 /recovery vfat rw,noatime,nodiratime,fmask=0000,dmask=0000,allow_utime=0022,codepage=437,iocharset=iso8859-1,shortname=mixed,errors=remount-ro 0 0
/dev/block/mmcblk3p5 /system ext4 ro,seclabel,relatime,data=ordered 0 0
/dev/block/mmcblk3p4 /data ext4 rw,seclabel,nosuid,nodev,noatime,nodiratime,noauto_da_alloc,errors=panic,data=ordered 0 0
/dev/block/mmcblk3p6 /cache ext4 rw,seclabel,nosuid,nodev,relatime,data=ordered 0 0
/dev/block/mmcblk3p7 /device ext4 ro,seclabel,nosuid,nodev,relatime,data=ordered 0 0
adb /dev/usb-ffs/adb functionfs rw,relatime 0 0
none /sys/kernel/debug debugfs rw,relatime 0 0
/dev/fuse /mnt/shell/emulated fuse rw,nosuid,nodev,relatime,user_id=1023,group_id=1023,default_permissions,allow_other 0 0
/dev/block/vold/179:1 /mnt/media_rw/extsd vfat rw,dirsync,nosuid,nodev,noexec,relatime,uid=1023,gid=1023,fmask=0007,dmask=0007,allow_utime=0020,codepage=437,iocharset=iso8859-1,shortname=mixed,utf8,errors=remount-ro 0 0
/dev/fuse /storage/extsd fuse rw,nosuid,nodev,relatime,user_id=1023,group_id=1023,default_permissions,allow_other 0 0

But I cannot figure out where in the init.rc file I can set the partition that /system filesystem to rw (and execute) when it mounts.


As always, the answer was simpler (although it tooks hours of research) than I thought.


The answer was that init was not viewing the file as executable. The system call execve, I found out returns errors of Permission denied because it cannot determine it is the right file type to execute, amidst other errors that could cause it. Since @Agu.Thade mentioned if I had permissions, I researched into it more. After about 16 hours of trying to work around ro filesystem crap that I thought was causing the issue, I realized that all the executables in the /system/bin folder were green and my script was white (regular file). So using the chmod advice from @Agu.Thade, I tried to chmod +x from adb which returned Bad mode.


Three hours later, I finally figured maybe I should pull the script to my computer, chmod +x myscript and adb push myscript /system/bin/. I did so, ran ls, and SURE ENOUGH, the file turned green (recognized as executable). Did a reboot, and of course, my script ran.


2D Engines   3D Engines   9-Patch   Action Bars   Activities   ADB   Advertisements   Analytics   Animations   ANR   AOP   API   APK   APT   Architecture   Audio   Autocomplete   Background Processing   Backward Compatibility   Badges   Bar Codes   Benchmarking   Bitmaps   Bluetooth   Blur Effects   Bread Crumbs   BRMS   Browser Extensions   Build Systems   Bundles   Buttons   Caching   Camera   Canvas   Cards   Carousels   Changelog   Checkboxes   Cloud Storages   Color Analysis   Color Pickers   Colors   Comet/Push   Compass Sensors   Conferences   Content Providers   Continuous Integration   Crash Reports   Credit Cards   Credits   CSV   Curl/Flip   Data Binding   Data Generators   Data Structures   Database   Database Browsers   Date &   Debugging   Decompilers   Deep Links   Dependency Injections   Design   Design Patterns   Dex   Dialogs   Distributed Computing   Distribution Platforms   Download Managers   Drawables   Emoji   Emulators   EPUB   Equalizers &   Event Buses   Exception Handling   Face Recognition   Feedback &   File System   File/Directory   Fingerprint   Floating Action   Fonts   Forms   Fragments   FRP   FSM   Functional Programming   Gamepads   Games   Geocaching   Gestures   GIF   Glow Pad   Gradle Plugins   Graphics   Grid Views   Highlighting   HTML   HTTP Mocking   Icons   IDE   IDE Plugins   Image Croppers   Image Loaders   Image Pickers   Image Processing   Image Views   Instrumentation   Intents   Job Schedulers   JSON   Keyboard   Kotlin   Layouts   Library Demos   List View   List Views   Localization   Location   Lock Patterns   Logcat   Logging   Mails   Maps   Markdown   Mathematics   Maven Plugins   MBaaS   Media   Menus   Messaging   MIME   Mobile Web   Native Image   Navigation   NDK   Networking   NFC   NoSQL   Number Pickers   OAuth   Object Mocking   OCR Engines   OpenGL   ORM   Other Pickers   Parallax List   Parcelables   Particle Systems   Password Inputs   PDF   Permissions   Physics Engines   Platforms   Plugin Frameworks   Preferences   Progress Indicators   ProGuard   Properties   Protocol Buffer   Pull To   Purchases   Push/Pull   QR Codes   Quick Return   Radio Buttons   Range Bars   Ratings   Recycler Views   Resources   REST   Ripple Effects   RSS   Screenshots   Scripting   Scroll Views   SDK   Search Inputs   Security   Sensors   Services   Showcase Views   Signatures   Sliding Panels   Snackbars   SOAP   Social Networks   Spannable   Spinners   Splash Screens   SSH   Static Analysis   Status Bars   Styling   SVG   System   Tags   Task Managers   TDD &   Template Engines   Testing   Testing Tools   Text Formatting   Text Views   Text Watchers   Text-to   Toasts   Toolkits For   Tools   Tooltips   Trainings   TV   Twitter   Updaters   USB   User Stories   Utils   Validation   Video   View Adapters   View Pagers   Views   Watch Face   Wearable Data   Wearables   Weather   Web Tools   Web Views   WebRTC   WebSockets   Wheel Widgets   Wi-Fi   Widgets   Windows   Wizards   XML   XMPP   YAML   ZIP Codes