I'm trying get get an init.d script working to set one of the Smartassv2 governor parameters.
This is the script:
Code:
#!/system/bin/sh
echo "100000" > /sys/devices/system/cpu/cpufreq/smartass2/sleep_ideal_freq
When I run the script with Script Manager, the value is written.
When I place the file in the /system/etc/init.d folder (I named the script 99SA2), the value is not written after a reboot (I have set permissions and owner on the file).
I'm running CM7.2-RC1 with Glitch 13.1 and using Voltage Control
Is Glitch recreating values each boot? Is Voltage Control interfering? What else could be interfering??
As a test, add
echo "changing a smartass parameter"
to the script, reboot, and search your Logcat for said message, or search Logcat for the name of the script. If it's not running, Logcat might be able to start helping.
Also, before you reboot, try running
chmod 0755 /system/etc/init.d/*
before rebooting.
Sent from my HTC Sensation Z710e using Tapatalk
I was able to get it working by adding "sleep 60" to the script. It seems that the init.d script was running before the governor was set.
Related
First off, I followed the instructions to a tee on installing Eclipse 2.2, including using Pete's Motorola One-Click and NOT Zergrush root. I used voodoo rootkeeper, kept the backup, installed the 2.3.5 Build 418 update, re-enabled root, deleted the back and then flashed Eclipse 2.2.
I then installed the Latest V6 Supercharger scripts which worked under Eclipse 2.1. I can get the Lag Nullifier option to work. However, when I try to get the memory settings to stick, they don't. It keeps reverting back to the default Eclipse values. I've tried local.prop and build.prop and nothing seems to make it work.
I have gone and modified the /etc/init.d/99tweaks script and commented out the minfree values line:
Code:
# minfree values
#echo 2560,4096,6144,17408,19456,23552 > /sys/module/lowmemorykiller/parameters/minfree
I've tried also sticking it in build.prop or local.prop and neither option works.
What's funny is, it appears NONE of the scripts in /etc/init.d are running at all. My SD cache is at 128, not 2048 as it is listed in the file:
Code:
# sd card speed boost
if [ -e /sys/devices/virtual/bdi/179:0/read_ahead_kb ]; then
echo 2048 > /sys/devices/virtual/bdi/179:0/read_ahead_kb
fi
Is something broken?
UPDATE 5/11/2012 10:40 AM Eastern
Okay, I did a factory reset, wiped cache, wiped dalvik and reflashed Eclipse 2.2. Upon rebooting, I checked the read_ahead_kb file and the init.d_log_test.txt file. This is what I found:
# cat /sys/devices/virtual/bdi/179:0/read_ahead_kb
cat /sys/devices/virtual/bdi/179:0/read_ahead_kb
128
# ls -l /data/local/tmp/init.d_log_test.txt
ls -l /data/local/tmp/init.d_log_test.txt
/data/local/tmp/init.d_log_test.txt: No such file or directory
So, the 99tweaks file either didn't run in /etc/init.d or it can't write to the /data/local/tmp and /sys/devices/virtual/bdi/170:0 directories.
Has anyone else noticed this issue? I guess my next thing to try is to sbf back to 2.3.4, re-apply the 418 update and flash again and see what happens.
Thanks!
BTW, I went and ran the 99tweaks script myself at the shell prompt and it seems to have worked. So, it definitely appears to be that the 99tweaks file (and any OTHER scripts in the /etc/init.d directory) are NOT getting executed after the phone is powered on or rebooted.
Here's the output from my run (deleted a bunch of the link_image errors or else my post was too long):
# sh 99tweaks
sh 99tweaks
vm.dirty_ratio = 90
vm.dirty_background_ratio = 70
vm.vfs_cache_pressure = 25
vm.oom_kill_allocating_task = 1
vm.min_free_kbytes = 4096
link_image[1964]: 3295 could not load needed library 'libncurses.so' for 'sqlite3' (load_library[1106]: Library 'libncu
rses.so' not found)CANNOT LINK EXECUTABLE
...
...
link_image[1964]: 3351 could not load needed library 'libncurses.so' for 'sqlite3' (load_library[1106]: Library 'libnc
urses.so' not found)CANNOT LINK EXECUTABLE
#
Click to expand...
Click to collapse
Could it be the 2.3.5 update broke the init.d process?
UPDATE: 05/11/2012 1:48 PM Eastern Time
Okay, I went and placed my OWN script in the /etc/init.d directory that echoed the string "Hello World" to a file in the /data/local/tmp directory named HelloWorld.txt. The file NEVER gets created when I reboot. If I run the script interactively, then it gets created, so definitely the process that runs the scripts in the /etc/init.d directory IS broken with the 2.3.5 update.
Okay, after days of banging my head against the wall and SBFing, rooting, voodoo rerooting, etc, it of course ended up being SO damned simple!
I finally decided to look at the files for the init.d hack. Lo and behold, I found that the /etc/install-recovery.sh script was NOT set to execute. It was read/write permissions only.
I also checked the /system/load_pia.sh and it was fine.
Using root explorer, I mounted /etc to read/write. I then changed the permissions of the /etc/install-recovery.sh script to be 0755. I then remounted the /etc directory r/o and rebooted. And what do you know - the 99tweaks file ran.
So, I would suggest everyone go and look at their /etc/install-recovery.sh script and ENSURE it's set to execute permissions. If not, nothing in /etc/init.d will execute since the install-recovery.sh script is the cog that does all the work.
work for me
changed permissions for /system/etc/install-recovery.sh
with root browser to
[x] [x] [x]
[x] [ ] [x]
[x] [ ] [x]
thanks
Hi all,
I have a problem with the rom in the subject, the headphone amplifier level is too high for me and I want to set a lower value to it.
I created this script:
Code:
#!/system/bin/sh
echo 1 > /sys/devices/virtual/misc/scoobydoo_sound/headphone_eq
echo 40 > /sys/devices/virtual/misc/scoobydoo_sound/headphone_amplifier_level
I have saved it in the /system/etc/init.d/ folder, I have set user and group (root:shell) and permissions (755) like the other scripts in that folder but the script simply isn't started at boot time!
at the end of the file /system/etc/init.post_boot.sh there are these lines:
Code:
# Execute /system/etc/init.d scripts on boot
chgrp -R 2000 /system/etc/init.d
chmod -R 777 /system/etc/init.d
/system/xbin/busybox run-parts /system/etc/init.d
log -p i -t ARHD "init.d support activated"
;;
what I need to do to allow the system to start my script?
thank you!
k4po said:
Hi all,
I have a problem with the rom in the subject, the headphone amplifier level is too high for me and I want to set a lower value to it.
I created this script:
Code:
#!/system/bin/sh
echo 1 > /sys/devices/virtual/misc/scoobydoo_sound/headphone_eq
echo 40 > /sys/devices/virtual/misc/scoobydoo_sound/headphone_amplifier_level
I have saved it in the /system/etc/init.d/ folder, I have set user and group (root:shell) and permissions (755) like the other scripts in that folder but the script simply isn't started at boot time!
at the end of the file /system/etc/init.post_boot.sh there are these lines:
Code:
# Execute /system/etc/init.d scripts on boot
chgrp -R 2000 /system/etc/init.d
chmod -R 777 /system/etc/init.d
/system/xbin/busybox run-parts /system/etc/init.d
log -p i -t ARHD "init.d support activated"
;;
what I need to do to allow the system to start my script?
thank you!
Click to expand...
Click to collapse
actually it seems that no one file inside that directory is started on boot! also the file that already were into the directory!
Ok a developer told me that init.d support will be available from next release!
I'll try something different
Sent from my GT-I9300 using xda app-developers app
hello..
I'm using xperia active and I want to configure the zRam..
I currently on stock ICS rom. I use Diskinfo apps to check ram swap and it shows i have 60mb ram swap for default. but i didn't apply any zRam or swap script yet. So use this script to configure the zRam
#!/system/bin/sh
sysctl -w vm.swappiness=60
echo '1' > /sys/block/zram0/reset
echo $((30*1024*1024)) > /sys/block/zram0/disksize
mkswap /dev/block/zram0
swapon /dev/block/zram0
and set it in init.d (i have activate the init.d). I try to set lower value than 60mb which is 30mb but I can't see any changes when I check back at Diskinfo apps..I also check it using terminal emulator by typing "free" but it still same as shown Diskinfo.. Is there any other method can I use to configure the zRam?
p/s : sorry for bad english
pojhe said:
hello..
I'm using xperia active and I want to configure the zRam..
I currently on stock ICS rom. I use Diskinfo apps to check ram swap and it shows i have 60mb ram swap for default. but i didn't apply any zRam or swap script yet. So use this script to configure the zRam
#!/system/bin/sh
sysctl -w vm.swappiness=60
echo '1' > /sys/block/zram0/reset
echo $((30*1024*1024)) > /sys/block/zram0/disksize
mkswap /dev/block/zram0
swapon /dev/block/zram0
and set it in init.d (i have activate the init.d). I try to set lower value than 60mb which is 30mb but I can't see any changes when I check back at Diskinfo apps..I also check it using terminal emulator by typing "free" but it still same as shown Diskinfo.. Is there any other method can I use to configure the zRam?
p/s : sorry for bad english
Click to expand...
Click to collapse
Try running the script in ScriptManager or in Terminal (will need to be run as su). Any errors you see will also be occurring when the init.d script runs. If there aren't any errors and you reset your swap space then maybe your init.d isn't set up correctly. If you lose your new settings during a reboot, then something in the kernel or ROM is setting these values after init.d runs.
This is really weird, i got the same problem with stock kernel. Before, i thought swap wasn't even supported, but it's set in stock kernel, i can't modify it either, but i'm glad i have it on my locked bl, i thought it was impossible.
justmpm said:
Try running the script in ScriptManager or in Terminal (will need to be run as su). Any errors you see will also be occurring when the init.d script runs. If there aren't any errors and you reset your swap space then maybe your init.d isn't set up correctly. If you lose your new settings during a reboot, then something in the kernel or ROM is setting these values after init.d runs.
Click to expand...
Click to collapse
I found it.. the default zRam script actually located at /system/bin/zram_start.sh. So I just edit this script to adjust the desired value of zRam.. Thanks mate!
pojhe said:
I found it.. the default zRam script actually located at /system/bin/zram_start.sh. So I just edit this script to adjust the desired value of zRam.. Thanks mate!
Click to expand...
Click to collapse
Nice, what did you edit? I want to set it to 128
It seems that all Xperia Kernels that stem back to the DoomLord kernel start the init.d execution twice. While you may think "better twice than never" the nearly parallel execution of scripts can create problems if they concurrently manipulate CPU related tables - or fail to do so due to security mechanisms built in. I was hunting the problem that cpu-clock manipulation from init.d did not work for the scripts generated by System Tuner - finally resulting in this finding.
I checked for sirkay 587c and 587d and for fly-kernel 0.8 as the latest of their breed, quite sure nobody has ever cared about this quirk.
The duplicate execution could be tracked back to the init.rc entries:
Code:
[COLOR=SeaGreen]#DooMLoRD: init.d scripts support
start sysinitsupport
class_start core
class_start main
#DooMLoRD: new init.d scripts support
service sysinitsupport /sbin/sysinitsupport.sh
class main
disabled
oneshot[/COLOR]
Which does:
Code:
#!/sbin/sh
# DooMLoRD: init.d support script (v1)
# [START] setting up
echo "[START] remounting system" > /data/local/tmp/sysinitsupportlog.txt
/sbin/busybox mount -o remount,rw /system >> /data/local/tmp/sysinitsupportlog.txt
# make init.d directory
echo "
[*] make init.d directory" >> /data/local/tmp/sysinitsupportlog.txt
/sbin/busybox mkdir -p /system/etc/init.d >> /data/local/tmp/sysinitsupportlog.txt
# correcting permissions of files in init.d directory
echo "
[*] correcting permissions of files in init.d directory" >> /data/local/tmp/sysinitsupportlog.txt
/sbin/busybox chmod 777 /system/etc/init.d/*
# [COLOR=DarkOrchid]make [/COLOR]init.d directory
echo "
[*] [COLOR=DarkOrchid]make [/COLOR]init.d directory" >> /data/local/tmp/sysinitsupportlog.txt
[COLOR=Red]/system/bin/logwrapper /sbin/busybox run-parts /system/etc/init.d[/COLOR]
# [DONE] all done exiting
echo "[DONE] all done exiting" >> /data/local/tmp/sysinitsupportlog.txt
And later also in init.rc:
Code:
[COLOR=SeaGreen]#DooMLoRD: run my mods
service mymods /sbin/execute_mods.sh
class main
oneshot[/COLOR]
Which then does:
Code:
#!/sbin/sh
# starting
echo "[ START ]" > /data/local/tmp/log_doom-mods.log
echo "" >> /data/local/tmp/log_doom-mods.log
[COLOR=Red]# execute tweaks
/system/bin/logwrapper /sbin/busybox run-parts /etc/init.d[/COLOR]
# execute FPS limit remove
/sbin/mount -t debugfs debugfs /sys/kernel/debug
/sbin/echo '0' > /sys/kernel/debug/msm_fb/0/vsync_enable
/sbin/umount /sys/kernel/debug
echo "FPS limit successfully removed " >> /data/local/tmp/log_doom-mods.log
# DONE
echo "" >> /data/local/tmp/log_doom-mods.log
echo "[ DONE ]" >> /data/local/tmp/log_doom-mods.log
You see that the execution of
Code:
[COLOR=Red]/system/bin/logwrapper /sbin/busybox run-parts /etc/init.d[/COLOR]
is actually done twice - from sysinitsupport.sh first and then again from execute_mods.sh
Also mind that the log-entry in the first is leading in the wrong direction (copy error from above). It should better read "execute init.d directory"
The related logs are found in \data\local\tmp.
You can check yourself with this little script in \etc\init.d:
Code:
#!/system/bin/sh
echo [] > /data/local/tmp/$PPID-exec-done
echo $PPID "init.d executed" >> /data/local/tmp/$PPID-exec-done
date >> /data/local/tmp/$PPID-exec-done
Mind the $PPID which is the parent PID of the executing command (the busybox "run-parts"). Per boot you should just get 1 file <PPID>-exec-done containing the timestamp if you get 2 then you know why...
I have attached the script wrapped in a zip file. Unpack it, copy to \etc\init.d (or if not sym-linked to \system\etc\init.d) and change attributes to "777". Reboot and look what you get in \data\local\tmp.
Once you know, remove the script again and delete the created files in \data\local\tmp.
Mind that the scripts referenced from init.rc are copied over again from the kernel part so any change of the scripts in the \system\sbin folder is useless. The kernel has to fix that, no way out here.
I've been looking into this issue as well with the help of dk_zero_cool (mounts2sd amongst other things) as no matter what I tried I could not get m2sd to run in anything other than Safe Mode because init.d was being run as a service and not being executed in full before the init continued. So far I have edited init.rc to remove the second instance you quote above, and edited the first instance to:
Code:
exec /sbin/sysinitsupport.sh
so it executes rather than running a service. I then edited sysinitsupport.sh to contain just this:
Code:
#!/system/bin/sh
export PATH=/sbin:/system/sbin:/system/bin:/system/xbin
/system/bin/logwrapper busybox run-parts /system/etc/init.d
and also removed the line in execute_mods.sh that relates to init.d, so now theoretically the only thing that should happen in relation to init.d is that the exec command runs sysinitsupport.sh which in turn runs the init.d scripts before anything else in init.rc happens. IN THEORY!!! Because even with all of that done (and I have searched through the whole ramdisk, plus looked at the git for the init binary used in the Lupus ICS kernel I am using to make sure I haven't missed anything) the m2sd init.d script is still running in Safe Mode because it is detecting /system/bin/servicemanager running at the point it tries to execute. So something somewhere is still starting before the execution of init.d. I even tried with the init binary from the latest CM9 build for the Ray to rule out something wrong in there too.
I have sent all my files to dk_zero_cool to see if he can shed any further light on what else may be wrong. I have checked four different Ray kernels and they all use the same DoomLord methods so I doubt whether there are any Ray kernels that are running init.d correctly. It would be great to find a fix for this. Hope more people chip in!
Thanks for opening the discussion
As I understood, you have made some changes in the kernel assembly (not the code) to circumvent the effects you have outlined. I admit that I have not fully understood YOUR concern - but for my double execution of the "run-parts" the deactivation of the relevant line in either of the 2 scripts should do it, or not?
Is your concern related to the situation that init.d cannot do "everything" at the time it is executing and so it cannot achieve what some scripts intend to?
I am far too little educated in the details of kernel execution privileges so cannot further comment on that
Yeah, pretty much - to avoid possible issues with the m2sd script moving stuff around while something else is trying to make use of it the first thing it does is check if servicemanager is running, and if it is it disables the ability to move things like /data and dalvik-cache to sd-ext. The changes that we made in the scripts SHOULD have changed the init.d implementation from it running as a service whilst the rest of the init process carried on, to being executed as a command allowing any init.d scripts to be executed prior to any other service being started - as I understand it this is how init.d was intended to be used (ie the user scripts in /etc/init.d are run fully before anything else). However as I said, even with these changes and everything else relating to init.d having been removed something is still starting servicemanager, and until the source of that can be isolated scripts like m2sd cannot run fully/safely.
I guess the strategy to check on servicemanager is not right here. This is a process that starts several services and should not depend on anything in the init.d. So if you say that the boot sequence would have init.d completed BEFORE any service is started via servicemanager - THEN this could be a flaw in the kernel.
However is that really true? Is there no option to check if certain "dangerous" (for your move purposes) services are active already instead of checking on the servicemanager? I had found a nice overview on the Linux boot process here and I think that somewhere as part of the various init.x excuted scripts the servicemanager simply MUST be started - init.d is just a part of init - and for sure not the first part of it.
Off Topic:
I wonder where I can get some more insight in the Xperia Kernels and how they are assembled - especially which trace of that is noticeable in the filesystem. I noticed that the ICS Kernel have roughly 340MB for the user space while the JB Kernel has 360MB. Device should have 512 MB RAM, then some MB go away for radio and possibly video buffer, but his should be the same for all (accross ICS/JB). So what kind of memory tweaking makes this 20MB difference? I have not found a good place to discuss this - where could I go to?
tobbbie said:
It seems that all Xperia Kernels that stem back to the DoomLord kernel start the init.d execution twice. While you may think "better twice than never" the nearly parallel execution of scripts can create problems if they concurrently manipulate CPU related tables - or fail to do so due to security mechanisms built in. I was hunting the problem that cpu-clock manipulation from init.d did not work for the scripts generated by System Tuner - finally resulting in this finding.
Click to expand...
Click to collapse
How about Radeon kernel? Is there an issue like you said?
Sent from my ST18i using Tapatalk 2
frogerra said:
How about Radeon kernel? Is there an issue like you said?
Sent from my ST18i using Tapatalk 2
Click to expand...
Click to collapse
Just try out (see the guide on 01test.zip) - nothing you can harm doing that.
kernel behaviour trick
I noticed some kernels (GB and ICS) do overwrite settings from /etc/init.d ....
So if you make an init.d script with specific cpu values, or VM settings...some kernel overwrite these with their compiled/preferred values "after" init.d scripts are executed. This way it looks as if your script is not completely accepted by the rom...but the truth is that the kernel applies its own preferred values afterwards.
Thats why my init.d script contains a wait of 60 seconds in the beginning of the scripts......how ? add:
sleep 60
So your script looks like this (example):
#!/system/bin/sh
# this init.d script is for when you apply doomlord kernel supplied with repack 2013
sleep 60
That will run your init.d goodies after one minute.
As you see I'm working on a revived repack4pda 2013 (GB) , which will be released soon in repack4pda thread.
Br.
Michel
I guess that these kernels may be doing the same what you are proposing - just sleep the shell process before action starts. So you need to lookup the call tree from the init process along the various init.*.rc scripts if this is the case. For duplicate execution of init.d content any timed scripts willl not help - the duplicate execution will just happen later as the same script will pause the same amount of time.
Not sure if the init process script execution is synchronous or not - so if you create scripts which sleep, the final signal for "boot completed" may just also delay and the whole boot process may take longer by that sleep time. As well would you just stack the delays after each other and so nothing is gained finally. Synchronous execution would make it impossible that a part of the init process could postpone beyond boot completed.
It may differ if you run the scripts via the "exec" command or let it execute via the servicemanager. I guess the latter may run them asynchronously - not sure here as well.
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