kavishdevar/librepods

L2CAP connection fails on A16 GrapheneOS

Open

#211 创建于 2025年9月29日

在 GitHub 查看
 (19 评论) (2 反应) (0 负责人)Kotlin (26,975 star) (1,507 fork)batch import
androidbuggood first issue

描述

Commented on #188 as well, but creating a new issue as I have gathered some more potentially helpful info.

As zygisk does not work on rooted GrapheneOS, I can't (correct me if I'm wrong) use the Xposed framework. Thus I'm installing the btl2capfix module with Magisk.

I tried the module from #61 using the nightly build and got the same error mentioned in #188. I then tried investigating the module to see if it does what it has to. Android is not my expertise so my assumptions might be wrong but here are my findings (looking at the phones filesystem after module install and reboot):

  1. My phones bluetooth library is located at /apex/com.android.bt/lib64/libbluetooth_jni.so.
  2. post-data-fs.sh creates an overlay mount from /data/adb/modules_update/btl2capfix/apex/com.android.bt/lib64 to /apex/com.android.bt/lib64
    Contents of post-data-fs.sh:
    #!/system/bin/sh
    mount -t overlay overlay -o lowerdir=/apex/com.android.bt/lib64,upperdir=/data/adb/modules_update/btl2capfix/apex/com.android.bt/lib64,workdir=/data/adb/modules_update/btl2capfix/apex/com.android.bt/work /apex/com.android.bt/lib64
    
  3. /data/adb/modules_update/ does not exist, but /data/adb/modules/btl2capfix/ does
  4. With this info I tried patching the module to instead mount /data/adb/modules/btl2capfix/apex/com.android.bt/lib64 to /apex/.../lib64
  5. After installing the modified module I checked the sha512 hashes for both files and they didn't match + mount | grep overlay | grep bluetooth and mount | grep apex.*bt didn't return anything to indicate an overlay mount to /apex/.../lib64
  6. I then tried to instead create a bind mount, that did not work as well. Then I tried the bind mount, but in service.sh instead of post-data-fs.sh. This finally worked
    By worked I mean the sha512 hashes of /data/adb/modules/btl2capfix/apex/com.android.bt/lib64/libbluetooth_jni.so and /apex/com.android.bt/lib64/libbluetooth_jni.so matched. I'm not sure that's the correct way to measure success in this case, but there was a change.
  7. I copied the patched libbluetooth_jni.so file over to my computer to check if the patches were successful. I looked at the addresses dispalyed for both functions is the Magisk install log and both had a return at the start of the function - matching the hex in customize.sh
  8. Even with the now confirmed patched libbluetooth_jni.so bind mounted into /apex/.../lib64, the same error of L2CAP connection failing persisted.

I captured troubleshooting logs with the module mentioned in #61: airpods_log_1759102497486.txt And the modified version with bind mounting and matching file hashes: airpods_log_1759102773514.txt

I am aware that this is a massive edge case as Pixel phones with A16 seem to work when using the Xposed framework. I might be the only person trying to run Librepods on a Pixel6 running rooted GrapheneOS.

I am very thankful for your continued work on this project. Let me know if I can provide any additional information.

贡献者指南