Skip to content

Instantly share code, notes, and snippets.

@TheAirBlow
Last active November 29, 2025 10:51
Show Gist options
  • Select an option

  • Save TheAirBlow/06bb6f49b4af9dd718d9321fbb8605b3 to your computer and use it in GitHub Desktop.

Select an option

Save TheAirBlow/06bb6f49b4af9dd718d9321fbb8605b3 to your computer and use it in GitHub Desktop.
Samsung Multi-Disabler by hand on Linux

Samsung Multi-Disabler by hand

This tutorial is made for Linux users (it may not work on WSL).
It is instuction how to to everything Samsung Multi-Disabler does by hand.
It is handy if you want to make installing TWRP easier (no recovery override),
or just to make a playground for toying with Android.
Package android-tools should be installed, and your device should be connected.
Also, this is only for Samsung, do not try this on any other device.

Step 1: Prepare

Convert sparse image to raw ext4 image, create mount point directories, mount raw ext4 images. System is /mnt/system/ and vendor is /mnt/vendor/.

simg2img system.img.ext4 system.raw
sudo mkdir /mnt/system/
sudo mount -t ext4 -o loop system.raw /mnt/system/
simg2img vendor.img.ext4 vendor.raw
sudo mkdir /mnt/vendor/
sudo mount -t ext4 -o loop vendor.raw /mnt/vendor/

Step 2: Vendor patching

Root for everything below is /mnt/vendor/

Sub-step 1: Disable Force-Encrypt

Check which file you have, /etc/fstab.exynos or /etc/fstab.qcom.

sudo sed -i -e 's/^\([^#].*\)fileencryption=[^,]*\(.*\)$/# &\n\1encryptable\2/g' "<file_path_here>"

Sub-step 2: Disable vaultkeeper

Please check that adb shell getprop ro.boot.dynamic_partitions is not true.

Android 10 and above

Here are the required files: /etc/init/vk*.rc /etc/init/vaultkeeper*
* is a wildcard and means "anything".
For each file that meets these naming rules, do sed -i -e 's/^[^#].*$/# &/' "<file_path_here>"

Android 9

Click here for instructions. It is in System patching!

Any Android (should be followed)

Disable "vaultkeeper" service.
Run this: sudo chmod 0 /bin/vaultkeeperd

Sub-step 3: Disable process authentication

The required file is /etc/init/pa_daemon*.rc
* is a wildcard and means "anything".
For each file that meets these naming rules, do sed -i -e 's/^[^#]/# &/' "<file_path_here>"
Disable "proca" service.
Next steps are only for Android 10 and below. This is a warning for Vendor patching only.

Sub-step 4: Disable WSM

Disable "wsm" service.

Sub-step 5: Disable CASS

Model is not Galaxy A20s or similar. It is A207F, for example.
This step is required only if you have any output from this command: echo "<device_model_here>" | grep -E 'G97([035][FNUW0]|7[BNUW])|N97([05][FNUW0]|6[BNQ0]|1N)|T860|F90(0[FN]|7[BN])|M[23]15F'
The required files are /vendor/init/cass.rc /vendor/etc/init/cass.rc
Just run this for each of these files: sed -i -e 's/^[^#].*cass.*$/# &/' -re '/\/(system|vendor)\/bin\/cass/,/^#?$/s/^[^#]*$/#&/' "<file_path_here>"

Step 3: System patching

Root for everything below is /mnt/system/.

Sub-step 1: Recovery restore

The required file is recovery-from-boot.p.
It may be in the root or in system directory.
Just run this in each directory mentioned above: mv recovery-from-boot.p recovery-from-boot.p~

Sub-step 2: Disable vaultkeeper

Please check that adb shell getprop ro.boot.dynamic_partitions is not true.

Android 10 and above

Click here for instructions. If you did it already, you can skip that. It is in Vendor patching!

Android 9

Just run this:

sed -i -e 's/^[^#].*vaultkeeper.*$/# &/' \
	-re '/\/system\/bin\/vaultkeeperd/,/^#?$/s/^[^#]*$/#&/' init.rc

Any Android (should be followed)

Run this: sudo chmod 0 /bin/vaultkeeperd

Sub-step 3: Disable CASS

Model is not Galaxy A20s or similar. It is A207F, for example.
This step is required only if you have any output from this command: echo "<device_model_here>" | grep -E 'G97([035][FNUW0]|7[BNUW])|N97([05][FNUW0]|6[BNQ0]|1N)|T860|F90(0[FN]|7[BN])|M[23]15F'
Just run this: sed -i -e 's/^[^#].*cass.*$/# &/' -re '/\/(system|vendor)\/bin\/cass/,/^#?$/s/^[^#]*$/#&/' init.rc

Optional: Patch libbluetooth

Follow this step only if you have any other Android version than 10.
Model is not Galaxy A20s or similar. It is A207F, for example.
Just run this:

local f=/system/lib64/libbluetooth.so
local tf=/tmp/f

if echo "<device_model_here>" | grep -E '[GN]9[67][03567][UW0]|F90(0[FN]|7[BN])|T86[05]' >/dev/null; then
  substitute='s/88000054691180522925c81a69000037e0030032/04000014691180522925c81a69000037e0031f2a/'
else
  substitute='s/c8000034f4031f2af3031f2ae8030032/1f2003d5f4031f2af3031f2ae8031f2a/'
fi

xxd -p $f | tr -d '\n ' | sed -e $substitute | xxd -rp > $tf

if ! cmp $tf $f >/dev/null && [ $(stat -c '%s' $tf) -eq $(stat -c '%s' $f) ]; then
  echo "Patching successful!"
  touch -r $f $tf
  chmod 644 $tf
  mv $tf $f
else
  echo "Patching failed, no changes vere made."
  rm -f $tf
fi

How to remove something from manifest

Variable service should be set to what service you want to disable.
The required files are /mnt/vendor/etc/vintf/manifest.xml /mnt/system/system/etc/vintf/compatibility_matrix.device.xml /mnt/vendor/etc/vintf/manifest/vaultkeeper_manifest.xml

Android 10 and above

sed -i -e '/<hal format="hidl">/{N;/<name>vendor\.samsung\.hardware\.security\.'"$service"'<\/name>/{:loop;N;/<\/hal>/!bloop;d}}' $i

Android 9

sed -i -e '/<hal format="hidl">/{N;/<name>vendor\.samsung\.security\.'"$service"'<\/name>/{:loop;N;/<\/hal>/!bloop;d}}' $i

Step 3: Convert our patched images

Convert raw ext4 image to sparse.

mkdir patched
img2simg system.raw patched/system.img.ext4
sudo umount /mnt/system/
sudo rm -rf /mnt/system/
img2simg vendor.raw patched/vendor.img.ext4
sudo umount /mnt/vendor/
sudo rm -rf /mnt/vendor/
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment