init.d doesn't work - Android Q&A, Help & Troubleshooting

Hi,
I've followed this how-to: http://forum.xda-developers.com/showthread.php?t=1933849 to enable init.d support on my phone (GT-S5570i, Android 2.3.6, stock rom)
I have installed BusyBox (standard install, not smart install), then, after installing and launch Uni-init, i get "SUCCESS ! You have init.d support !"
Well, so I went into init.d folder and I manually launch the script "00test" to see if I am able to run scripts on my phone: ok: inside /data folder i see the test.log file! Then I delete this test file to see if my phone is really able to execute this script from the init.d folder at the boot.
Well, after reboot I go in /data but I don't see any test.log file.
Why? Uni-init told me that I have init.d support, but this don't seems true. The permissions on init.d folder and scripts are ok (rwxr-xr-x). I've also tried to change the ownership to 0 (root) and to 1000 (system) to the test script, and I've also tried another init.d activator, this one: http://download.apks.org/?apkid=com.broodplank.initdtoggler&ver=1.3&server=apk-s#.VbluDvldLcc bot no luck again.
Then I've found this solution: http://forum.xda-developers.com/showthread.php?t=2725680 which, differently from the other solutions, has inserted the runinit script inside /bin. Well: so I rebooted again, but the init scripts aren't still able to run at boot.
If i start the runinit script from a shell window, ok: scripts from init.d folder are properly executed, but again, when I boot my phone, these scripts aren't executed. Maybe I should tell to some system files to execute runinit at the boot time? I miss something?
Many thanks.

