Magisk-Modules-Repo / energizedprotection

Energized Protection Magisk Module.
https://energized.pro
MIT License
321 stars 54 forks source link

/sdcard does not exist #24

Open programminghoch10 opened 4 years ago

programminghoch10 commented 4 years ago

Yesterday I stumbled upon a problem with a tablet, which did not have the folder sdcard in the root directory.

When executing any of the EnergizedProtection commands like ep -p blu or ep -m the first 3 lines consist of mkdir failed for /sdcard/, Read-only file system.

root@tablet:/ # ep -p blu
mkdir failed for /sdcard/, Read-only file system
mkdir failed for /sdcard/, Read-only file system
mkdir failed for /sdcard/, Read-only file system

[|] Pack: Downloadingwget: can't open '/sdcard/EnergizedProtection/hosts.gz': No such file or directory
[/] Pack: Downloadinggzip: can't gzopen /sdcard/EnergizedProtection/hosts.gz
[✓] Pack: Blu Protection
[*] No extension applied.
ls: Unknown option '-h'. Aborting.
[+] Size:
[\] Filter: Updatingwget: can't open '/sdcard/EnergizedProtection/cache/version.md': No such file or directory
cp: /sdcard/EnergizedProtection/cache/version.md: No such file or directory
/system/bin/ep[2133]: can't create /sdcard/EnergizedProtection/cache/filter: No such file or directory
[✓] Filter: Updated

-------------------------------------------------
[+] If you loved our work, consider donating.
  > PayPal: paypal.me/shadmansaleh
  > Support: energized.pro/support
-------------------------------------------------

The Download and apply obviously fail as well.

Side Note: The script still ticks it as updated. Does it always tick it? Does the script even check if the apply worked?

Device Info: Chipset: Rockchip RK3128 Android: 5.1.1 uname -a: Linux localhost 3.10.0 #309 SMP PREEMPT Tue Oct 18 16:49:27 CST 2016 armv7l Android Magisk: 20.3 Energized Version: 1.3.2 Busybox: v1.31.1-osm0sis

Side Note: I know 20.4 is the newest Magisk version, but due to Rockchips own "KRNL" boot image format, which Magisk does not support, I had to patch the boot image myself. I wont update Magisk if not needed as this is a hell of time waste to do so. I do think though that the Magisk version does not matter in this case.

Here are some commands I've tried in order to understand why the script doesn't work.

ls -la /

root@tablet:/ # ls -la /
drwxr-xr-x root     root              2020-07-27 15:12 acct
lrwxrwxrwx root     root              2020-07-27 15:12 bcm4329_cybertan.hcd -> /etc/bluez/bcm432x/BCM4329B1_002.002.023.0389.0000_Cybertan-Foxconn_Cls2_extLNA_EDRmaxInputLev+PeakDEVM_NT.hcd
lrwxrwxrwx root     root              2020-07-27 15:12 bcm4329_samsung.hcd -> /etc/bluez/bcm432x/BCM4329B1_TestOnly_0237_26MHz_SEMCO_B23.hcd
lrwxrwxrwx root     root              2020-07-27 15:12 bcm4329_usi.hcd -> /etc/bluez/bcm432x/BCM4329B1_USI_WM-BN-BM-01.hcd
drwxrwx--- system   cache             2020-07-27 15:12 cache
lrwxrwxrwx root     root              1970-01-01 01:00 charger -> /sbin/healthd
dr-x------ root     root              2020-07-27 15:12 config
lrwxrwxrwx root     root              2020-07-27 15:12 d -> /sys/kernel/debug
drwxrwx--x system   system            2020-02-21 23:18 data
-rw-r--r-- root     root          312 1970-01-01 01:00 default.prop
drwxr-xr-x root     root              2020-07-27 15:12 dev
-rw-r--r-- root     root        11924 1970-01-01 01:00 drmboot.ko
lrwxrwxrwx root     root              2020-07-27 15:12 etc -> /system/etc
-rw-r--r-- root     root        16959 1970-01-01 01:00 file_contexts
lrwxrwxrwx root     root              2020-07-27 15:12 fstab.rk30board -> /fstab.rk30board.bootmode.emmc
-rw-r----- root     root         1965 1970-01-01 01:00 fstab.rk30board.bootmode.emmc
-rw-r----- root     root         2143 1970-01-01 01:00 fstab.rk30board.bootmode.unknown
-rwxr-x--- root     root       305584 1970-01-01 01:00 init
-rwxr-x--- root     root         6449 1970-01-01 01:00 init.connectivity.rc
-rwxr-x--- root     root          980 1970-01-01 01:00 init.environ.rc
-rwxr-x--- root     root        22242 2020-07-27 15:12 init.rc
-rwxr-x--- root     root          803 1970-01-01 01:00 init.rk30board.bootmode.emmc.rc
-rwxr-x--- root     root          895 1970-01-01 01:00 init.rk30board.bootmode.unknown.rc
-rwxr-x--- root     root          220 1970-01-01 01:00 init.rk30board.environment.rc
-rwxr-x--- root     root         5962 1970-01-01 01:00 init.rk30board.rc
-rwxr-x--- root     root         6333 1970-01-01 01:00 init.rk30board.usb.rc
-rwxr-x--- root     root         7596 1970-01-01 01:00 init.rockchip.rc
-rwxr-x--- root     root         1927 1970-01-01 01:00 init.trace.rc
-rwxr-x--- root     root         3885 1970-01-01 01:00 init.usb.rc
-rwxr-x--- root     root          301 1970-01-01 01:00 init.zygote32.rc
drwxr-xr-x root     root              1970-01-01 01:00 metadata
drwxrwxr-x root     system            2020-07-27 15:12 mnt
dr-xr-xr-x root     root              1970-01-01 01:00 proc
-rw-r--r-- root     root         2771 1970-01-01 01:00 property_contexts
drwxr-xr-x root     root              1970-01-01 01:00 res
-rw-r--r-- root     root       145508 1970-01-01 01:00 rk30xxnand_ko.ko.3.10.0
drwxr-x--- root     root              2020-07-27 15:12 root
drwxr-xr-x root     root              2020-07-27 15:12 sbin
-rw-r--r-- root     root          550 1970-01-01 01:00 seapp_contexts
-rw-r--r-- root     root           79 1970-01-01 01:00 selinux_version
-rw-r--r-- root     root       650639 2020-07-27 15:12 sepolicy
-rw-r--r-- root     root         9718 1970-01-01 01:00 service_contexts
drwxr-x--x root     sdcard_r          2020-07-27 15:12 storage
dr-xr-xr-x root     root              2020-07-27 15:12 sys
drwxr-xr-x root     root              1970-01-01 01:00 system
-rw-r--r-- root     root         4464 1970-01-01 01:00 ueventd.rc
-rw-r--r-- root     root         4430 1970-01-01 01:00 ueventd.rk30board.rc
lrwxrwxrwx root     root              2020-07-27 15:12 vendor -> /system/vendor

