I am using LineageOS 18.1

When I was on LOS 16, I used to edit the file /system/etc/init.d/00banner and put my iptables commands there, e.g.:

sh -c 'iptables -A OUTPUT -m owner --uid-owner 10195 -d -j REJECT'

All iptables commands I put in there used to run on phone start up. But in LOS 18.1, the /system/etc/init.d/ directory was deprecated.

1. I created and filled the custom script with the iptables commands above:

touch /system/etc/custominit.sh
chmod 0755 /system/etc/custominit.sh

2. Then I edited /system/etc/init/hw/init.rc and I added to the end:

chmod 0755 /system/etc/custominit
exec /system/etc/custominit

3. I also tried adding:

service custominit /system/bin/custominit.sh

But none of this worked.

What is it that I doing wrong? I have root access but I do not want to install any additional apps on my phone for this, as it was possible to do on LOS 16.

  • Comments are not for extended discussion; this conversation has been moved to chat.
    – Firelord
    Commented Nov 23, 2021 at 17:26

2 Answers 2


Issue was solved by following instructions here:


The main issue turned out to be missing full path of executables, e.g.:

/system/bin/iptables instead of iptables

  • ... that doesn't explain why 'echo test >> /data/local/tmp/test.log' did not work to you
    – alecxs
    Commented Nov 21, 2021 at 19:29
  • Your answer could be improved with additional supporting information. Please edit to add further details, such as citations or documentation, so that others can confirm that your answer is correct. You can find more information on how to write good answers in the help center.
    – Community Bot
    Commented Nov 22, 2021 at 11:56
  • @alecxs echo still did not work, even if I added /system/bin/echo it did not work, but iptables did. I don't know why..
    – user363569
    Commented Nov 22, 2021 at 21:29
  • echo exist as 1) shell builtin and 2) toybox applet. I think it's bad timing /data is late mounted. anyway never mind, it was just for testing if service is executed - which it obviously does
    – alecxs
    Commented Nov 22, 2021 at 22:16

Once you added your service as "disabled" on init.rc you must call it on boot, add the following lines:

on boot
    custominit your_params

I hope it solves your problem

  • The syntax isn't correct. It should be start custominit your_params. But still this might not work due to other reasons. Commented Nov 21, 2021 at 12:29
  • 1
    No, it did not work..
    – user363569
    Commented Nov 21, 2021 at 15:12

You must log in to answer this question.