In another discussion I've read the following statement:
- the boot process calls install-recovery.sh while executing init.rc
- the install-recovery.sh calls sysinit script
- the sysinit script runs /system/etc/init.d/* in order
Click to expand...
Click to collapse
But I've found that my init.rc exclude the install-recovery.sh script:
Code:
#service flash_recovery /system/etc/install-recovery.sh
# oneshot
So, I don't have any chance to implement the init.d solution?

Related

[Q] init.d support for stock rom P500

Hi, I just read some tips about using script for enhancing performance.
It says that the script must be places in system/etc/init.d
But in stock rom P500 (GB 2.3.3 v20G) I can't find folder init.d
The questions:
1. Is the stock rom already support init.d script execution?
2. If yes, will it works just by creating folder init.d and place script there?
3. If not, how to enable support init.d for Optimus One, stock ROM rooted?
I search this forum and find some guide about init.d support in other phone models, will it works on Optimus One too, or perhaps it needs particular way to do it?
1. No
2. If you have init.d support in rom.
3. Only way to do it is cook a custom rom through kitchen to add init.d support
terratrix said:
1. No
2. If you have init.d support in rom.
3. Only way to do it is cook a custom rom through kitchen to add init.d support
Click to expand...
Click to collapse
3. answer is some wrong:
you doesnt need to cook a custom rom, you only need the adb (android debug bridge) to "speak" with your phone:
0.) on your phone download busybox from market
1.) install android sdk on your computer
2.) install LG usb drivers on your computer
3.) open a console (on windows use the "cmd" command)
4.) remount "root" to read/write (type following commands in the cmd)
Code:
adb shell
mount -o remount,rw /dev/block/mmcblk1 /
exit
5.) retrive the init.rc file from your device: (type the command in the cmd)
Code:
adb pull /init.rc C:\users\XXXXX\Desktop\init.rc
6.) open the init.rc file and add the busybox command to execute scripts in the /system/etc/init.d folder
after the lines that does mkdirs etc but BEFORE zygote starts (this stars the whole android)...
Code:
service userinit /system/xbin/busybox run-parts /system/etc/init.d
oneshot
7.) close and save the file, push it back to your device, than reboot:
Code:
adb push XXXX\XXXX\init.rc /init.rc
now you can use the init.d folder as in CyanogenMod / other custom roms.
andy572 said:
3. answer is some wrong:
you doesnt need to cook a custom rom, you only need the adb (android debug bridge) to "speak" with your phone:
0.) on your phone download busybox from market
1.) install android sdk on your computer
2.) install LG usb drivers on your computer
3.) open a console (on windows use the "cmd" command)
4.) remount "root" to read/write (type following commands in the cmd)
Code:
adb shell
mount -o remount,rw /dev/block/mmcblk1 /
exit
5.) retrive the init.rc file from your device: (type the command in the cmd)
Code:
adb pull /init.rc C:\users\XXXXX\Desktop\init.rc
6.) open the init.rc file and add the busybox command to execute scripts in the /system/etc/init.d folder
after the lines that does mkdirs etc but BEFORE zygote starts (this stars the whole android)...
Code:
service userinit /system/xbin/busybox run-parts /system/etc/init.d
oneshot
7.) close and save the file, push it back to your device:
Code:
adb push XXXX\XXXX\init.rc /init.rc
now you can use the init.d folder as in CyanogenMod / other custom roms.
Click to expand...
Click to collapse
Ah thanks for correcting my answer ^^
Dear Andy,
Thanks 4 the procrdure, however i wanted to ask you whether there is any tool to check that the scripts in the init.d folder r getting executed?
andy572 said:
.....guide...
Click to expand...
Click to collapse
That works? I mean init.rc is in ramdisk in boot partition, and gets unpacked on boot, so any changes in / are lost on reboot - at least that is what was told to me.
Kanad said:
Dear Andy,
Thanks 4 the procrdure, however i wanted to ask you whether there is any tool to check that the scripts in the init.d folder r getting executed?
Click to expand...
Click to collapse
Option 1 - run logcat during boot (Trough ADB, type logcat in adb shell, a little simpler if using Droid Explorer)
Option 2 - Run a script that changes something that was previously different. Try installing the supercharger (with different from normal minfree values), rebooting and running the script again to make sure the minfree values are modified. If so, init.d is working and vice versa.
andy572 said:
6.) open the init.rc file and add the busybox command to execute scripts in the /system/etc/init.d folder
after the lines that does mkdirs etc but BEFORE zygote starts (this stars the whole android)...
Code:
service userinit /system/xbin/busybox run-parts /system/etc/init.d
oneshot
Click to expand...
Click to collapse
I go directly to this step, using root explorer on phone (not using PC+ADB)
But after reboot, init.rc i've already edited before has been restored again to original value, as said by Tasssadar.
Maybe I should do it using PC+ADB instead of direct edit on phone?
optimuswhite said:
I go directly to this step, using root explorer on phone (not using PC+ADB)
But after reboot, init.rc i've already edited before has been restored again to original value, as said by Tasssadar.
Maybe I should do it using PC+ADB instead of direct edit on phone?
Click to expand...
Click to collapse
you are trying to modify a running system, sure - you have to do such things
in the boot.img file and have to re-flash it. there is no way to modify a running
system, sorry for misunderstanding.
andy572 said:
you are trying to modify a running system, sure - you have to do such things
in the boot.img file and have to re-flash it. there is no way to modify a running
system, sorry for misunderstanding.
Click to expand...
Click to collapse
I see.
so, is someone can guide me how to deal with boot.img on stock rom?
optimuswhite said:
I see.
so, is someone can guide me how to deal with boot.img on stock rom?
Click to expand...
Click to collapse
go to your recovery, make a backup of your current system and connect the
phone via usb to your computer and copy the rom from the phone to your computer.
then, use the htc kitchen to modify the created rom / or the boot.img

[Q] Symlinked scripts in init.d?

The rom I'm running (PARANOIDANDROID for HTC Desire) has a script in init.d to create symlinks for files contained in /sd-ext/gapps onto /system. This allows Desire users to have gapps on a ROM which would otherwise use up almost all of the space on /system.
I'm attempting to add a script to /sd-ext/gapps/system/etc/init.d so that it will be symlinked into /system/etc/init.d and be run on boot. I've confirmed that the file is indeed symlinked correctly (and that all permissions are set appropriately), but when it comes to execution of the script, something goes wrong.
The error I get is:
Code:
I/run-parts( 80): run-parts: /system/etc/init.d/25marketcache2sdext: No such file or directory
This indicates to me that run-parts doesn't like symlinked files. Is there any other way of going about this, or perhaps making run-parts work nicely with my script? I've tried some googling but I've found little that applied to Android, and even less that I actually understood.

[Q] init.d support on Cyanogenmod 12.1

Hi,
I'm trying to run a custom init.d script on my HTC One (m7) which is running on Cyanogemod 12.1 (The problem existed already in 12.0). The problem is that none of the scripts are executed at boot time.
Looking at the "init.cm.rc" script i found the following snippets that look like the "sysinit" command should be triggered at boot time.
Code:
[...]
on post-fs-data
[...]
# Run sysinit
start sysinit
[...]
# sysinit (/system/etc/init.d)
service sysinit /system/bin/sysinit
user root
oneshot
disabled
I even tried removing the "disabled" parameter but the "sysinit" command is still not executed at boot time.
If I run the "sysinit" command on a root shell the scripts are executed as the should.
Anybody an idea what I'm missing?
Thanks in advance!
Hi.
I am also running CM12.1 on a w7dsn device, and init.d wasn't working. I was able to get it running by using the init.sh script as described here:
http://techtrickz.com/how-to/fix-xposed-framework-installation-issue-on-nexus-6/
I've just downloaded the script and run it from my sdcard, no other steps are necessary.
lfom said:
Hi.
I am also running CM12.1 on a w7dsn device, and init.d wasn't working. I was able to get it running by using the init.sh script as described here:
http://techtrickz.com/how-to/fix-xposed-framework-installation-issue-on-nexus-6/
I've just downloaded the script and run it from my sdcard, no other steps are necessary.
Click to expand...
Click to collapse
I am trying to get init.d working on d2vzw, and no luck. The script you linked to works by replacing /system/etc/install-recovery.sh, but my build has no such file. What a drag with CM...
galets said:
I am trying to get init.d working on d2vzw, and no luck. The script you linked to works by replacing /system/etc/install-recovery.sh, but my build has no such file. What a drag with CM...
Click to expand...
Click to collapse
Mine didn't have either, but after installing the script (and creating install-recovery.sh) then my scripts in init.d started to be run after every boot.
You must turn off selinux in order for init.d to work
Sent from my LG-LS980 using XDA Free mobile app
I'm using CyanogenMod 12.1 ROM on my phone, to enable the init.d you have to remove the /system/bin/sysinit then recreate the similar filename with the same content and permissions (755, root, shell).
Code:
#!/system/bin/sh
export PATH=/sbin:/system/sbin:/system/bin:/system/xbin
run-parts /system/etc/init.d
Was it the init.rc from the boot.img initrd, or the one from the rootfs /boot.img?
Just change the permissions of all files in /etc/init.d folder to 755.
Also if you use the /data/local/userinit.sh change that to 755.
Leave the /system/bin/sysinit file as it is.
Code:
#!/system/bin/sh
export PATH=/sbin:/system/sbin:/system/bin:/system/xbin
for i in /system/etc/init.d/*; do
if [ -x $i ]; then
/system/bin/log -t sysinit Running $i
$i
fi
done
Cheers

Su/su.d/script.

Hi guys. Does any of you know how to push su.d directory into su folder? I mean I need radio.sh script in su/su.d to get root call sms manager working. Every time I try it disappears after reboot.
Rooted rom 34.3.A.0.217 with TWRP.
Anyone?
It's late though, but for the guidance of other noobs like me. /su/su.d/ can't be flashed in recovery because this isn't available. For system-less roots, binaries/libraries required to start supersu daemon and to manage root permissions, don't reside in /system/bin but in /data/su.img while (at least) two files reside in boot.img i.e. boot.img/ramdisk/init.supersu.rc and boot.img/ramdisk/sbin/.*daemonsu*.sh. When ROM boots, init.supersu.rc mounts /data/su.img on /su directory and calls /sbin/*daemonsu*.sh for initial setup which starts /su/bin/daemonsu and other se-linux related stuff and then executes any scripts found in /su/su.d/ and /system/su.d.
You can find this:
Code:
mido:/ # mount | grep loop
/dev/block/loop0 on /su type ext4 (rw,seclabel,noatime,data=ordered)
So, the init.d scripts placed in /su/su.d actually reside in /data/su.img which isn't mounted in recovery mode and anything flashed to /su/su.d goes to volatile rootfs which is gone on reboot. Either mount su.img in recovery, or place this script while ROM is running or instead flash to /system/su.d which is permanent filesystem unlike rootfs (which lives in RAM). And finally don't forget to set permissions to 0700 as advised here. Another thing, mostly init.d scripts don't work with .sh extension. Avoid this too.

[Help] Run init.d scripts on boot

Hi guys need a bit of assistance in trying to run a shell script on boot via init.rc with kernel selinux set to enforcing. Im currently running/testing AEX 5.8 on oneplus 3 which has the stock boot.img as enforcing. I unpacked the stock boot using android image kitchen and added the following to init.rc:
Code:
service initd /system/bin/initd.sh
class late_start
user root
oneshot
disabled
on property:sys.boot_completed=1
start initd
initd.sh script which has been placed in system/bin folder contains the following:
Code:
#!/system/bin/sh
busybox run-parts /system/etc/init.d
exit 0
if i add androidboot.selinux=permissive to the kernel boot.img-cmdline and repackage the kernel so kernel is in permissive mode, the script runs and all scripts in system/etc/init.d complete. however if the kernel is set as enforcing, then initd.sh does not run. if i execute initd.sh via a file manager again the script runs. It seems selinux is preventing initd.sh to start on boot if kernel is set to enforcing. i tried editing plat_file_contexts in boot.img but no luck.
any tips or ideas would be appreciated

Categories

Resources