Notice how there is no /sdcard present in this list. The script complains about it being a "read-only" file system, as it also wants to create /sdcard, but the rootfs is read-only.

mount -o rw,remount rootfs /

Now this is where it gets interesting. Just for fun I tried remounting the entire root filesystem as read-write. This changes the script output:

root@tablet:/ # mount -o rw,remount rootfs /
root@tablet:/ # ep -p blu

[✓] Pack: Blu Protection
[*] No extension applied.
ls: Unknown option '-h'. Aborting.
[+] Size:
[✓] Filter: Updated

-------------------------------------------------
[+] If you loved our work, consider donating.
  > PayPal: paypal.me/shadmansaleh
  > Support: energized.pro/support
-------------------------------------------------

It seems like the script is now able to create the folder.

directory variable

Now for an actual purposeful attempt to make the script work. A similar result shows up when I set the path in the directory variable to /data/media/0/EnergizedProtection, as this path definitively exists. The /sdcard error disappears, but there seem to be some more problems:

root@tablet:/ # ep -p blu

[✓] Pack: Blu Protection
[*] No extension applied.
ls: Unknown option '-h'. Aborting.
[+] Size:
[✓] Filter: Updated

-------------------------------------------------
[+] If you loved our work, consider donating.
  > PayPal: paypal.me/shadmansaleh
  > Support: energized.pro/support
-------------------------------------------------
root@tablet:/ # ep -i
-------------------------------------------------
ϟ C O M P A T I B I L I T Y  I N F O -
-------------------------------------------------
[✓] Shell: sh supported.
[✓] Magisk: 20.3 supported.
[✓] Root: Permission granted.
[✓] Busybox: v1.31.1-osm0sis supported.
[✓] Adblocker App: No confliction.
[✓] Directory: Setup properly.
[✓] Update: Already latest.

-------------------------------------------------
ϟ P A C K  I N F O -
-------------------------------------------------
[+] Pack: Blu Protection
[+] Domains: -
ls: Unknown option '-h'. Aborting.
[+] Size:
[+] Current IP:
date: invalid option -- r
date: invalid option -r
[+] Updated:

-------------------------------------------------
[+] If you loved our work, consider donating.
  > PayPal: paypal.me/shadmansaleh
  > Support: energized.pro/support
-------------------------------------------------

These errors are about ls and date. What can be done about those?

AvinashReddy3108 commented 4 years ago

We have moved to using Magisk's Internal Busybox (introduced in 20.4). Try AdAway app if you can't upgrade your Magisk installation.

programminghoch10 commented 4 years ago

But it is still an issue, as it states that it needs busybox installed on Magisk 20 - 20.3. I have done that and it does not work. So either the Requirements need to be adjusted, or the code needs to be looked at to prevent this issue from happening. Also why would the busybox make a difference when there is a folder and/or symlink missing?