Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Can't use root mode in versions 3.x.x #948

Open
3 tasks done
Zafrkant opened this issue Dec 5, 2022 · 103 comments
Open
3 tasks done

Can't use root mode in versions 3.x.x #948

Zafrkant opened this issue Dec 5, 2022 · 103 comments
Labels
Bug Something isn't working Priority: 1 Status: Accepted Accepted or approved feature/issue
Milestone

Comments

@Zafrkant
Copy link

Zafrkant commented Dec 5, 2022

Please check before submitting an issue

  • I know what my device, OS and App Manager versions are
  • I know how to take logs
  • I know how to reproduce the issue which may not be specific to my device

Describe the bug

I'm using Xiaomi Mi 11i, Xiaomi EU 13.0.13.0, App Manager Debug 2130.
I've tried multiple 3.x.x versions but results are the same, I can't use root mode. On v2.6.5.1 everything is working fine.
Full system log will be provided.

To Reproduce

    1. Install debug version
    1. Select root mode.
    1. Settings | Mode of operation | Root

Expected behavior

No root access will be provided.

Screenshots

No response

Logs

Log is provided via Mega due to it's large size, GitHub: There was an error creating your Issue: body is too long, body is too long (maximum is 65536 characters).
https://mega.nz/file/e5clkSSB#hvEJ_JSzxOQnmcPzXHC5uKnEfK8VOe4n3bifOGxyZL4

Device info

  • Device: Xiaomi Mi 11i
  • OS Version: Xiaomi EU 13.0.13.0
  • App Manager Version: AM Debug v3.1.0-alpha02 Run#2130
  • Mode: Root/ADB/NonRoot: Root

Additional context

No response

@Zafrkant Zafrkant added the Bug Something isn't working label Dec 5, 2022
@MuntashirAkon
Copy link
Owner

617:696 E/vold: Failed to set project id on /data/media/0/Android/data/io.github.muntashirakon.AppManager.debug/: Operation not supported on transport endpoint
30553:30553 W/ContextImpl: Failed to ensure /storage/emulated/0/Android/data/io.github.muntashirakon.AppManager.debug/cache: android.os.ServiceSpecificException:  (code -1)
30745:30745 D/AndroidRuntime: >>>>>> START com.android.internal.os.RuntimeInit uid 0 <<<<<<
30553:30689 E/RootService: main.jar: open failed: EROFS (Read-only file system)
java.io.FileNotFoundException: main.jar: open failed: EROFS (Read-only file system)
	at libcore.io.IoBridge.open(IoBridge.java:575)
	at java.io.FileOutputStream.<init>(FileOutputStream.java:236)
	at java.io.FileOutputStream.<init>(FileOutputStream.java:186)
	at io.github.muntashirakon.AppManager.ipc.RootServiceManager.lambda$startRootProcess$1(RootServiceManager.java:193)
	at io.github.muntashirakon.AppManager.ipc.RootServiceManager$$ExternalSyntheticLambda3.run(Unknown Source:9)
	at io.github.muntashirakon.AppManager.ipc.RootService.lambda$asRunnable$0(RootService.java:201)
	at io.github.muntashirakon.AppManager.ipc.RootService$$ExternalSyntheticLambda0.run(Unknown Source:2)
	at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1167)
	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:641)
	at java.lang.Thread.run(Thread.java:920)
Caused by: android.system.ErrnoException: open failed: EROFS (Read-only file system)
	at libcore.io.Linux.open(Native Method)
	at libcore.io.ForwardingOs.open(ForwardingOs.java:567)
	at libcore.io.BlockGuardOs.open(BlockGuardOs.java:273)
	at libcore.io.ForwardingOs.open(ForwardingOs.java:567)
	at android.app.ActivityThread$AndroidOs.open(Unknown Source:15)
	at libcore.io.IoBridge.open(IoBridge.java:561)
	... 9 more

