Flash TWRP .img File From Ubuntu Using Fastboot

I use TWRP (TeamWin Recovery Project) on my Nexus 4. Back in the day (read: 3 years ago) I used ClockworkMod Recovery, on my Moto Defy, but have since switched to TWRP. I believe there were some licensing issues that drove a lot of people away from CWM. In any case, you’ll want to install adb and fastboot before proceeding.

From an Ubuntu distribution (Xubuntu in my case):

sudo apt-get install android-tools-adb android-tools-fastboot

After adb and fastboot have been installed, boot your Nexus 4 into fastboot mode. Just switch your Nexus 4 off, then turn it back on while holding the volume down button. Keep holding the down button until you see a menu (usually with an Android guy somewhere on the screen). Entering fastboot mode may be different for your device, check the TWRP site, they have instructions for a lot of different devices.

Now, make sure your PC sees your device in fastboot mode. In a terminal window, run fastboot devices. If nothing is printed to the terminal, something is wrong, you probably don’t have fastboot enabled. If you did see some output, you should be good to go.

Download the latest recovery .img file from the TWRP site. Current version as of this post is To flash it using fastboot, do this in a terminal:

fastboot flash recovery openrecovery-twrp-

If everything goes well, you should see something similar to this:

sending ‘recovery’ (8130 KB)…
OKAY [ 0.510s]
writing ‘recovery’…
OKAY [ 0.476s]
finished. total time: 0.987s

If you see something other than OKAY messages, something is probably wrong, and I have no idea what. If you do see the OKAY messages, you can either reboot your phone to Android or go to recovery which will take you to TWRP. With TWRP you can make a nandroid backup, flash new roms, flash new gapps, and all kinds of other things.


Well, now what?

Work with Me

I'm available for hire and always taking new clients, big and small. Got a project or an idea you'd like to discuss? Startup plan but no developer to make it happen? Just get in touch, I'd love to see if I can help you out!

Leave some Feedback

Got a question or some updated information releavant to this post? Please, leave a comment! The comments are a great way to get help, I read them all and reply to nearly every comment. Let's talk. 😀

Longren.io is proudly hosted by DigitalOcean


7 thoughts on “Flash TWRP .img File From Ubuntu Using Fastboot

  1. Hey tyler i am trying to do the same on HTC butterfly, while executing fastboot flash recovery recovery.img this command, there is one message poped up waiting for device..
    So please can you help me what to do next

  2. tried this with my xiaomi mi4c.
    sudo fastboot devices gave this:
    fd774046 fastboot

    sudo fastboot flash recovery mi4c_twrp_recovery.img says :
    target reported max download size of 536870912 bytes
    sending ‘recovery’ (50140 KB)…
    OKAY [ 1.278s]
    writing ‘recovery’…
    OKAY [ 0.295s]
    finished. total time: 1.573s

    but after pushing volum up and power i still come to a recovery wich says MIRecovery. So it seems that nothing happends.

    lg grischan

    1. found out that i could boot my phone with twpr with “sudo fastboot boot mi4c_twrp_recovery.img”

  3. i have loaded twrp as per below. but now phone keep rebooting it self from the lenovo intro page. I’m using lenovo K3 note. I tried with pressing volume up+ down + power key is not going to recovery mode. What can i do now? not even giving any option to go anywhere.

    /Downloads$ fastboot flash recovery openrecovery-twrp-
    target reported max download size of 134217728 bytes
    sending ‘recovery’ (8176 KB)…
    OKAY [ 0.279s]
    writing ‘recovery’…
    OKAY [ 0.198s]
    finished. total time: 0.477s

  4. while flashing if it says download for partition 'recovery' is not allowed then just run fastboot oem unlockIt will unlock bootloader and try again


Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.