[Reason]Why SuperSU, Magisk, init.d won't work in Mediatek Variant of Moto E4 - Moto E4 Guides, News, & Discussion

After too many research i found that the kernel (boot image) we have in our device (Moto E4 Mediatek) is a faulty boot image.
It can't mount /system, /cache, / rootfs, /oem and all other partitions in Read-write (RW) state during boot,
they always stay in Read-only (RO) state. only /data (data partition) can be mounted as RW (Read-writeable).
Due to this supersu, magisk and init.d won't work in our device.
phh's superuser only patch boot image and without its superuser app you can't get "su" permissions.
but it is the only method to get root on this device :fingers-crossed:
if you put these simple commands in init.rc they won't execute on boot
Command :
PHP:
mkdir /system/etc/init.d
PHP:
service sysinit /system/bin/sysinit
oneshot
PHP:
on property: sys.boot_completed=1
service sysinit /system/bin/sysinit
oneshot
PHP:
start sysinit
service sysinit /system/bin/sysinit
class late_start
user root
group root
oneshot
disabled
i didn't face such type of problem in my previous Marshmallow running device.
Moto E4 Mediatek​

Related

[Q&A] Init.d: Specific requirements, best uses?

I've determined the full list of requirements for init.d support in Android. I'll list them here:
Remember: Your phone is your responsibility. I am providing you information via cited documentation, but not support. Be careful and take the time to understand what you are doing before you do it.
Mount /system as RW:
This is a temporary change, needed to make changes to any other properties related to init.d. First, check your mounts by running mount from a terminal. You'll need to look for the /system mount for all the parameters needed to remount it. I recommend using grep to parse the output.
Code:
mount | grep "/system"
As an example, I wrote the command below for a Samsung Galaxy Nexus running 4.0.4 (ICS), or 4.1.1 (JB), but it may work on other devices.
Code:
mount -o remount,rw /dev/block/platform/omap/omap_hsmmc.0/by-name/system /system
Permissions
Check permissions using ls -l
If you need to change permissions or owners, read up on chmod and chown
/etc/init.d/ should look like this:
Code:
drwxr-xr-x root shell 2012-04-06 13:41 init.d
If your /etc/init.d doesn't look like the above, then run the following commands:
Code:
chown root.shell /etc/init.d
chmod 755 /etc/init.d
Scripts should look like this:
Code:
-rwxr-xr-x root shell 757 2012-04-06 13:41 99hostname
If your script permissions don't match the above (-rwxr-xr-x), then run the following command:
Code:
chown root.shell /etc/init.d/*
chmod 755 /etc/init.d/*
BusyBox
BusyBox provides several stripped-down Unix tools in a single executable.[1] Many ROMs include BusyBox, and it can be installed on a rooted stock ROM too. Stericson's BusyBox Installer can verify that you have it, and install it if you don't (requires root).
The applet we need is run-parts, which parses a folder for scripts, and executes each one in alpha-numeric order.
Path to BusyBox binary:
Code:
/sbin/bb/busybox
Path to all BusyBox symbolic links:
Code:
/system/xbin/
/init.rc:
Code:
service run_parts /sbin/bb/busybox run-parts /system/etc/init.d
class main
oneshot
CleanUp
Don't forget to remount your /system as RO once you've finished modifying files there. This can protect you from accidental (unintentional, unexpected) changes. The command below assumes, once again, that you are using a Samsung Galaxy Nexus running 4.0 (ICS) or 4.1 (JB):
Code:
mount -o remount,ro /dev/block/platform/omap/omap_hsmmc.0/by-name/system /system
Uses for init.d:
Using init.d, you can:
Enable SWAP / ZRAM (if your Kernel supports it)
Change network properties (hostname, netcfg, ifconfig)
Mount filesystems automatically
???
Pandages said:
I've determined the full list of requirements for init.d support in Android. I'll list them here:
Click to expand...
Click to collapse
thanks man, very informative. should be quite useful for the ones looking for this. should either be sticked or linked to in this thread's first post. this is the kind of howto we need, not some copy/paste from official information.
regards,
bk201
bk201doesntexist said:
thanks man, very informative. should be quite useful for the ones looking for this. should either be sticked or linked to in this thread's first post. this is the kind of howto we need, not some copy/paste from official information.
Click to expand...
Click to collapse
I'm happy to help. I'm an engineer by trade, so I'm used to sharing any information I find when researching a specific problem. I hope this post is of assistance to someone. Please link to it if it helps you!
So I do all that on a stock rom and init.d should work?
Edit: Nevermind, just found EZ InitD answering my stock rom questions.
Thanks for the info regardless!
[JB] JellyBean Update
Regarding Android 4.1 (JellyBean):
All the rules I've documented above still apply:
/etc/init.d needs to exist
/etc/init.d needs to be owned by root.shell (chown root.shell /etc/init.d)
/etc/init.d needs to have the correct permissions (chmod 755 /etc/init.d)
scripts need to be in .sh format, but with the extension removed (i.e. 99hostname)
scripts need to have the correct permissions (chmod 755 /etc/init.d/*)
busybox needs to be installed
init.rc needs to register the run-parts service (/sbin/bb/busybox run-parts /system/etc/init.d)
If you follow these rules. init.d will work as intended! :victory:
Update on MMuzzy's AOSP 4.2.1:
Stock kernel does not support init.d. I recommend imoseyon's leankernel, which does support it. init.rc also does not include the run-parts service. Busybox is not included. However, once all these issues are handled, as described in the OP, init.d works as intended.
franco.Kernel also includes init.d in its ramdisk making it work for stock ROM (and others) where no init.d support is included.
init.d can have owner/group of root.root with no issues, and the easy way to set the permissions is chmod -R 755 /system/etc/init.d

[Q] linux deploy fails when mounting any of the linux OS's

At first I thought it was maybe because I didnt'nt have enough free space on my sd card so I made sure I had 3GB's free but I still got this when I clicked install:
[13:04:26] Updating configuration file ... done
[13:04:27] >>> begin: install
[13:04:27] Checking mount points ... done
[13:04:27] Checking installation path ... done
[13:04:27] Making new disk image (512 MB) ... fail
[13:04:27] <<< end: install
And this when I try to reconfigure:
[13:02:49] Updating configuration file ... done
[13:02:50] >>> begin: configure
[13:02:50] Mounting partitions:
[13:02:50] / ... fail
[13:02:50] <<< end: configure
When I check my root stutus I get this message:
Congratulations! You have root access!
Super User Application Status:
SuperSU application by Chainfire - version 2.36 - is installed!
System File Properties for Root Access:
Standard Location
Check Command: ls -l /system/bin/su:
Result: /system/bin/su: No such file or directory
Analysis: File /system/bin/su does not exist.
Standard Location
Check Command: ls -l /system/xbin/su:
Result: -rwxr-xr-x root root 71264 2014-11-30 16:22 su
Analysis: Root access IS correctly configured for this file! Executing this file can grant root access! Root user ownership is present and setuid attribute is not present.
Alternative Location
Check Command: ls -l /sbin/su:
Result: /sbin/su: Permission denied
Analysis: File system permissions restricted and denied access.
Alternative Location
Check Command: ls -l /system/xbin/sudo:
Result: /system/xbin/sudo: No such file or directory
Analysis: File /system/xbin/sudo does not exist.
Root User ID and Group ID Status:
Root user id:
uid=0(root)
Root group id:
gid=0(root)
System Environment PATH: /sbin /vendor/bin /system/sbin /system/bin /system/xbin
ADB Shell Default User:
ADB shell setting for standard access, stored in default.prop, is configured as: shell (non root) user - ro.secure=1
Results provided on your SM-T800 - Android 4.4.2 device by Root Checker Pro version 1.3.9 from joeykrim in the Android Market
Can anybody tell me why I get this fail message after clicking install?i
Please help
Thank You
AO!
Same issue
Im currently having the same issue with trying to install kali on my tab s. Have root and even sd formated to ext4 but still issues .
Check your SE(Linux) status on Settings / About Device. If it says Enforcing then this is the cause of the problem.
You need to change it to permissive, but you can't do it on a stock rom. You need a kernel with permissive mode
enable or a custom rom with a permissive kernel.
Good Luck
eupeso4 is wrong. You don't need a different kernel. There is an app called SELinuxModeChanger... It works charms
I've attached the app below.
soulcrusher101 said:
eupeso4 is wrong. You don't need a different kernel. There is an app called SELinuxModeChanger... It works charms
I've attached the app below.
Click to expand...
Click to collapse
Also, go to terminal emulator after this.
Code:
su
getenforce
If you get "Enforcing" as a response, it's FUBAR. you can try to run the command "setenforce 0" as su as a workaround but if the app didn't work, it won't likely work either.
Molikai1988 said:
Also, go to terminal emulator after this.
Code:
su
getenforce
If you get "Enforcing" as a response, it's FUBAR. you can try to run the command "setenforce 0" as su as a workaround but if the app didn't work, it won't likely work either.
Click to expand...
Click to collapse
Okay i got enforcing. my deviceis SC-04E thats is S4 (docomo). i want to set SE Linux to premissive tell me the solution
soulcrusher101 said:
eupeso4 is wrong. You don't need a different kernel. There is an app called SELinuxModeChanger... It works charms
I've attached the app below.
Click to expand...
Click to collapse
Doesn't work on stock kernels.
I tried everything. But it doesn't work even after changing the SELinux to permissive., But after searching a lot, I found a thread which said me to change the partition to ext2. I changed the partition and then it all worked like charm.., If you still have issues, follow the guide in this link from start to end-https://github.com/meefik/linuxdeploy/issues/183, This solved most of the issues I had..
Linux Deploy Mounting Partitions Fail
Bro problem solved by me..
Check out this video
https://youtu.be/n5opus76c3k

ADAway and Desire 820n a51_ul Lollipop 5.0.2

Anyone try to install adaway on stock rooted Lollipop ? I think Lollipop ignoring entires in hosts. I've moved hosts file to /data and linked /system/etc/hosts to /data/hosts cuz S-ON and does not block. Why? Entires are corrcet in hosts.
Its about the write protection from the stock kernel. We need a custom kernel, than we can write to the system. With Tomals rom adaway works great. Tomal modified the kernel, so adaway works. And you need to flash busybox from the development section.
Think You write protection in kernel causes ignoring entires in hosts? Every Linux use hosts file. Lollipop does not?
Temporary solution for advanced users only.
CAUTION: I am not responsible if You delete and/or brick Your device!!!
1. Let AdAway create hosts file on /data/ (Preferences->Target hosts file->/data/hosts)
2. Enter recovery, mount /system and /data
3. Plug in your usb cord and open a command line on your pc.
4. Enter adb shell from HTC Sync
5. Type rm /system/etc/hosts
6. Type cp /data/hosts /system/etc/hosts
7. Exit from adb shell, unmount /data and /system
Reboot
To update AdAway hosts file You need to repeat all steps eg. one per week.
Lollipop ignoring symlink to hosts file, I don't know why atm.
Tested on my own 820n.

Malaysk 5.1.1 MTCB doesn't execute init.d scripts

Does anyone know how to run init.d scripts at boot?
I've tried adding the following rows to init.rc with no success...
Code:
service sysinit /system/bin/logwrapper /system/bin/busybox run-parts /system/etc/init.d
class main
user root
group shell
oneshot
All scripts have execute and read permission.
Thanks!

[guide] Howto mount cifs filesystem

Mounting cifs filesystem is a mandatory feature for my needs. I searched some howto about mounting cifs filesystem on a lineage 14.1 OS and didn't find any solution. I've digged the issue and found out a solution without switching selinux to permissive mode. My device is a tablet samsung tab S.
You need to install some additional pieces of software :
. The su command to get root. Following commands require root.
https://download.lineageos.org/extras
. The busybox suite
https://forum.xda-developers.com/android/software-hacking/tool-busybox-flashable-archs-t3348543
You need this software because the mount command of the lineage toolbox (toybox) doesn't support network filesystems.
. The setools-android with sepolicy-inject
https://forum.xda-developers.com/android/software/setools-android-sepolicy-inject-t2977563
Extract the zip file in /data/setools.
When cifs trys to reconnect on a share, it fails with this avc denied :
Code:
<36>[ 1055.524752] [L1: logd.auditd: 2431] type=1400 audit(1511819085.871:227): avc: denied { net_raw } for pid=6208 comm="cifsd" capability=13 scontext=u:r:kernel:s0 tcontext=u:r:kernel:s0 tclass=capability permissive=0
So, you must inject the missing policy which prevent cifsd to well functionning. To inject the allow rule, type :
Code:
/data/setools/sepolicy-inject -s kernel -t kernel -c capability -p net_raw -l
. Finally, mount your remote filesystem with the busybox mount command, and you are done !
Code:
DIR=myshare
[ -d /mnt/cifs/$DIR ] || mkdir -p /mnt/cifs/$DIR
/system/xbin/mount -t cifs -o ro,username=xxxx,password=yyyyy,iocharset=utf8,noperm,file_mode=0777,dir_mode=0777,context=u:object_r:sdcardfs:s0 //10.0.1.1/$DIR /mnt/cifs/$DIR
Thank you hmelg, I am having Lienage os 15.1 installed with su addon on samsung galaxy grand prime.If I install the busybox as per your thread above, does it conflict/impact existing lineage tool box in any way ?
must re build kernel ,add nfs
To further ressurrect a dead thread...
I can get my folders to mount where I want them, but only other root enabled apps can see those files. Regular userspace apps see an empty folder at the mount point. Is there a modern solution to this problem? Everything I've found on the internet so far leads me back to that exact same situation.

Categories

Resources