It is failing because the internal storage in your device is set to read-only for App Manager which shouldn't happen. Check if any of the other software is messing with App Manager, examples include Xposed or similar frameworks and Storage Redirect. Also check if the path /storage/emulated/0/Android/data/io.github.muntashirakon.AppManager.debug/ exists.

@MuntashirAkon MuntashirAkon added Status: Pending The issue is not yet accepted Status: Info Requested Further information is requested labels Dec 5, 2022
@Zafrkant
Copy link
Author

Zafrkant commented Dec 5, 2022

Muntashir thanks for answering.

After installation '/storage/emulated/0/Android/data/io.github.muntashirakon.AppManager.debug' is present on storage, containing empty FIles subdirectory.
I'm not using Xposed, only App Ops with Sui Zygisk. I've tried to disable all Magisk modules (including Sui, BusyBox, CloudFlare, Twemoji), reboot and try to select root mode but unfortunately state is the same.
Do you have idea how can I check what is making storage read-only?

Thanks in advance.

@MuntashirAkon
Copy link
Owner

Do you have idea how can I check what is making storage read-only?

Not sure. You could do onething: Run AM Debug in no-root mode, grant file permissions. Then open the app details page of AM Debug, navigate to Activities tab, find FmActivity and open it to see if it can display anything.

@Zafrkant
Copy link
Author

Zafrkant commented Dec 5, 2022

Thank you for answer.
I've did as you suggested and on click it is opening file manager on /storage/emulated/0 path.
signal-2022-12-05-135343

@unRekable
Copy link

unRekable commented Dec 13, 2022

I have the same issue. I'm also using a Xiaomi device (Mi 11 Ultra).
The error I have is the same: open failed erofs (read-only file system)

As path, I'm having the same as @Zafrkant when opening FmActivity.
Btw. I disabled lsposed which didn't help. Besides that I only have Magisk installed and nothing that should block AM.

@unRekable
Copy link

By the way, in case it matters, when opening FmActivity, I don't have permissions to view /android/data - probably that's causing the problem?

@unRekable
Copy link

I've updated to Android 13 and MIUI 14 today - still the same issue. Any update on this @MuntashirAkon ?

@Zafrkant
Copy link
Author

I've upgraded Xiaomi EU to v14.0.3.0, App Manager to v3.0.4 and it is working fine now.

@unRekable
Copy link

Hope it keeps working for you. Still doesn't work for me on MIUI 14 and Android 13. I will install the latest weekly and see.
On Miui 13 and Android 12 one time it showed me root mode and asked me to select a storage for backups or something, don't entirely remember. Though, I think I disallowed root in first, restarted and allowed it then. Whatever, it just showed me the root mode for a short time, when swichting modes it didn't work anymore.

@MuntashirAkon
Copy link
Owner

Any update on this @MuntashirAkon ?

Sorry, no updates. If you're willing to help, I will publish some debug builds to figure out the issue first.

@unRekable
Copy link

Any update on this @MuntashirAkon ?

Sorry, no updates. If you're willing to help, I will publish some debug builds to figure out the issue first.

Sure, would appreciate to help figuring this out.

@unRekable
Copy link

Here's the log file/export - in case it helps you. Installed the latest build today.

https://file.io/0wcoXlniJ95j

@unRekable
Copy link

Can you build a debug build @MuntashirAkon ? Been waiting long 😄

@Bladius2024
Copy link

Screenshot_20230224-064416_Solid Explorer

@MuntashirAkon
Copy link
Owner

Try 35d8c3b

@MuntashirAkon MuntashirAkon added Status: Accepted Accepted or approved feature/issue and removed Status: Pending The issue is not yet accepted labels Feb 27, 2023
@Bladius2024
Copy link

I don't understand what to check. There is nothing to download from the link provided

@unRekable
Copy link

I don't understand what to check. There is nothing to download from the link provided

Same. I never compiled into an apk file. If you can make a beta/test build, would be awesome @MuntashirAkon. Thanks!

