BluetoothLibraryPatcher icon indicating copy to clipboard operation
BluetoothLibraryPatcher copied to clipboard

Customize.sh error

Open j1nior opened this issue 6 months ago β€’ 1 comments

Hi Arthur,

After the recent update, I lost the pairing between the phone and the smartwatch. We’ve thoroughly investigated the issue and tracked down the exact cause. Here’s a complete breakdown of what happened:


❗ Error Observed:

In the log, the following error appeared during boot:

/data/adb/modules/BluetoothLibraryPatcher/customize.sh: line 131: can't open /hal: no such file


🧠 What Line 131 Was Supposed to Do:

sed -i $((awk '/security.wsm/ {print FNR}' $i-1)),/</hal>/d $earlymountdir/system$i

This line attempts to delete the XML block that contains vendor.samsung.hardware.security.wsm.service, starting from the line before the match until the closing .


❌ Why It Failed:

If awk doesn't find the line containing security.wsm, it returns nothing.

As a result, the command becomes:

sed -i $(( -1 )),/</hal>/d ...

This causes the shell to misinterpret the argument and throws the error:

can't open /hal


βœ… Reality Check:

The file did contain the following block:

vendor.samsung.hardware.security.wsm.service 1 ISehWsm/default

So awk should have found the match, but for some reason, it failed at runtime.


πŸ” Final Diagnosis:

  1. The script failed to remove the security.wsm block.

  2. The boot process then included the unpatched HAL, breaking Bluetooth pairing with the watch.


βœ… Manual Fix:

We replaced the faulty line with this safer version:

line=$(awk '/security.wsm/ {print FNR}' "$i") if [[ ! -z $line ]]; then sed -i "$((line-1)),/</hal>/d" "$earlymountdir/system$i" fi

This adds a sanity check before running sed, avoiding the failure if awk finds nothing.

After applying the patch manually with this change, the watch paired successfully again.


πŸ“Ž Suggestion:

Consider updating the script with this fail-safe check so the patch process doesn't break silently in similar scenarios. If needed, we can send the modified version of customize.sh.

Let me know if you want logs or further info.

πŸ’‘ Suggestion

If you have time, it would be awesome to add a small Magisk "Action" button to check:

whether the /hal block was removed from that XML

whether the hex patch was applied correctly And return a simple βœ” OK, all good! if everything is in place.

Would help a lot with troubleshooting and confidence after updates.

Thanks again for your work β€” feel free to reach out if you want more logs or details.

Best regards, Junior

292a.zip

magisk_install_log_2025-07-30T01.25.05.log magisk_install_log_2025-07-30T01.14.08.log

Edit: Hi, thanks again for your work. After all that, I'm running into a new problem: everything seems to work during the initial installation, and the hex patch applies correctly. However, after a reboot, the patch no longer works β€” it's like the module is not active anymore.

I checked /data/adb/modules/BluetoothLibraryPatcher/ and noticed that service.sh is missing, even though it's present in the ZIP file. It seems Magisk isn't extracting or enabling the module properly after reboot.

Let me know if there's anything I can try or provide to help debug it further.

Thanks in advance

BluetoothModule_customize.log BluetoothModule_hexpatch.log

j1nior avatar Jul 30 '25 04:07 j1nior