User init.d for CM12.1

For some reason the support for init.d and thereby userinit.d has been removed from CyanogenMod starting with CM12. Unfortunately it is not easy to re-activate the functionality, even more so if you want the change to survive future CM updates.

So I decided to create a trivial app that will simply execute run-parts on the /data/local/userinit.d directory when the phone completes booting to get the good old userinit.d back. To clone the git repository run:

git clone https://lisas.de/~alex/runuserinit.git

Find more details on the repository contents here.

After installation you will have to start RunUserinit once and hit the button.  When asked whether RunUserinit should be allowed to use root privileges accept that and make the setting permanent. Finally sshd will run automatically again, whenever my phone requires a reboot…

15 Comments

  1. Exactly what I was looking for since CM removed init.d support. Any possibility you can provide the apk?

  2. I haven’t really investigated whether there is something to consider when building ‘release’ apks, but I’ll send you the last debug apk I built – it works nicely on my phone running the latest CM13 builds.

  3. Any chance I could get my hands on that apk as well, I’ve been looking for this for a log time!.

    Thanks!

  4. Thank you very much! Using your app is the ONLY way I could figure out to start the SSH server on Cyanogenmod, since /data/local/userinit.sh and even /system/bin/sysinit are not run anymore on CM13.

    For anyone else trying this solution: you can build the source code into an APK with the following command: ./gradlew assembledebug

  5. Hey JJ, same for me; good to know it works for you, too! And thanks a lot for adding the build instructions, I should update the post to include this information.

  6. If you are ok with running non-free software, you could use an app called Tasker (paid). It is possible to run tasks on device boot.

  7. Hi Alex,

    Thanks for sharing. I think its the way to start opensshd on boot of CM13.
    I have tried to clone your git repo, but without success.

    Is it possible that you will share the apk with me ?

    Thanks in advance.

  8. Hi Alex,

    Now, I have cloned your git project and it does like it should. Now the sshd starts on boot. 🙂

  9. Excellent, good to hear that it works for you… now let’s see whether the current code will run with CM14, too…

Leave a Reply

Your email address will not be published. Required fields are marked *