@MuntashirAkon
Copy link
Owner

@unRekable
Copy link

Downloaded the Debug Build from your telegram.

It crashes on start and cannot run. Here's the error log I could get:
https://pastebin.com/FqJYKXqY

Thanks!

@MuntashirAkon
Copy link
Owner

Try#2: 77b1f5d

@unRekable
Copy link

unRekable commented Feb 28, 2023

Same. Re-installed. It tells me the key, then ask for root and after I give permission it crashes / closes the app.

https://pastebin.com/hxYZhyxe

@MuntashirAkon
Copy link
Owner

Same. Re-installed. It tells me the key, then ask for root and after I give permission it crashes / closes the app.

This is very weird. The shared storage clearly exists as per your previous comments, but App Manager is unable to use them somehow.

In a Terminal, run the following with root:

mount | grep Android/data

@unRekable
Copy link

Uploading Screenshot_2023-02-28-18-59-17-564_com.termux.jpg…

@MuntashirAkon
Copy link
Owner

@unRekable: Screenshot was not uploaded properly.

@MuntashirAkon
Copy link
Owner

I just wonder what destroyed our /data partition, it's also weird we just have this with AM.

As I said earlier, there's a workaround, but I am more interested in finding out and fixing the actual reason (if possible) than applying it. This is not quite uncommon. Broken encryption being one of the possibilities was suggested by @Androidacy, it was not my own discovery. However, it's still curious as it's affecting AM immediately after granting root. There's definitely something going on here, which may even be related to SELinux.

@unRekable: Can you also share some logs taken during the crash?

@droserasprout
Copy link

droserasprout commented Jan 30, 2024

Hi! I have the same problem after updating to Android 14 (crDroid). Upgrade procedure included formatting data from recovery (OFox Recovery 12.1_FBEv2) and flashing "legacy to retrofit dynamic" ZIP which changes the partition table with a script (OTA for A/B devices without dynamic partitions). May be related somehow. Ping me if you need more logs or other info.

java.lang.IllegalStateException: External directory unavailable.
    at io.github.muntashirakon.AppManager.ipc.RootServiceManager.startRootProcess(RootServiceManager.java:161)
    at io.github.muntashirakon.AppManager.ipc.RootServiceManager.createBindTask(RootServiceManager.java:285)
    at io.github.muntashirakon.AppManager.ipc.RootService.bindOrTask(RootService.java:146)
    at io.github.muntashirakon.AppManager.ipc.RootService.bind(RootService.java:110)
    at io.github.muntashirakon.AppManager.ipc.RootService.bind(RootService.java:125)
    at io.github.muntashirakon.AppManager.ipc.ServiceConnectionWrapper.lambda$startDaemon$0$io-github-muntashirakon-AppManager-ipc-ServiceConnectionWrapper(ServiceConnectionWrapper.java:117)
    at io.github.muntashirakon.AppManager.ipc.ServiceConnectionWrapper$$ExternalSyntheticLambda0.run(Unknown Source:4)
    at android.os.Handler.handleCallback(Handler.java:958)
    at android.os.Handler.dispatchMessage(Handler.java:99)
    at android.os.Looper.loopOnce(Looper.java:205)
    at android.os.Looper.loop(Looper.java:294)
    at android.app.ActivityThread.main(ActivityThread.java:8244)
    at java.lang.reflect.Method.invoke(Native Method)
    at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:552)
    at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:878)
 Caused by: java.io.FileNotFoundException: No available shared storage found.
   at io.github.muntashirakon.AppManager.utils.FileUtils.getExternalCachePath(FileUtils.java:210)
   at io.github.muntashirakon.AppManager.ipc.RootServiceManager.startRootProcess(RootServiceManager.java:159)
   at io.github.muntashirakon.AppManager.ipc.RootServiceManager.createBindTask(RootServiceManager.java:285)
   at io.github.muntashirakon.AppManager.ipc.RootService.bindOrTask(RootService.java:146)
   at io.github.muntashirakon.AppManager.ipc.RootService.bind(RootService.java:110)
   at io.github.muntashirakon.AppManager.ipc.RootService.bind(RootService.java:125)
   at io.github.muntashirakon.AppManager.ipc.ServiceConnectionWrapper.lambda$startDaemon$0$io-github-muntashirakon-AppManager-ipc-ServiceConnectionWrapper(ServiceConnectionWrapper.java:117)
   at io.github.muntashirakon.AppManager.ipc.ServiceConnectionWrapper$$ExternalSyntheticLambda0.run(Unknown Source:4)
   at android.os.Handler.handleCallback(Handler.java:958)
   at android.os.Handler.dispatchMessage(Handler.java:99)
   at android.os.Looper.loopOnce(Looper.java:205)
   at android.os.Looper.loop(Looper.java:294)
   at android.app.ActivityThread.main(ActivityThread.java:8244)
   at java.lang.reflect.Method.invoke(Native Method)
   at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:552)
   at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:878)

Device Info:
App version: 3.1.4
App version code: 427
Android build version: 1706253636
Android release version: 14
Android SDK version: 34
Android build ID: UQ1A.240105.004
Device brand: Xiaomi
Device manufacturer: Xiaomi
Device name: raphael
Device model: Mi 9T Pro
Device product name: lineage_raphael
Device hardware name: qcom
ABIs: [arm64-v8a]
ABIs (32bit): []
ABIs (64bit): [arm64-v8a]
System language: en-US
In-App Language: auto
Mode: auto
Inferred Mode: root

@unRekable
Copy link

unRekable commented Feb 1, 2024

I hope this log helps you

https://pastes.io/27ndbt72xu

@MuntashirAkon
Copy link
Owner

I hope this log helps you

https://pastes.io/27ndbt72xu

I meant from logcat, not the crashlog.

@unRekable
Copy link

I hope this log helps you
https://pastes.io/27ndbt72xu

I meant from logcat, not the crashlog.

I hope that helps you out.
https://pastebin.com/trPiwruQ

I used adb logcat | findstr "AppManager"
If you want me to use specific settings, please let me know.

@MuntashirAkon
Copy link
Owner

I used adb logcat | findstr "AppManager"

Logcat cannot filter using package name, you can only filter by UID.

@unRekable
Copy link

I used adb logcat | findstr "AppManager"

Logcat cannot filter using package name, you can only filter by UID.

What's the command I should use then? And how do I get the IUD? Otherwise it's too much log

@quincyf467
Copy link

My device: Xiaomi Mi 9T Pro
device name: raphael
ROM: crDroid 10.2

Here is my logs from LogFox (another LogCat reader)

https://dpaste.com/4FPY3562M

@unRekable
Copy link

unRekable commented Feb 14, 2024

https://pastebin.com/GvmFFRm1 that are my logs from logfox.

@MuntashirAkon
Copy link
Owner

This is where it's failing: https://cs.android.com/android/platform/superproject/main/+/main:frameworks/base/core/java/android/app/ContextImpl.java;l=802;drc=2f1bbc2bb14dba88a0f033fb4ce32bbf20df25ed

Here are my remarks:

  1. It says that /storage/emulated/0/Android/data/io.github.muntashirakon.AppManager.debug/cache folder does not exist
  2. It tries to create this directory, set the necessary permissions but fails with an error code (e.g., -1) that is not present in the standard Unix header file
  3. If the directory does not already exist, it's unable to create the directory in first place

Regardless of 3, this does look like a permission issue, and I hardly think there's anything I can do regarding this in the app as the problem is in the OS-level (probably caused by broken encryption/SELinux/root). So, I think the only alternative is the hack that I previously talked about and/or factory resetting the device.

@MuntashirAkon MuntashirAkon added Priority: 1 and removed Status: Info Requested Further information is requested labels Feb 17, 2024
@unRekable
Copy link

Can't you manually create the folder from cli and set the right permissions or fix the encryption? A factory reset really sucks, meh 😅

@unRekable
Copy link

Btw. I were able to run it with root mode, doing:

mkdir -p /storage/emulated/0/Android/data/io.github.muntashirakon.AppManager/cache
chmod 777 /storage/emulated/0/Android/data/io.github.muntashirakon.AppManager/cache

Let's see if everything works!

@MuntashirAkon
Copy link
Owner

Btw. I were able to run it with root mode, doing:

mkdir -p /storage/emulated/0/Android/data/io.github.muntashirakon.AppManager/cache chmod 777 /storage/emulated/0/Android/data/io.github.muntashirakon.AppManager/cache

Let's see if everything works!

Let me know how it goes. In addition, you could try the following after emptying the directory:

chmod 771 /storage/emulated/0/Android/data/io.github.muntashirakon.AppManager
chown $UID:1015 /storage/emulated/0/Android/data/io.github.muntashirakon.AppManager
restorecon /storage/emulated/0/Android/data/io.github.muntashirakon.AppManager

Replace $UID with the actual UID of App Manager.

@drogga
Copy link
Contributor

drogga commented Feb 22, 2024

I really wonder - why isn't the cache, especially images moved from /storage/emulated/0/Android/data/io.github.muntashirakon.AppManager/ to where IMO they should've been in the first place: /data/user/0/io.github.muntashirakon.AppManager, along with their files content and problem solved (? probably ?), also in the case of the apps icons images cache, even tho it might create multiple instances of the exact same in order to make the listing of apps components and A.M. in general load fasted, I still don't think that every component's icon should be cached separately. I for example have 26 icons just for an app like BSPlayer, 24 the exact same and 2 same generic android ones.

@MuntashirAkon
Copy link
Owner

I really wonder - why isn't the cache, especially images moved from /storage/emulated/0/Android/data/io.github.muntashirakon.AppManager/ to where IMO they should've been in the first place: /data/user/0/io.github.muntashirakon.AppManager, along with their files content and problem solved (? probably ?), also in the case of the apps icons images cache, even tho it might create multiple instances of the exact same in order to make the listing of apps components and A.M. in general load fasted, I still don't think that every component's icon should be cached separately. I for example have 26 icons just for an app like BSPlayer, 24 the exact same and 2 same generic android ones.

The use of external cache directory is mandatory for privileged users.

@MuntashirAkon
Copy link
Owner

I'll try to add a workaround for it since the affected users seem to have a wide range of issues (e.g., encryption issue, kernel issue, bad ROM issue, and so on). This, I believe, has something to do with SELinux context because only this can explain all the problems as the issue occurs only after App Manager is granted root. The workaround, it appears, is simply creating the cache directory.

@MuntashirAkon MuntashirAkon added this to the v4.0.0-alpha03 milestone Apr 9, 2024
@MuntashirAkon
Copy link
Owner

Could anybody facing the issue post a crash log from 82de588? Thanks in advance.

@MuntashirAkon
Copy link
Owner

Any updates?

@KinglyMinecon
Copy link

Any updates?

I also have this issue
Am on lineage os galaxy a71
I have root and when granting access to app manager it crashes upon opening the app or trying to do anything with it

Where would I find logs?

@MuntashirAkon
Copy link
Owner

Where would I find logs?

Crash reports are accessible through the notifications if you have them enabled.

@droserasprout
Copy link

droserasprout commented Jul 15, 2024

Any updates?

Nightlies work perfectly for my legacy-to-retrofit configuration above after your fixes.

@MuntashirAkon
Copy link
Owner

The GitHub Actions artifacts from that commit have expired, but I built from source today (commit 906c498). Build was successful, and the app is no longer crashing after I grant it superuser access.

You can also test with the latest debug builds.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug Something isn't working Priority: 1 Status: Accepted Accepted or approved feature/issue
Projects
None yet
Development

No branches or pull requests