Skip to content

Instantly share code, notes, and snippets.

@wendimust
Created June 28, 2025 09:07
Show Gist options
  • Select an option

  • Save wendimust/0fb7c71cf6da0bb44a018f7eba356c83 to your computer and use it in GitHub Desktop.

Select an option

Save wendimust/0fb7c71cf6da0bb44a018f7eba356c83 to your computer and use it in GitHub Desktop.
How to flash Samsung devices using a Linux machine

πŸ“± Flash Samsung Firmware on Linux (Ubuntu 24.04+) Using Heimdall

A complete step-by-step guide to flashing Samsung firmware using Linux and the open-source Odin alternative: Heimdall.


🧰 Requirements

  • A Samsung smartphone or tablet
  • A Linux distro (tested on Ubuntu 24.04)
  • A USB cable (preferably original)
  • Downloaded Samsung firmware (from SamMobile, SamFW, etc.)
  • heimdall installed

πŸ› οΈ Step 1: Install Heimdall

Install via APT:

sudo apt update
sudo apt install heimdall-flash

Verify installation:

heimdall version

If you get APT lock errors (e.g., packagekitd holding lock), run:

sudo killall packagekitd

⚑ Step 2: Boot Samsung Device into Download Mode

Use one of these combinations (device dependent):

Device Type Button Combo
Older (w/ Bixby) Vol Down + Bixby + Power
Newer (no Bixby) Vol Down + Vol Up (then connect USB)
One UI 6+ Devices Vol Down + Vol Up + USB cable

Then press Vol Up to enter Download Mode.


πŸ”Œ Step 3: Verify Connection

Connect your device via USB and run:

sudo heimdall detect

Expected output:

Device detected

If not, check:

  • USB cable/port
  • USB debugging / driver issues
  • That you're really in Download Mode

πŸ“¦ Step 4: Extract Firmware Files

Extract .tar.md5 firmware:

7z x firmware.tar.md5

This should give you .img files like:

  • boot.img
  • recovery.img
  • vbmeta.img
  • super.img
  • userdata.img

You do not flash .tar.md5 directly with Heimdall.


πŸ” Step 5: List Valid Partitions

Get the PIT (Partition Information Table):

sudo heimdall print-pit

Example partitions:

  • BOOT
  • RECOVERY
  • SUPER
  • VBMETA

⚠️ Many modern Samsung devices do not have a SYSTEM partition β€” use SUPER instead.


πŸš€ Step 6: Flash the Firmware

Flash the files to correct partitions:

sudo heimdall flash \
  --BOOT boot.img \
  --RECOVERY recovery.img \
  --SUPER super.img \
  --VBMETA vbmeta.img

Customize flags based on what you extracted and what print-pit showed.


πŸ” Step 7: Reboot the Device

If the device doesn’t reboot automatically:

sudo heimdall reboot

πŸ›‘οΈ (Optional) Setup udev Rule to Avoid sudo

echo 'SUBSYSTEM=="usb", ATTR{idVendor}=="04e8", MODE="0666"' | sudo tee /etc/udev/rules.d/50-samsung.rules
sudo udevadm control --reload-rules

Unplug and replug your device afterward.


βœ… Done!

You’ve successfully flashed your Samsung firmware from Linux. πŸŽ‰ This method is especially useful for developers or users who don’t want to rely on Windows-only tools like Odin.


πŸ“ Notes

  • Only flash firmware exactly matching your model number
  • Back up your data β€” flashing usually wipes the device
  • Be cautious β€” improper flashing can brick your device

πŸ”— Resources


@diclofenacc
Copy link
Copy Markdown

heimdall is not working for recovery.img for samsung s6 lite(wifi), shows 'ERROR: Failed to receive session end confirmation!' this error and tab says only official binaries can be flashed.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment