Android Enthusiasts
Q&A for enthusiasts and power users of the Android operating system
Latest Questions
2
votes
1
answers
268
views
Does AOSP include an initialisation system (equivalent to SystemD)?
I see [`stackoverflow.com/revisions/20060853/1`](https://stackoverflow.com/revisions/20060853/1) (paraphrased unmdermentioned), which appears to answer a similar question, although the answer that it provides causes me to believe that the services are *hardcoded* inside a user-inaccessible (even wit...
I see [
stackoverflow.com/revisions/20060853/1
](https://stackoverflow.com/revisions/20060853/1) (paraphrased unmdermentioned), which appears to answer a similar question, although the answer that it provides causes me to believe that the services are *hardcoded* inside a user-inaccessible (even with standard adb
access) POSIX Shell Script:
The statement "Service declarations only serve to describe services, they do not actually start anything" is correct. The native daemons are actually started in[Another answer, from *this* forum](https://android.stackexchange.com/revisions/6559/1#:~:text=/data/init.sh%20runs%20at%20boot%2C%20if%20you%20have%20root%20you%20can%20edit%20it%20as%20you%20like.) , to a similar question, mentions a near-duplicate file that acts identically (although it doesn't elaborate much – it, too, is paraphrased undermentioned): >init.rc
by lines 371-372 in [android.googlesource.com/platform/system/core/+/master/rootdir/init.rc
](https://android.googlesource.com/platform/system/core/+/master/rootdir/init.rc) : -class_start
core
-class_start
main
...where all daemons that belong to class *core* and class *main* are started respectively.
/data/init.sh
runs at boot. If you have root, you can edit it as you like.
Inherently, their formats don't render them application-unmodifiable, but the sole alternative example of a user-modifiable shell script configuration file that I've seen is GRUB2's /etc/default/grub
, which I was under the impression was a *singularly* exceptional circumstance, especially because modifying it necessitates superuser permissions.
Relevantly, the security reduction that would arise from permitting applications to add arbitrary shell commands to that script would be obvious enough that I do not envisage this being the method by which services are added and configured.
Consequently, does AOSP include an initialisation system that applications can add to?
##### Rationale
The reason I ask here is because I'm asking as a user instead of a developer. That may appear nonsensical, but hopefully situations like [github.com/TacoTheDank/Scoop/issues/65#issuecomment-2571309312
](https://github.com/TacoTheDank/Scoop/issues/65#issuecomment-2571309312) , in which users must utilize development tools to bypass platform restrictions, provide adequate rationale.
RokeJulianLockhart
(556 rep)
Jan 4, 2025, 01:43 PM
• Last activity: Jan 5, 2025, 08:08 PM
2
votes
0
answers
531
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 from there it doesn't seem to work. I've used a sleep command to wait for the package manager servi...
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 from there it doesn't seem to work. I've used a sleep command to wait for the package manager service to load but I would like to find a proper solution.
I've had three ideas which all seems to lead to me to a dead end:
1. wait for a prop to show up, but the package manager service doesn't create any.
2. wait for a file to show up, again no such file exist
3. set my service in a class but it seems to be relevant for the service itself and not the trigger or am I misunderstanding something?
My current service definition is like so:
on boot
exec_background -- /vendor/bin/install.sh
yotamN
(121 rep)
May 8, 2023, 01:53 PM
• Last activity: May 9, 2023, 06:22 AM
12
votes
1
answers
35064
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: 1. Download arm binaries from: https://github.com/jedisct1/dnscrypt-proxy/releases 2. Push dnscrypt-proxy in /system/xbin 3. Push dnscrypt-proxy.toml in /etc/d...
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:
1. Download arm binaries from: https://github.com/jedisct1/dnscrypt-proxy/releases
2. Push dnscrypt-proxy in /system/xbin
3. Push dnscrypt-proxy.toml in /etc/dnscrypt-proxy/
4. Created the following script: /etc/init.d/99dnscrypt
#!/system/bin/sh
log -p i -t dnscrypt "Starting dnscrypt-proxy..."
dnscrypt-proxy -config /system/etc/dnscrypt-proxy/dnscrypt-proxy.toml &
log -p i -t dnscrypt "Changing dns with iptables..."
iptables -t nat -A OUTPUT -p udp --dport 53 -j DNAT --to-destination 127.0.0.1:53
5. Reboot
Now if i launch 99dnscrypt as root from adb it works like a charm
But on boot it does not.
On logcat i see this errors:
02-07 01:00:22.369 267 267 I sysinit : Running /system/etc/init.d/99dnscrypt
02-07 01:00:22.540 275 275 I dnscrypt: Starting dnscrypt-proxy...
02-07 01:00:22.878 278 278 I dnscrypt: Changing dns with iptables...
02-07 01:00:23.236 277 277 W dnscrypt-proxy: type=1400 audit(0.0:28): avc: denied { create } for scontext=u:r:sysinit:s0 tcontext=u:r:sysinit:s0 tclass=udp_socket permissive=0
02-07 01:00:23.236 277 277 W dnscrypt-proxy: type=1300 audit(0.0:28): arch=40000028 syscall=281 per=800008 success=no exit=-13 a0=2 a1=80802 a2=0 a3=b674a934 items=0 ppid=274 auid=4294967295 uid=0 gid=0 euid=0 suid=0 fsuid=0 egid=0 sgid=0 fsgid=0 tty=(none) ses=4294967295 exe="/system/bin/dnscrypt-proxy" subj=u:r:sysinit:s0 key=(null)
02-07 01:00:24.238 277 277 W dnscrypt-proxy: type=1400 audit(0.0:45): avc: denied { create } for scontext=u:r:sysinit:s0 tcontext=u:r:sysinit:s0 tclass=udp_socket permissive=0
02-07 01:00:24.238 277 277 W dnscrypt-proxy: type=1300 audit(0.0:45): arch=40000028 syscall=281 per=800008 success=no exit=-13 a0=2 a1=80802 a2=0 a3=b674a934 items=0 ppid=1 auid=4294967295 uid=0 gid=0 euid=0 suid=0 fsuid=0 egid=0 sgid=0 fsgid=0 tty=(none) ses=4294967295 exe="/system/bin/dnscrypt-proxy" subj=u:r:sysinit:s0 key=(null)
02-07 01:00:28.242 277 277 W dnscrypt-proxy: type=1400 audit(0.0:82): avc: denied { create } for scontext=u:r:sysinit:s0 tcontext=u:r:sysinit:s0 tclass=udp_socket permissive=0
02-07 01:00:28.242 277 277 W dnscrypt-proxy: type=1300 audit(0.0:82): arch=40000028 syscall=281 per=800008 success=no exit=-13 a0=2 a1=80802 a2=0 a3=b674a934 items=0 ppid=1 auid=4294967295 uid=0 gid=0 euid=0 suid=0 fsuid=0 egid=0 sgid=0 fsgid=0 tty=(none) ses=4294967295 exe="/system/bin/dnscrypt-proxy" subj=u:r:sysinit:s0 key=(null)
02-07 01:00:29.233 277 277 W dnscrypt-proxy: type=1400 audit(0.0:94): avc: denied { create } for scontext=u:r:sysinit:s0 tcontext=u:r:sysinit:s0 tclass=udp_socket permissive=0
02-07 01:00:29.233 277 277 W dnscrypt-proxy: type=1300 audit(0.0:94): arch=40000028 syscall=281 per=800008 success=no exit=-13 a0=2 a1=80802 a2=0 a3=b674a934 items=0 ppid=1 auid=4294967295 uid=0 gid=0 euid=0 suid=0 fsuid=0 egid=0 sgid=0 fsgid=0 tty=(none) ses=4294967295 exe="/system/bin/dnscrypt-proxy" subj=u:r:sysinit:s0 key=(null)
02-07 01:00:30.234 277 277 W dnscrypt-proxy: type=1400 audit(0.0:105): avc: denied { create } for scontext=u:r:sysinit:s0 tcontext=u:r:sysinit:s0 tclass=udp_socket permissive=0
02-07 01:00:30.234 277 277 W dnscrypt-proxy: type=1300 audit(0.0:105): arch=40000028 syscall=281 per=800008 success=no exit=-13 a0=2 a1=80802 a2=0 a3=b674a934 items=0 ppid=1 auid=4294967295 uid=0 gid=0 euid=0 suid=0 fsuid=0 egid=0 sgid=0 fsgid=0 tty=(none) ses=4294967295 exe="/system/bin/dnscrypt-proxy" subj=u:r:sysinit:s0 key=(null)
02-07 01:00:31.235 277 277 W dnscrypt-proxy: type=1400 audit(0.0:121): avc: denied { create } for scontext=u:r:sysinit:s0 tcontext=u:r:sysinit:s0 tclass=udp_socket permissive=0
02-07 01:00:31.235 277 277 W dnscrypt-proxy: type=1300 audit(0.0:121): arch=40000028 syscall=281 per=800008 success=no exit=-13 a0=2 a1=80802 a2=0 a3=b674a934 items=0 ppid=1 auid=4294967295 uid=0 gid=0 euid=0 suid=0 fsuid=0 egid=0 sgid=0 fsgid=0 tty=(none) ses=4294967295 exe="/system/bin/dnscrypt-proxy" subj=u:r:sysinit:s0 key=(null)
02-07 01:00:32.236 277 277 W dnscrypt-proxy: type=1400 audit(0.0:145): avc: denied { create } for scontext=u:r:sysinit:s0 tcontext=u:r:sysinit:s0 tclass=udp_socket permissive=0
02-07 01:00:32.236 277 277 W dnscrypt-proxy: type=1300 audit(0.0:145): arch=40000028 syscall=281 per=800008 success=no exit=-13 a0=2 a1=80802 a2=0 a3=b674a934 items=0 ppid=1 auid=4294967295 uid=0 gid=0 euid=0 suid=0 fsuid=0 egid=0 sgid=0 fsgid=0 tty=(none) ses=4294967295 exe="/system/bin/dnscrypt-proxy" subj=u:r:sysinit:s0 key=(null)
02-07 01:00:33.247 458 458 W dnscrypt-proxy: type=1400 audit(0.0:146): avc: denied { create } for scontext=u:r:sysinit:s0 tcontext=u:r:sysinit:s0 tclass=udp_socket permissive=0
02-07 01:00:33.247 458 458 W dnscrypt-proxy: type=1300 audit(0.0:146): arch=40000028 syscall=281 per=800008 success=no exit=-13 a0=2 a1=80802 a2=0 a3=b674a934 items=0 ppid=1 auid=4294967295 uid=0 gid=0 euid=0 suid=0 fsuid=0 egid=0 sgid=0 fsgid=0 tty=(none) ses=4294967295 exe="/system/bin/dnscrypt-proxy" subj=u:r:sysinit:s0 key=(null)
02-07 01:00:34.248 458 458 W dnscrypt-proxy: type=1400 audit(0.0:147): avc: denied { create } for scontext=u:r:sysinit:s0 tcontext=u:r:sysinit:s0 tclass=udp_socket permissive=0
02-07 01:00:34.248 458 458 W dnscrypt-proxy: type=1300 audit(0.0:147): arch=40000028 syscall=281 per=800008 success=no exit=-13 a0=2 a1=80802 a2=0 a3=b674a934 items=0 ppid=1 auid=4294967295 uid=0 gid=0 euid=0 suid=0 fsuid=0 egid=0 sgid=0 fsgid=0 tty=(none) ses=4294967295 exe="/system/bin/dnscrypt-proxy" subj=u:r:sysinit:s0 key=(null)
02-07 01:00:35.249 458 458 W dnscrypt-proxy: type=1400 audit(0.0:148): avc: denied { create } for scontext=u:r:sysinit:s0 tcontext=u:r:sysinit:s0 tclass=udp_socket permissive=0
02-07 01:00:35.249 458 458 W dnscrypt-proxy: type=1300 audit(0.0:148): arch=40000028 syscall=281 per=800008 success=no exit=-13 a0=2 a1=80802 a2=0 a3=b674a934 items=0 ppid=1 auid=4294967295 uid=0 gid=0 euid=0 suid=0 fsuid=0 egid=0 sgid=0 fsgid=0 tty=(none) ses=4294967295 exe="/system/bin/dnscrypt-proxy" subj=u:r:sysinit:s0 key=(null)
02-07 01:00:36.250 458 458 W dnscrypt-proxy: type=1400 audit(0.0:149): avc: denied { create } for scontext=u:r:sysinit:s0 tcontext=u:r:sysinit:s0 tclass=udp_socket permissive=0
02-07 01:00:36.250 458 458 W dnscrypt-proxy: type=1300 audit(0.0:149): arch=40000028 syscall=281 per=800008 success=no exit=-13 a0=2 a1=80802 a2=0 a3=b674a934 items=0 ppid=1 auid=4294967295 uid=0 gid=0 euid=0 suid=0 fsuid=0 egid=0 sgid=0 fsgid=0 tty=(none) ses=4294967295 exe="/system/bin/dnscrypt-proxy" subj=u:r:sysinit:s0 key=(null)
02-07 01:00:37.251 458 458 W dnscrypt-proxy: type=1400 audit(0.0:150): avc: denied { create } for scontext=u:r:sysinit:s0 tcontext=u:r:sysinit:s0 tclass=udp_socket permissive=0
02-07 01:00:37.251 458 458 W dnscrypt-proxy: type=1300 audit(0.0:150): arch=40000028 syscall=281 per=800008 success=no exit=-13 a0=2 a1=80802 a2=0 a3=b674a934 items=0 ppid=1 auid=4294967295 uid=0 gid=0 euid=0 suid=0 fsuid=0 egid=0 sgid=0 fsgid=0 tty=(none) ses=4294967295 exe="/system/bin/dnscrypt-proxy" subj=u:r:sysinit:s0 key=(null)
02-07 01:00:38.242 458 458 W dnscrypt-proxy: type=1400 audit(0.0:151): avc: denied { create } for scontext=u:r:sysinit:s0 tcontext=u:r:sysinit:s0 tclass=udp_socket permissive=0
02-07 01:00:38.242 458 458 W dnscrypt-proxy: type=1300 audit(0.0:151): arch=40000028 syscall=281 per=800008 success=no exit=-13 a0=2 a1=80802 a2=0 a3=b674a934 items=0 ppid=1 auid=4294967295 uid=0 gid=0 euid=0 suid=0 fsuid=0 egid=0 sgid=0 fsgid=0 tty=(none) ses=4294967295 exe="/system/bin/dnscrypt-proxy" subj=u:r:sysinit:s0 key=(null)
02-07 01:00:39.244 458 458 W dnscrypt-proxy: type=1400 audit(0.0:152): avc: denied { create } for scontext=u:r:sysinit:s0 tcontext=u:r:sysinit:s0 tclass=udp_socket permissive=0
02-07 01:00:39.244 458 458 W dnscrypt-proxy: type=1300 audit(0.0:152): arch=40000028 syscall=281 per=800008 success=no exit=-13 a0=2 a1=80802 a2=0 a3=b674a934 items=0 ppid=1 auid=4294967295 uid=0 gid=0 euid=0 suid=0 fsuid=0 egid=0 sgid=0 fsgid=0 tty=(none) ses=4294967295 exe="/system/bin/dnscrypt-proxy" subj=u:r:sysinit:s0 key=(null)
02-07 01:00:40.245 458 458 W dnscrypt-proxy: type=1400 audit(0.0:153): avc: denied { create } for scontext=u:r:sysinit:s0 tcontext=u:r:sysinit:s0 tclass=udp_socket permissive=0
02-07 01:00:40.245 458 458 W dnscrypt-proxy: type=1300 audit(0.0:153): arch=40000028 syscall=281 per=800008 success=no exit=-13 a0=2 a1=80802 a2=0 a3=b674a934 items=0 ppid=1 auid=4294967295 uid=0 gid=0 euid=0 suid=0 fsuid=0 egid=0 sgid=0 fsgid=0 tty=(none) ses=4294967295 exe="/system/bin/dnscrypt-proxy" subj=u:r:sysinit:s0 key=(null)
02-07 01:00:41.246 458 458 W dnscrypt-proxy: type=1400 audit(0.0:154): avc: denied { create } for scontext=u:r:sysinit:s0 tcontext=u:r:sysinit:s0 tclass=udp_socket permissive=0
02-07 01:00:41.246 458 458 W dnscrypt-proxy: type=1300 audit(0.0:154): arch=40000028 syscall=281 per=800008 success=no exit=-13 a0=2 a1=80802 a2=0 a3=b674a934 items=0 ppid=1 auid=4294967295 uid=0 gid=0 euid=0 suid=0 fsuid=0 egid=0 sgid=0 fsgid=0 tty=(none) ses=4294967295 exe="/system/bin/dnscrypt-proxy" subj=u:r:sysinit:s0 key=(null)
02-07 01:00:42.247 458 458 W dnscrypt-proxy: type=1400 audit(0.0:155): avc: denied { create } for scontext=u:r:sysinit:s0 tcontext=u:r:sysinit:s0 tclass=udp_socket permissive=0
02-07 01:00:42.247 458 458 W dnscrypt-proxy: type=1300 audit(0.0:155): arch=40000028 syscall=281 per=800008 success=no exit=-13 a0=2 a1=80802 a2=0 a3=b674a934 items=0 ppid=1 auid=4294967295 uid=0 gid=0 euid=0 suid=0 fsuid=0 egid=0 sgid=0 fsgid=0 tty=(none) ses=4294967295 exe="/system/bin/dnscrypt-proxy" subj=u:r:sysinit:s0 key=(null)
02-07 01:00:43.248 458 458 W dnscrypt-proxy: type=1400 audit(0.0:156): avc: denied { create } for scontext=u:r:sysinit:s0 tcontext=u:r:sysinit:s0 tclass=udp_socket permissive=0
02-07 01:00:43.248 458 458 W dnscrypt-proxy: type=1300 audit(0.0:156): arch=40000028 syscall=281 per=800008 success=no exit=-13 a0=2 a1=80802 a2=0 a3=b674a934 items=0 ppid=1 auid=4294967295 uid=0 gid=0 euid=0 suid=0 fsuid=0 egid=0 sgid=0 fsgid=0 tty=(none) ses=4294967295 exe="/system/bin/dnscrypt-proxy" subj=u:r:sysinit:s0 key=(null)
02-07 01:00:44.249 458 458 W dnscrypt-proxy: type=1400 audit(0.0:157): avc: denied { create } for scontext=u:r:sysinit:s0 tcontext=u:r:sysinit:s0 tclass=udp_socket permissive=0
02-07 01:00:44.249 458 458 W dnscrypt-proxy: type=1300 audit(0.0:157): arch=40000028 syscall=281 per=800008 success=no exit=-13 a0=2 a1=80802 a2=0 a3=b674a934 items=0 ppid=1 auid=4294967295 uid=0 gid=0 euid=0 suid=0 fsuid=0 egid=0 sgid=0 fsgid=0 tty=(none) ses=4294967295 exe="/system/bin/dnscrypt-proxy" subj=u:r:sysinit:s0 key=(null)
02-07 01:00:46.251 458 458 W dnscrypt-proxy: type=1400 audit(0.0:185): avc: denied { create } for scontext=u:r:sysinit:s0 tcontext=u:r:sysinit:s0 tclass=udp_socket permissive=0
02-07 01:00:46.251 458 458 W dnscrypt-proxy: type=1300 audit(0.0:185): arch=40000028 syscall=281 per=800008 success=no exit=-13 a0=2 a1=80802 a2=0 a3=b674a934 items=0 ppid=1 auid=4294967295 uid=0 gid=0 euid=0 suid=0 fsuid=0 egid=0 sgid=0 fsgid=0 tty=(none) ses=4294967295 exe="/system/bin/dnscrypt-proxy" subj=u:r:sysinit:s0 key=(null)
02-07 01:00:47.252 458 458 W dnscrypt-proxy: type=1400 audit(0.0:186): avc: denied { create } for scontext=u:r:sysinit:s0 tcontext=u:r:sysinit:s0 tclass=udp_socket permissive=0
02-07 01:00:47.252 458 458 W dnscrypt-proxy: type=1300 audit(0.0:186): arch=40000028 syscall=281 per=800008 success=no exit=-13 a0=2 a1=80802 a2=0 a3=b674a934 items=0 ppid=1 auid=4294967295 uid=0 gid=0 euid=0 suid=0 fsuid=0 egid=0 sgid=0 fsgid=0 tty=(none) ses=4294967295 exe="/system/bin/dnscrypt-proxy" subj=u:r:sysinit:s0 key=(null)
02-07 01:00:48.243 458 458 W dnscrypt-proxy: type=1400 audit(0.0:187): avc: denied { create } for scontext=u:r:sysinit:s0 tcontext=u:r:sysinit:s0 tclass=udp_socket permissive=0
02-07 01:00:48.243 458 458 W dnscrypt-proxy: type=1300 audit(0.0:187): arch=40000028 syscall=281 per=800008 success=no exit=-13 a0=2 a1=80802 a2=0 a3=b674a934 items=0 ppid=1 auid=4294967295 uid=0 gid=0 euid=0 suid=0 fsuid=0 egid=0 sgid=0 fsgid=0 tty=(none) ses=4294967295 exe="/system/bin/dnscrypt-proxy" subj=u:r:sysinit:s0 key=(null)
02-07 01:00:49.254 458 458 W dnscrypt-proxy: type=1400 audit(0.0:188): avc: denied { create } for scontext=u:r:sysinit:s0 tcontext=u:r:sysinit:s0 tclass=udp_socket permissive=0
02-07 01:00:49.254 458 458 W dnscrypt-proxy: type=1300 audit(0.0:188): arch=40000028 syscall=281 per=800008 success=no exit=-13 a0=2 a1=80802 a2=0 a3=b674a934 items=0 ppid=1 auid=4294967295 uid=0 gid=0 euid=0 suid=0 fsuid=0 egid=0 sgid=0 fsgid=0 tty=(none) ses=4294967295 exe="/system/bin/dnscrypt-proxy" subj=u:r:sysinit:s0 key=(null)
02-07 01:00:50.255 458 458 W dnscrypt-proxy: type=1400 audit(0.0:189): avc: denied { create } for scontext=u:r:sysinit:s0 tcontext=u:r:sysinit:s0 tclass=udp_socket permissive=0
02-07 01:00:50.255 458 458 W dnscrypt-proxy: type=1300 audit(0.0:189): arch=40000028 syscall=281 per=800008 success=no exit=-13 a0=2 a1=80802 a2=0 a3=b674a934 items=0 ppid=1 auid=4294967295 uid=0 gid=0 euid=0 suid=0 fsuid=0 egid=0 sgid=0 fsgid=0 tty=(none) ses=4294967295 exe="/system/bin/dnscrypt-proxy" subj=u:r:sysinit:s0 key=(null)
02-07 01:00:51.256 458 458 W dnscrypt-proxy: type=1400 audit(0.0:190): avc: denied { create } for scontext=u:r:sysinit:s0 tcontext=u:r:sysinit:s0 tclass=udp_socket permissive=0
02-07 01:00:51.256 458 458 W dnscrypt-proxy: type=1300 audit(0.0:190): arch=40000028 syscall=281 per=800008 success=no exit=-13 a0=2 a1=80802 a2=0 a3=b674a934 items=0 ppid=1 auid=4294967295 uid=0 gid=0 euid=0 suid=0 fsuid=0 egid=0 sgid=0 fsgid=0 tty=(none) ses=4294967295 exe="/system/bin/dnscrypt-proxy" subj=u:r:sysinit:s0 key=(null)
02-07 01:00:52.257 458 458 W dnscrypt-proxy: type=1400 audit(0.0:191): avc: denied { create } for scontext=u:r:sysinit:s0 tcontext=u:r:sysinit:s0 tclass=udp_socket permissive=0
02-07 01:00:52.257 458 458 W dnscrypt-proxy: type=1300 audit(0.0:191): arch=40000028 syscall=281 per=800008 success=no exit=-13 a0=2 a1=80802 a2=0 a3=b674a934 items=0 ppid=1 auid=4294967295 uid=0 gid=0 euid=0 suid=0 fsuid=0 egid=0 sgid=0 fsgid=0 tty=(none) ses=4294967295 exe="/system/bin/dnscrypt-proxy" subj=u:r:sysinit:s0 key=(null)
02-07 01:00:53.259 458 458 W dnscrypt-proxy: type=1400 audit(0.0:192): avc: denied { create } for scontext=u:r:sysinit:s0 tcontext=u:r:sysinit:s0 tclass=udp_socket permissive=0
02-07 01:00:53.259 458 458 W dnscrypt-proxy: type=1300 audit(0.0:192): arch=40000028 syscall=281 per=800008 success=no exit=-13 a0=2 a1=80802 a2=0 a3=b674a934 items=0 ppid=1 auid=4294967295 uid=0 gid=0 euid=0 suid=0 fsuid=0 egid=0 sgid=0 fsgid=0 tty=(none) ses=4294967295 exe="/system/bin/dnscrypt-proxy" subj=u:r:sysinit:s0 key=(null)
02-07 01:00:54.260 458 458 W dnscrypt-proxy: type=1400 audit(0.0:193): avc: denied { create } for scontext=u:r:sysinit:s0 tcontext=u:r:sysinit:s0 tclass=udp_socket permissive=0
02-07 01:00:54.260 458 458 W dnscrypt-proxy: type=1300 audit(0.0:193): arch=40000028 syscall=281 per=800008 success=no exit=-13 a0=2 a1=80802 a2=0 a3=b674a934 items=0 ppid=1 auid=4294967295 uid=0 gid=0 euid=0 suid=0 fsuid=0 egid=0 sgid=0 fsgid=0 tty=(none) ses=4294967295 exe="/system/bin/dnscrypt-proxy" subj=u:r:sysinit:s0 key=(null)
02-07 01:00:55.261 458 458 W dnscrypt-proxy: type=1400 audit(0.0:194): avc: denied { create } for scontext=u:r:sysinit:s0 tcontext=u:r:sysinit:s0 tclass=udp_socket permissive=0
02-07 01:00:55.261 458 458 W dnscrypt-proxy: type=1300 audit(0.0:194): arch=40000028 syscall=281 per=800008 success=no exit=-13 a0=2 a1=80802 a2=0 a3=b674a934 items=0 ppid=1 auid=4294967295 uid=0 gid=0 euid=0 suid=0 fsuid=0 egid=0 sgid=0 fsgid=0 tty=(none) ses=4294967295 exe="/system/bin/dnscrypt-proxy" subj=u:r:sysinit:s0 key=(null)
02-07 01:00:56.262 458 458 W dnscrypt-proxy: type=1400 audit(0.0:195): avc: denied { create } for scontext=u:r:sysinit:s0 tcontext=u:r:sysinit:s0 tclass=udp_socket permissive=0
02-07 01:00:56.262 458 458 W dnscrypt-proxy: type=1300 audit(0.0:195): arch=40000028 syscall=281 per=800008 success=no exit=-13 a0=2 a1=80802 a2=0 a3=b674a934 items=0 ppid=1 auid=4294967295 uid=0 gid=0 euid=0 suid=0 fsuid=0 egid=0 sgid=0 fsgid=0 tty=(none) ses=4294967295 exe="/system/bin/dnscrypt-proxy" subj=u:r:sysinit:s0 key=(null)
02-07 01:00:57.253 458 458 W dnscrypt-proxy: type=1400 audit(0.0:196): avc: denied { create } for scontext=u:r:sysinit:s0 tcontext=u:r:sysinit:s0 tclass=udp_socket permissive=0
02-07 01:00:57.253 458 458 W dnscrypt-proxy: type=1300 audit(0.0:196): arch=40000028 syscall=281 per=800008 success=no exit=-13 a0=2 a1=80802 a2=0 a3=b674a934 items=0 ppid=1 auid=4294967295 uid=0 gid=0 euid=0 suid=0 fsuid=0 egid=0 sgid=0 fsgid=0 tty=(none) ses=4294967295 exe="/system/bin/dnscrypt-proxy" subj=u:r:sysinit:s0 key=(null)
02-07 01:00:58.254 458 458 W dnscrypt-proxy: type=1400 audit(0.0:197): avc: denied { create } for scontext=u:r:sysinit:s0 tcontext=u:r:sysinit:s0 tclass=udp_socket permissive=0
02-07 01:00:58.254 458 458 W dnscrypt-proxy: type=1300 audit(0.0:197): arch=40000028 syscall=281 per=800008 success=no exit=-13 a0=2 a1=80802 a2=0 a3=b674a934 items=0 ppid=1 auid=4294967295 uid=0 gid=0 euid=0 suid=0 fsuid=0 egid=0 sgid=0 fsgid=0 tty=(none) ses=4294967295 exe="/system/bin/dnscrypt-proxy" subj=u:r:sysinit:s0 key=(null)
02-07 01:00:59.255 458 458 W dnscrypt-proxy: type=1400 audit(0.0:198): avc: denied { create } for scontext=u:r:sysinit:s0 tcontext=u:r:sysinit:s0 tclass=udp_socket permissive=0
02-07 01:00:59.255 458 458 W dnscrypt-proxy: type=1300 audit(0.0:198): arch=40000028 syscall=281 per=800008 success=no exit=-13 a0=2 a1=80802 a2=0 a3=b674a934 items=0 ppid=1 auid=4294967295 uid=0 gid=0 euid=0 suid=0 fsuid=0 egid=0 sgid=0 fsgid=0 tty=(none) ses=4294967295 exe="/system/bin/dnscrypt-proxy" subj=u:r:sysinit:s0 key=(null)
02-07 01:01:00.256 458 458 W dnscrypt-proxy: type=1400 audit(0.0:203): avc: denied { create } for scontext=u:r:sysinit:s0 tcontext=u:r:sysinit:s0 tclass=udp_socket permissive=0
02-07 01:01:00.256 458 458 W dnscrypt-proxy: type=1300 audit(0.0:203): arch=40000028 syscall=281 per=800008 success=no exit=-13 a0=2 a1=80802 a2=0 a3=b674a934 items=0 ppid=1 auid=4294967295 uid=0 gid=0 euid=0 suid=0 fsuid=0 egid=0 sgid=0 fsgid=0 tty=(none) ses=4294967295 exe="/system/bin/dnscrypt-proxy" subj=u:r:sysinit:s0 key=(null)
02-07 01:01:01.257 458 458 W dnscrypt-proxy: type=1400 audit(0.0:204): avc: denied { create } for scontext=u:r:sysinit:s0 tcontext=u:r:sysinit:s0 tclass=udp_socket permissive=0
02-07 01:01:01.257 458 458 W dnscrypt-proxy: type=1300 audit(0.0:204): arch=40000028 syscall=281 per=800008 success=no exit=-13 a0=2 a1=80802 a2=0 a3=b674a934 items=0 ppid=1 auid=4294967295 uid=0 gid=0 euid=0 suid=0 fsuid=0 egid=0 sgid=0 fsgid=0 tty=(none) ses=4294967295 exe="/system/bin/dnscrypt-proxy" subj=u:r:sysinit:s0 key=(null)
02-07 01:01:02.258 458 458 W dnscrypt-proxy: type=1400 audit(0.0:207): avc: denied { create } for scontext=u:r:sysinit:s0 tcontext=u:r:sysinit:s0 tclass=udp_socket permissive=0
02-07 01:01:02.258 458 458 W dnscrypt-proxy: type=1300 audit(0.0:207): arch=40000028 syscall=281 per=800008 success=no exit=-13 a0=2 a1=80802 a2=0 a3=b674a934 items=0 ppid=1 auid=4294967295 uid=0 gid=0 euid=0 suid=0 fsuid=0 egid=0 sgid=0 fsgid=0 tty=(none) ses=4294967295 exe="/system/bin/dnscrypt-proxy" subj=u:r:sysinit:s0 key=(null)
What is the difference between executing this as root after boot and launch it from init.d? Any idea how i can solve this?
wellsaid
(121 rep)
Feb 7, 2019, 12:09 AM
• Last activity: May 3, 2023, 11:13 AM
6
votes
2
answers
4339
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 required functionality without the use of Magisk or other tools. I did it by placing my executable ins...
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 required functionality without the use of Magisk or other tools. I did it by placing my executable inside system directory and run it as a daemon. This daemon required access on some location which is restricted by SELinux policies.
I have injected the required policy with following commands:
sepolicy-inject -s init -t su -c process -p transition -l
sepolicy-inject -s su -t system_file -c file -p entrypoint -l
sepolicy-inject -s init -t su -c process -p rlimitinh -l
sepolicy-inject -s init -t su -c process -p siginh -l
sepolicy-inject -s su -t shell_exec -c file -p read -l
sepolicy-inject -s su -t shell_exec -c file -p execute -l
sepolicy-inject -s su -t shell_exec -c file -p getattr -l
sepolicy-inject -s su -t vendor_toolbox_exec -c file -p execute_no_trans -l
sepolicy-inject -s init -t su -c process -p noatsecure -l
sepolicy-inject -s su -t toolbox_exec -c file -p getattr -l
sepolicy-inject -s su -t toolbox_exec -c file -p execute -l
sepolicy-inject -s su -t system_file -c file -p execute_no_trans -l
sepolicy-inject -s su -t storage_file -c dir -p search -l
sepolicy-inject -s su -t storage_file -c lnk_file -p read -l
sepolicy-inject -s su -t tmpfs -c dir -p search -l
sepolicy-inject -s su -t mnt_user_file -c dir -p search -l
sepolicy-inject -s su -t mnt_user_file -c lnk_file -p read -l
sepolicy-inject -s su -t sdcardfs -c dir -p search -l
sepolicy-inject -s su -t sdcardfs -c file -p append -l
sepolicy-inject -s su -t toolbox_exec -c file -p read -l
sepolicy-inject -s su -t toolbox_exec -c file -p open -l
sepolicy-inject -s su -t sdcardfs -c file -p read -l
sepolicy-inject -s su -t sdcardfs -c file -p write -l
sepolicy-inject -s su -t sdcardfs -c file -p open -l
sepolicy-inject -s su -t media_rw_data_file -c file -p read -l
sepolicy-inject -s su -t media_rw_data_file -c file -p write -l
sepolicy-inject -s su -t media_rw_data_file -c file -p open -l
sepolicy-inject -s su -t media_rw_data_file -c file -p append -l
The problem is that they are not persistent after reboot. I know I can extract boot.img and ramdisk, replace /sepolicy with new policy file copied from /sys/fs/selinux/policy, repack boot.img and flash back.
I want to do it without reflashing boot.img
. Is there any way with which I can execute above commands after Android finishes with generating SELinux files?
I have tried following rc files:
#/etc/init/custom.rc
# define service, use executable here if script not needed
service custom /system/bin/custom.sh
# don't start unless explicitly asked to
disabled
# Use seclabel u:r:magisk:s0
to run with unrestricted SELinux context to avoid avc denials
# can also use "u:r:su:s0" on userdebug / eng builds if no Magisk
# it's required if SELinux is enforcing and service needs access
# to some system resources not allowed by default sepolicy
seclabel u:r:su:s0
# start the service when boot is completed
on property:sys.boot_completed=1
sepolicy-inject -s init -t su -c process -p transition -l
sepolicy-inject -s su -t system_file -c file -p entrypoint -l
sepolicy-inject -s init -t su -c process -p rlimitinh -l
sepolicy-inject -s init -t su -c process -p siginh -l
sepolicy-inject -s su -t shell_exec -c file -p read -l
sepolicy-inject -s su -t shell_exec -c file -p execute -l
sepolicy-inject -s su -t shell_exec -c file -p getattr -l
sepolicy-inject -s su -t vendor_toolbox_exec -c file -p execute_no_trans -l
sepolicy-inject -s init -t su -c process -p noatsecure -l
sepolicy-inject -s su -t toolbox_exec -c file -p getattr -l
sepolicy-inject -s su -t toolbox_exec -c file -p execute -l
sepolicy-inject -s su -t system_file -c file -p execute_no_trans -l
sepolicy-inject -s su -t storage_file -c dir -p search -l
sepolicy-inject -s su -t storage_file -c lnk_file -p read -l
sepolicy-inject -s su -t tmpfs -c dir -p search -l
sepolicy-inject -s su -t mnt_user_file -c dir -p search -l
sepolicy-inject -s su -t mnt_user_file -c lnk_file -p read -l
sepolicy-inject -s su -t sdcardfs -c dir -p search -l
sepolicy-inject -s su -t sdcardfs -c file -p append -l
sepolicy-inject -s su -t toolbox_exec -c file -p read -l
sepolicy-inject -s su -t toolbox_exec -c file -p open -l
sepolicy-inject -s su -t sdcardfs -c file -p read -l
sepolicy-inject -s su -t sdcardfs -c file -p write -l
sepolicy-inject -s su -t sdcardfs -c file -p open -l
sepolicy-inject -s su -t media_rw_data_file -c file -p read -l
sepolicy-inject -s su -t media_rw_data_file -c file -p write -l
sepolicy-inject -s su -t media_rw_data_file -c file -p open -l
sepolicy-inject -s su -t media_rw_data_file -c file -p append -l
start custom
but it is not working because I think Android generates SELinux files after my custom service has been triggered.
Also tried above commands on onrestart
option of init service but failed.
Any suggestion?
Vatish Sharma
(1101 rep)
Jul 22, 2019, 11:20 AM
• Last activity: Aug 22, 2022, 11:36 AM
1
votes
2
answers
2304
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-verity` after running `adb root` and `adb remount` commands. As documented [here][1], this devic...
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-verity
after running adb root
and adb remount
commands.
As documented here , this device also has split
policies at /system/etc/selinux
(the 'plat' portion of the policy) and /vendor/etc/selinux
(the 'nonplat' portion of the policy).
I am trying to run test.sh
using following init script:
#/etc/init/m_daemon.rc
# define service, use executable here if script not needed
service m_daemon /system/xbin/test.sh
# don't start unless explicitly asked to
disabled
# Use seclabel u:r:magisk:s0
to run with unrestricted SELinux context to avoid avc denials
# can also use "u:r:su:s0" on userdebug / eng builds if no Magisk.
# It's required if SELinux is enforcing and service needs access
# to some system resources not allowed by default sepolicy
# seclabel u:object_r:qlogd_exec:s0
seclabel u:r:su:s0
# start the service when the boot is completed
on property:sys.boot_completed=1
# Use it to start the service
start m_daemon
/system/xbin/test.sh
file has the following contents:
#!/system/bin/sh
echo date
> /sdcard/test
When the device reboot then it fails to run with the following error:
> 202.932913 / 11-26 20:21:04.074 audit: type=1400 audit(1574763664.074:213): avc: denied { transition } for pid=8534 comm="init" path="/system/xbin/test.sh" dev="sda24" ino=8150 scontext=u:r:init:s0 tcontext=u:r:su:s0 tclass=process permissive=0
>
> 202.933268 / 11-26 20:21:04.074 init: cannot execve('/system/xbin/test.sh'): Permission denied
To fix it, I have used sepolicy-inject
and run the following commands:
sepolicy-inject -s init -t su -c process -p transition -P /sys/fs/selinux/policy -l
sepolicy-inject -s init -t su -c process -p noatsecure -P /sys/fs/selinux/policy -l
sepolicy-inject -s init -t su -c process -p rlimitinh -P /sys/fs/selinux/policy -l
sepolicy-inject -s init -t su -c process -p siginh -P /sys/fs/selinux/policy -l
but these needs to be run again after reboot.
So, I have tried to patch precompiled_sepolicy
using following commands:
sepolicy-inject -s init -t su -c process -p transition -P /vendor/etc/selinux/precompiled_sepolicy -l
sepolicy-inject -s init -t su -c process -p noatsecure -P /vendor/etc/selinux/precompiled_sepolicy -l
sepolicy-inject -s init -t su -c process -p rlimitinh -P /vendor/etc/selinux/precompiled_sepolicy -l
sepolicy-inject -s init -t su -c process -p siginh -P /vendor/etc/selinux/precompiled_sepolicy -l
but the policies are not injected: neither live nor after reboot.
To test, I am just checking the date in /sdcard/test
file.
So, I just want to know:
- Why patching precompiled_policy
didn't work?
- Where to patch the required policies using rooted adb shell that should persist after a reboot?
Vatish Sharma
(1101 rep)
Nov 26, 2019, 06:52 AM
• Last activity: Aug 22, 2022, 11:32 AM
1
votes
0
answers
568
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 (Android 11), logcat gave a ton of information about a system service going haywire: ``` 06-25 15:50:23....
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 (Android 11), logcat gave a ton of information about a system service going haywire:
06-25 15:50:23.258 0 0 I init : starting service 'fps_hal'...
06-25 15:50:23.262 0 0 I init : Created socket '/dev/socket/fpc_oem', mode 660, user 1000, group 1000
06-25 15:50:24.116 30815 30815 D fpc_hidl: fpc fingerprint hwbinder service starting
06-25 15:50:24.117 30815 30815 D libfingerprint_core: core_init
06-25 15:50:24.117 30815 30817 D libfingerprint_core: worker_thread: started
06-25 15:50:24.117 30815 30817 D libfingerprint_core: pick_task: suspended 0
06-25 15:50:24.117 30815 30817 D libfingerprint_core: pick_task: No tasks
06-25 15:50:24.117 30815 30817 D libfingerprint_core: worker_thread: Waiting tasks, suspended 0, on pause 0
06-25 15:50:24.120 30815 30815 I fingerprint_key_handler: Input device qpnp_pon (/dev/input/event0) supports KEY_POWER
06-25 15:50:24.122 30815 30815 D fingerprint-oem-server: install_oem_client_handler: installed ID 2
06-25 15:50:24.122 30815 30815 D fingerprint-oem-server: install_oem_client_handler: installed ID 3
06-25 15:50:24.122 30815 30818 I fingerprint_key_handler: key_thread: starting
06-25 15:50:24.124 30815 30815 I fingerprint_key_handler: Input device qpnp_pon (/dev/input/event0) supports KEY_POWER
06-25 15:50:24.126 30815 30815 D fingerprint-oem-server: start_oem_server
06-25 15:50:24.126 30815 30815 D fingerprint-oem-server: open_socket: pass
06-25 15:50:24.126 30815 30815 D libfingerprint_core: core_init fingerprint wakeup supported.
06-25 15:50:24.126 30815 30815 D libfingerprint_core: set_env: added key 'hal_dev' value 0x71ac4e7430
06-25 15:50:24.126 30815 30815 D libfingerprint_core: task_alloc: authenticate
06-25 15:50:24.126 30815 30815 D libfingerprint_core: task_set_suspendable: authenticate
06-25 15:50:24.126 30815 30815 D libfingerprint_core: task_alloc: enroll
06-25 15:50:24.126 30815 30815 D libfingerprint_core: task_alloc: remove
06-25 15:50:24.126 30815 30815 D libfingerprint_core: task_alloc: enumerate
06-25 15:50:24.127 30815 30819 I fingerprint_key_handler: key_thread: starting
06-25 15:50:24.133 30815 30815 D QSEECOMAPI: QSEECom_get_handle sb_length = 0x80
06-25 15:50:24.134 30815 30815 D QSEECOMAPI: App is not loaded in QSEE
06-25 15:50:24.134 30815 30815 D QSEECOMAPI: app_arch = 1, total_files = 9
06-25 15:50:23.346 0 0 W QSEECOM : qseecom_load_app: App (fpctzfingerprint) does'nt exist, loading apps for first time
06-25 15:50:24.257 30815 30815 D QSEECOMAPI: Loaded image: APP id = 69996
06-25 15:50:23.464 0 0 W QSEECOM : qseecom_load_app: App with id 69996 (fpctzfingerprint) now loaded
06-25 15:50:24.264 30815 30815 E fpc_tac : fpc_tac_transfer send_cmd failed -11
06-25 15:50:24.264 30815 30815 E fpc_tac : fpc_tee_print_build_info, fpc_tac_transfer failed -4.
06-25 15:50:24.273 30815 30815 E fpc_tac : fpc_tac_transfer send_cmd failed -11
06-25 15:50:24.273 30815 30815 E fpc_tac : sensor_command, Failed to send command: 4 to TA, status code: -4
06-25 15:50:24.277 30815 30815 E fpc_fingerprint_hal: fpc_hal_open failed
06-25 15:50:24.277 30815 30815 I scudo : Scudo ERROR: invalid chunk state when deallocating address 0x00705c4e4350
06-25 15:50:24.277 30815 30815 F libc : Fatal signal 6 (SIGABRT), code -1 (SI_QUEUE) in tid 30815 (fpc_fingerprint), pid 30815 (fpc_fingerprint)
06-25 15:50:24.336 30823 30823 I crash_dump64: obtaining output fd from tombstoned, type: kDebuggerdTombstone
06-25 15:50:24.337 726 726 I tombstoned: received crash request for pid 30815
06-25 15:50:24.337 30823 30823 I crash_dump64: performing dump of process 30815 (target tid = 30815)
Pulling out some keywords, I ran getprop|grep "init"
and all the init services are listed as running except this one:
And that's where I'm stuck. service list
gives me nothing to go on, Google gives me nothing, and my knowledge of the Android init procedure and directory structure is close to nil.
Can anyone help point me to where this service is managed from, and how to disable it? If the location is SELinux protected, is there a way to patch without re-flashing the entire ROM? Thanks in advance.
ifiht
(111 rep)
Jun 25, 2022, 08:01 PM
0
votes
1
answers
1409
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][1] to do so(I'm not using Marsh Mellow so skip the first part of the guide). When I installed Link2SD and rebooted my device it flashed an error saying: > "Mount Script Error. [4]: can't create /system/etc/init...
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 my device it flashed an error saying:
> "Mount Script Error. : can't create /system/etc/init.d/11link2sd:
> Not a directory"
I searched for this error and landed on this page . The solutions provided here do not seem to work for me and I wonder if it'd be dangerous to manually delete the file "init.d" and create the directory that Link2SD has been trying to create. But before I do so **I want to know what exactly is this file for and would it be safe to delete it**?
Bonus Question: Even if I delete it, would it be created again after I reboot my device?
7_R3X
(101 rep)
Jun 7, 2016, 02:23 PM
• Last activity: Mar 30, 2022, 07:02 AM
3
votes
1
answers
1298
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.SystemupdateService su -c pm disable com.google.android.gms/.update.SystemUpdateGcmTaskService I can con...
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.SystemupdateService
su -c pm disable com.google.android.gms/.update.SystemUpdateGcmTaskService
I can confirm that normal pm disable commands work to disable non system applications. So I suspect I'm not doing something right to su privileges.
user199849
(74 rep)
Dec 8, 2016, 12:36 AM
• Last activity: Jan 8, 2022, 10:04 AM
2
votes
0
answers
419
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 ideas? ``` :/tmp/ramdisk$ cpio -idv < ramdisk.cpio apex debug_ramdisk dev init mnt proc sys 2690 blocks :/tmp/r...
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 ideas?
:/tmp/ramdisk$ cpio -idv < ramdisk.cpio
apex
debug_ramdisk
dev
init
mnt
proc
sys
2690 blocks
:/tmp/ramdisk$ find
.
./init
./mnt
./ramdisk.cpio
./proc
./debug_ramdisk
./dev
./sys
./apex
P_J
(31 rep)
Feb 17, 2021, 06:38 AM
2
votes
0
answers
783
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 (using 'adb shell') and runs the script(using 'sh my_script.sh') I get error: ``` Exception o...
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 (using 'adb shell') and runs the script(using 'sh my_script.sh')
I get error:
Exception occurred while executing:
java.lang.IllegalArgumentException: Error: Can't open file: /data/local/tmp/MagiskManager-v7.1.1.apk
at com.android.server.pm.PackageManagerShellCommand.setParamsSize(PackageManagerShellCommand.java:461)
at com.android.server.pm.PackageManagerShellCommand.runInstall(PackageManagerShellCommand.java:1060)
at com.android.server.pm.PackageManagerShellCommand.onCommand(PackageManagerShellCommand.java:169)
at android.os.ShellCommand.exec(ShellCommand.java:111)
at com.android.server.pm.PackageManagerService.onShellCommand(PackageManagerService.java:22472)
at android.os.Binder.shellCommand(Binder.java:881)
at android.os.Binder.onTransact(Binder.java:765)
at android.content.pm.IPackageManager$Stub.onTransact(IPackageManager.java:4924)
at com.android.server.pm.PackageManagerService.onTransact(PackageManagerService.java:4118)
at android.os.Binder.execTransactInternal(Binder.java:1021)
at android.os.Binder.execTransact(Binder.java:994)
I already tried to put the apk in /data/local/tmp but it's not working.
Also init.d app failed to run the script
Barel Elbaz
(31 rep)
Dec 30, 2020, 06:38 AM
• Last activity: Dec 30, 2020, 08:16 PM
1
votes
1
answers
691
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 about it in logcat either. on property:myprop=1 start mysvc service mysvc /system/bin/mybinary myargs u...
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 about it in logcat either.
on property:myprop=1
start mysvc
service mysvc /system/bin/mybinary myargs
user system
group system
oneshot
My app sets this property when I want the service to start.
Any help here is appreciated.
Chef Pharaoh
(131 rep)
Dec 2, 2020, 10:44 PM
• Last activity: Dec 4, 2020, 03:02 PM
1
votes
1
answers
1378
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 /data/data/app_name/cache and don't know how to automate it, because cache folder is a sub-directory...
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 /data/data/app_name/cache and don't know how to automate it, because cache folder is a sub-directory
I'm new to bash scripting and this would help me significantly in programming overall
Phone is magisk'ed Android 10.
Jtnqr
(161 rep)
Nov 1, 2020, 01:00 PM
• Last activity: Nov 16, 2020, 06:29 AM
1
votes
0
answers
874
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 /data/media/0/WhatsApp/* /data/media/0/WhatsApp/.* $sdcard/WhatsApp/ ``` But then `mv` outputting this `...
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 /data/media/0/WhatsApp/* /data/media/0/WhatsApp/.* $sdcard/WhatsApp/
But then mv
outputting this
mv: can't remove '/data/media/0/WhatsApp/.Shared': Is a directory
mv: can't remove '/data/media/0/WhatsApp/.StickerThumbs': Is a directory
mv: can't remove '/data/media/0/WhatsApp/.Thumbs': Is a directory
mv: can't remove '/data/media/0/WhatsApp/.trash': Is a directory
mv: can't remove '/data/media/0/WhatsApp/Backups': Is a directory
mv: can't remove '/data/media/0/WhatsApp/Databases': Is a directory
mv: can't remove '/data/media/0/WhatsApp/Media': Is a directory
What is happening here?
Maybe I should use this instead?
cp -r /data/media/0/WhatsApp/* $sdcard/WhatsApp/
cp -r /data/media/0/WhatsApp/.* $sdcard/WhatsApp/
rm -rf /data/media/0/WhatsApp/
I'm running this using init.d
Jtnqr
(161 rep)
Nov 14, 2020, 06:04 AM
• Last activity: Nov 16, 2020, 05:56 AM
0
votes
0
answers
153
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 /data/data/com.termux/files/home/bin/node_exporter --collector.wifi --collector.tcpstat --collector.runit...
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
/data/data/com.termux/files/home/bin/node_exporter --collector.wifi --collector.tcpstat --collector.runit --collector.processes --collector.mountstats
I would like it to run on phone reboot
Ciasto piekarz
(101 rep)
Aug 28, 2020, 10:23 PM
2
votes
1
answers
2751
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 init.rc file has been modified to include the following code on property:sys.boot_completed=1 start in...
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 init.rc file has been modified to include the following code
on property:sys.boot_completed=1
start initAsic
service initAsic /data/local/tmp/runn.sh
user root
group root
oneshot
The boot image has then been rebuilt and flashed to the device. The changes can be confirmed by viewing the init.rc file located at
/
Currently I am only using a simple test script (testScript.sh) which issues the following command
echo hi >> /data/local/tmp/test.txt
The testScript.sh and text.txt file has 777
permissions set and both have been pushed to the device using adb push
.
Their current location is /data/local/tmp/
For some reason it seems that my script is not running, as I can't see any text being written to test.txt.
Am I missing something?
Could it be an issue with SELinux?
My device currently has SElinux set to permissive. This was done via altering the BoardConfig.mk file and doing a rebuild of the boot.img.
Ringo001
(41 rep)
May 15, 2020, 04:25 AM
• Last activity: May 22, 2020, 05:57 AM
0
votes
0
answers
99
views
Init ignores .rc in the /system/etc/init
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://android.googlesource.com/platform/system/core/+/master/init/README.md > / init.rc is the most important. RC file. It i...
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://android.googlesource.com/platform/system/core/+/master/init/README.md
> / init.rc is the most important. RC file. It is loaded by init process
> at the time of initialization. It is mainly responsible for system
> initialization. It will import / init.${ro.hardware}.rc, which is the
> main. RC file provided by system-level core vendors.
>
> When the mount_all statement is executed, ***the init process loads all
> files in the /{system,vendor,odm}/etc/init/ directory***, which will
> serve Actions and Services when the file system is mounted.
Is there something I'm missing?
service list
does not list my app and iptables not appended. Even if I test-edit init.rc
and import my .rc directly it still does nothing.
Kirikan
(79 rep)
May 18, 2020, 09:02 PM
1
votes
3
answers
2387
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.boot_completed)" ] do sleep 300 done while true do ( new_dir="/storage/emulated/0/temp/AppData/$(date '+%Y%m%d-%...
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.boot_completed)" ]
do
sleep 300
done
while true
do
(
new_dir="/storage/emulated/0/temp/AppData/$(date '+%Y%m%d-%H%M')"
mkdir -p $new_dir
cp /data/data/com.example.app/files/*.json $new_dir
echo "$(date '+%F %T') | app data backup OK!" >> /storage/emulated/0/su.d.log
) &
sleep 14400 # 4 hours
done
) &
In practice, the script backs up the data only after boot—not every 4 hours.
However, if I enter a remote shell via adb
and leave it alone, then the data does get backed up every 4 hours.
How can I force the periodic backup without being permanently connected to a PC? (And why isn't it working as expected?)
---
### EDITS ###
1. @Irfan Latif's comment gave me the idea of trying a different interpreter (busybox ash - #!/system/xbin/sh
), but the result was the same. I'll try @mirabilos's daemonise suggestion (sh -T- -c '...'
) next.
2. Tried @mirabilos's daemonise suggestion with the same result: backs up data only after boot.
3. Tried nohup
:
nohup /system/bin/sh -T- -c '...' >/dev/null 2>&1 &
Same result.
andronoid
(41 rep)
Feb 17, 2019, 03:01 PM
• Last activity: May 5, 2020, 11:33 AM
1
votes
1
answers
93
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][1]. The problem is when I change something via recovery like create a new /system/etc/init/custom.rc file then on One device it persist on /sy...
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 recovery like create a new /system/etc/init/custom.rc file then on One device it persist on /system after reboot but on another it doesn't. The changes does persist when I reboot to recovery back.
I want to understand which layer of Android applied this feature:
- Kernel
- Stock recovery
- System
- or another
Any suggestion? and how to fix it?
Vatish Sharma
(1101 rep)
Apr 1, 2020, 10:45 AM
• Last activity: Apr 1, 2020, 02:06 PM
4
votes
1
answers
2608
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.
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.
Seolh
(41 rep)
Oct 11, 2019, 01:10 PM
• Last activity: Oct 11, 2019, 03:32 PM
1
votes
1
answers
1061
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) at bootup. It seemed like a simple idea which I've done before on KitKat without problems. I modif...
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) at bootup.
It seemed like a simple idea which I've done before on KitKat without problems. I modified init.rc
and added a service to start my script.
But what happens is on bootup, I see:
04-17 13:16:14.823 1210 1210 I init : type=1400 audit(0.0:6): avc: denied { execute_no_trans } for path="/system/bin/mystart" dev="loop1" ino=280 scontext=u:r:init:s0 tcontext=u:object_r:system_file:s0 tclass=file permissive=1
That error is a SELinux permission error so I then proceeded to try these solutions:
1. Disabling SElinux
write /sys/fs/selinux/enforce 0
And checked that this causes the system to be in permissive mode but at bootup, the same error still occurs.
2. Adding a custom SELinux policy, I added:
build/target/board/generic/sepolicy/mystart.te
type mystart, domain;
type mystart_exec, exec_type, file_type;
init_daemon_domain(mystart)
But this still doesn't allow the service to proceed.
3. Tried to run it as a post action:
on property:dev.bootcomplete=1
exec u:r:shell:s0 shell shell input log adb sdcard_rw sdcard_r net_bt_admin net_bt inet net_bw_stats -- /system/bin/sh /system/bin/mystart
This still hits the same avc issue.
**Edit:** This issue is for a boot script (not an ELF executable as in the other case) and furthermore, as I mentioned above, turning off SELinux enforce does not permit the script to be run.
Jaya Kumar
(11 rep)
Apr 18, 2019, 10:22 AM
• Last activity: Sep 8, 2019, 06:24 AM
Showing page 1 of 20 total questions