Questions tagged [init.d]
The init.d tag has no usage guidance.
38
questions
1
vote
0
answers
121
views
Run init rc script after package manager have loaded
I'm writing an init service which make sure a package is installed and if not, it will install the apk.
The problem is, that currently I'm using a boot trigger with on boot but when I run pm install ...
1
vote
0
answers
336
views
How to disable a broken system service in Android 11
tl;dr: the fps_hal init service on my phone is constantly restarting, and since I don't use the fingerprint sensor I want to disable it.
Background:
Trying to debug my own app on LineageOS 18.1 (...
2
votes
0
answers
292
views
Empty ramdisk in boot.img
I have a copy of the boot.img from my HTC M8 one.
I unpacked it and discovered that it is mostly empty directories and one binary "init" file. I was hoping to find an init.rc in there.
Any ...
1
vote
0
answers
606
views
Can't install apk using sh script and init.d app
I'm trying to install apk when the device is booting.
I wrote shell script to install apk:
#!/system/bin/sh
pm install /data/local/tmp/MagiskManager-v7.1.1.apk
Unfortunately, when I enters the shell (...
1
vote
1
answer
439
views
Init service not starting in user build
I have an init service that is not starting in user build. When running a userdebug build it works fine but not in user build. Can't seem to figure out why it's not running. I don't see any errors ...
1
vote
0
answers
672
views
Why I can't remove directory using mv?
So I want to use bindfs that require the mounted directory to be empty. Then I'm trying to move WhatsApp (Internal storage) contents to external SD card
sdcard="/mnt/media_rw/6DE8-1BC6/"
mv /...
1
vote
1
answer
1k
views
How to clean app cache using script every time the phone boot?
I know there's many app that clean cache every boot but I would like to use init.d/script to save storage.
Dalvik-cache is /data/dalvik-cache/arm/ as I can just rm -rf *
But, app cache is located at /...
0
votes
0
answers
121
views
on a termux app terminal access where should I put my own runnit service to start on phone reboot?
I wrote a simple service like this one: http://smarden.org/runit/runscripts.html#apache2
$ cat start_node_exporter
#!/data/data/com.termux/files/usr/bin/sh
termux-wake-lock
. $PREFIX/etc/profile
/...
0
votes
0
answers
90
views
Init ignores .rc in the /system/etc/init [duplicate]
on boot
iptables blah --blah
iptables blah --blah
service myservice /system/bin/myarm64binary --config /path/to/conf.cfg
class main
user root
According to the documentation:
https://...
2
votes
1
answer
2k
views
Run script using init.rc doesn't work
I'm trying to run a script that exectues when the device has finished booting. This particular device does not support running scripts from an init.d directory, which is why I am using init.rc.
The ...
1
vote
1
answer
76
views
What feature of Android provide security to reset the /system changes on reboot?
I am stuck in a weird situation where I have two Android 10 phones from Samsung. I have rooted the stock recovery of both device as instructions given here. The problem is when I change something via ...
1
vote
2
answers
2k
views
How to add SELinux policy on a user-debug ROM that has `split` policy scheme?
I have a Sony device that supports treble and is a system-as-root and A/B device. It has a user-debug ROM installed on it so, its adb shell is rooted.
I have disabled dm-verity using adb disable-...
4
votes
1
answer
2k
views
How can /proc/sys values be changed at boot (sysctl.conf does this on normal Linuxes)?
How can /proc/sys values be changed at boot?
sysctl.conf doesn't exist on Android and echoing values to the proc files isn't persistent.
6
votes
2
answers
3k
views
How to make SELinux injected rules persistent without unpacking-packing boot.img?
I am working on an application that needs root access and I have a device which is rooted but not with Magisk. This device has only adb shell root available. So, I need an alternative to call the ...
5
votes
1
answer
8k
views
How to run an Android init service with superuser SELinux context?
I want to run an Android init service. I have a device which has rooted shell (purchased from manufacture as rooted). This device doesn't have Magisk or other su manager but adb shell is rooted and it ...
7
votes
1
answer
19k
views
How to run an executable on boot and keep it running?
I have an executable build from a ndk-build program. I want to run it on a rooted Android device. How much is the possibility that Android will kill my executable?
Using adb shell, I am able to ...
1
vote
1
answer
889
views
Adding custom bootup script to Android-x86 Nougat
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) ...
0
votes
0
answers
70
views
How does init knows when to relaunch a process?
I know the Zygote listens to a socket in /dev/socket/zygote in order to know when to fork a new process. I want to know how init usually does it.
I have a persistent process (not service) X whose ...
2
votes
1
answer
4k
views
What sepolicy context will allow any other context to access it?
I am on a bootloader locked Sprint Samsung Galaxy S7, eng boot.img flashed to phone with SELinux permissive, which gives root adb shell from where I can change system partitions, debloat, install ...
1
vote
3
answers
2k
views
Lengthy sleep command not working in script
I've written a su.d script to periodically (every 4 hours) back up data from an app using a looped sleep command:
#!/system/bin/sh
(
# Wait for boot to complete
until [ "$(getprop sys....
11
votes
1
answer
34k
views
How to run DNSCrypt as a background service on Android?
I've installed an unofficial lineage OS 14.1 ROM on my phone and i want to have dnscrypt used on boot by default.
There is what i have done:
Download arm binaries from: https://github.com/jedisct1/...
0
votes
1
answer
231
views
Init.d Script won't work to keep value
I was try to change some value like vm, lowmemorykiller, adj, and net using shell script, then save it to init.d folder and execute it as root.
after reboot, it always back to default.
And i was ...
2
votes
1
answer
9k
views
SELinux prevents my init.rc exec command to execute
I've added a exec command at the end of init.rc file.
on property:dev.bootcomplete=1
exec u:r:shell:s0 shell shell -- /system/bin/am start -n com.example.package/com.example.package.MainActivity
...
1
vote
1
answer
5k
views
init.rc doesn't start my service on boot completed event
I've added the following snippet to the end of /system/core/rootdir/init.rc file.
on property:dev.bootcomplete=1
start bootcomplete_handler
service bootcomplete_handler /system/bin/bc_handler.sh
...
1
vote
3
answers
11k
views
How can I run a custom .sh script at each startup (without native init.d support)?
This looks like a general concern of rookie Android system players who have just rooted their phones. The most prevalent method may be throwing your script into /system/etc/init.d. If the ROM supports ...
2
votes
1
answer
408
views
Block internet access before firewall starts at boot
I have an old Android phone with Ice Cream Sandwich and DroidWall as a firewall, which makes sure that apps can't use the 3G unless I enable it for that app. DroidWall starts on boot but there is a ...
3
votes
1
answer
1k
views
Init.d script trouble shooting
I'm trying to run an init.d script when my rom boots to disable system services, and they aren't running.
The script is as follows
#!/system/bin/sh
su -c pm disable com.google.android.gms/.update....
0
votes
1
answer
1k
views
Link2SD Mount Script Error. [4]: can't create /system/etc/init.d/11link2sd: > Not a directory
I want to move some of my apps from my internal memory to my extsdcard. I followed this to do so(I'm not using Marsh Mellow so skip the first part of the guide). When I installed Link2SD and rebooted ...
-1
votes
1
answer
2k
views
It seems my device doesn't have init.d support, but I have a bunch of init.* files. Can I use the same approach somehow?
-rwxr-x--- 1 root root 3265 Jan 1 1970 init.class_main.sh
-rwxr-x--- 1 root root 1730 Jan 1 1970 init.mdm.sh
-rwxr-x--- 1 root root 3347 Jan 1 ...
0
votes
0
answers
527
views
Is it possible to start an infinite loop within init.d?
I would like to create an init.d script to control the fan of my Odroid XU3 under Lollipop 5.1.1, CyanogenMod 12.1.
I already make one on linux which is working well and would like to port it to ...
2
votes
1
answer
2k
views
mount in /data/local/userinit.sh is not working
I want to map /sdcard/DCIM to /storage/sdcard1/DCIM
using CM 12.1 on a I9100
I wrote those few lines to /data/local/userinit.sh:
#!/system/bin/sh
log -p i -t userinit "userinit start";
mount -o bind ...
5
votes
0
answers
1k
views
ifup/ifdown scripts
I am fiddeling with some network related things and want to try them on Android too. In Ubuntu it was quite easy to run some commands if an interface (eth0 or wlan0) goes up or down by simply adding ...
0
votes
1
answer
6k
views
remove the script in init.d
I want to flash TweakDrypT to my rooted android 4.4.2 device. But before, I must delete all the scripts in init.d. I've tried using universal init.d to remove them, but they won't. Anyone can help?
4
votes
3
answers
9k
views
How to create start up scripts using the init.d folder?
In this answer to a question I asked a while ago, he said it's possible to have a script executed every boot.
I created a file (without extension) that contains the following:
#!/system/bin/sh
...
1
vote
0
answers
776
views
AutoMount ext2 SD-card on Huawei U8350 (Android 2.2.2)
On the Huawei U8350 (Android 2.2.2) the init scripts all appear to be in the root partition -- which actually is a ram disk (initramfs), so any changes to it aren't persistent across reboots.
Is ...
1
vote
1
answer
6k
views
How to edit init.rc in Samsung Galaxy S3 i9300?
I would like to edit the init.rc in an i9300. I understand that editing the file as-is will not work as the file is reloaded from the boot image's ramdisk upon every bootup. After some googling, I ...
3
votes
1
answer
816
views
init.d doesn't get executed
i am using samsung s2 and a custom rom, external sd card is mounted to /emmc but i want it to mount to /mnt/sdcard/external_sd, how could i mount it using init.d?
i made a file called "99mount" with ...
2
votes
1
answer
14k
views
Activating swap at boot with an init.d script?
I have a rom that supports swap, but the swap script is missing.
How would i make that swap script manually?
I.E: What code would be in the file /etc/init.d/07swapon?