Sui icon indicating copy to clipboard operation
Sui copied to clipboard

adb root 功能不支持不带版本号的 apex

Open Kazurin-775 opened this issue 2 years ago • 2 comments

  • 系统:Android 11 (ArrowOS)
  • 设备:小米 6X (wayne)
  • Magisk: v24.3
  • Sui: 当前 CI 最新版 (f8eee8c) v12.6.1-release

在手机上创建 enable_adb_root 文件并重启后,adb root 仍然提示 adbd cannot run as root in production builds

日志关键部分:

01-08 07:03:35.164   704   704 I Sui     : Setup adb root support: /dev/PwR6B9/.magisk/modules/zygisk-sui
01-08 07:03:35.168   704   704 I Sui     : Use adbd from /apex
01-08 07:03:35.169   704   704 I Sui     : /apex/com.android.adbd/bin/adbd is dynamically linked
01-08 07:03:35.170   704   704 V Sui     : /apex/com.android.adbd/bin/adbd: uid=0, gid=2000, mode=100755, context=u:object_r:adbd_exec:s0
01-08 07:03:35.170   704   704 V Sui     : /apex/com.android.adbd/bin: uid=0, gid=2000, mode=40751, context=u:object_r:system_file:s0
01-08 07:03:35.180   704   704 E Sui     : Cannot find versioned apex
01-08 07:03:35.195   706   706 I Sui     : Exited with 13

完整开机日志:logcat-coldboot.txt

通过 adb 检查 /apex 发现所有项目都不带版本号:

wayne:/ # ls /apex
com.android.adbd           com.android.i18n           com.android.neuralnetworks  com.android.sdkext
com.android.art            com.android.ipsec          com.android.os.statsd       com.android.tethering
com.android.cellbroadcast  com.android.media          com.android.permission      com.android.tzdata
com.android.conscrypt      com.android.media.swcodec  com.android.resolv          com.android.vndk.v30
com.android.extservices    com.android.mediaprovider  com.android.runtime         com.android.wifi
wayne:/ #

检查 /system/apex 发现所有 apex 都是未压缩的「扁平化 apex」,不是 .capex 格式的压缩包:

wayne:/ # ls -l /system/apex
total 80
drwxr-xr-x 6 root root 4096 2009-01-01 08:00 com.android.adbd
drwxr-xr-x 7 root root 4096 2009-01-01 08:00 com.android.art.release
drwxr-xr-x 3 root root 4096 2009-01-01 08:00 com.android.cellbroadcast
...
wayne:/ # ls -la /system/apex/com.android.adbd/
total 32
drwxr-xr-x  6 root root  4096 2009-01-01 08:00 .
drwxr-xr-x 22 root root  4096 2009-01-01 08:00 ..
-rw-r--r--  1 root root   218 2009-01-01 08:00 apex_manifest.pb
-rw-r--r--  1 root root  1032 2009-01-01 08:00 apex_pubkey
drwxr-x--x  2 root shell 4096 2009-01-01 08:00 bin
drwxr-xr-x  2 root root  4096 2009-01-01 08:00 etc
drwxr-xr-x  2 root root  4096 2009-01-01 08:00 lib
drwxr-xr-x  2 root root  4096 2009-01-01 08:00 lib64

Kazurin-775 avatar Mar 21 '22 04:03 Kazurin-775

https://github.com/RikkaApps/Sui/blob/f8eee8c8c832b04ceac3ad41fb98f14266fd3e4d/module/src/main/cpp/main/adb_root.hpp#L197-L222

不要乱猜理由,就是假定了一定要有带版本号的 apex 文件夹而已(

RikkaW avatar Mar 21 '22 05:03 RikkaW

抱歉,看文档看漏了一句话,您说得对

Kazurin-775 avatar Mar 21 '22 06:03 Kazurin-775