[HOW-TO] Modify boot.img to disable auto-force encryption

Recommended Posts

Hey guys/gals,


I no longer have a Nexus 6, so I will not be providing the modified boot-new.img's any longer that have auto-force encryption disabled.  :(


I do have a "How To" for you, so you can modify the boot.img file in the factory images as they are released each month.


Prereq’s for this:  You’ll need to have downloaded the factory images, or have the factory boot.img file from the factory image file.  You’ll also need the bootimg.exe file (see bottom of this post for the file).  You’ll also need to know how to use fastboot from the Android SDK Tools, Command Line, and how to boot the device to the bootloader.  A thing to note here:  If your device is encrypted currently, this does NOT decrypt it!  The only way to do that is by erasing /userdata (which removes all of your apps, app data, etc etc), then flashing the boot-new.img you’ve edited.  At that point, you’ll have to essentially re-setup your device.


1.    For sake of this write-up, the path to mine is the following:  C:\bootimg
       a.    Inside the bootimg folder, the only file is bootimg.exe.
2.    Open a Command Prompt window, you’ll want to “Run as Administrator”.
        a.    Change directory’s to the bootimg folder:



cd bootimg

3.    Take the boot.img file from the factory images you’ve downloaded for the Nexus 6, and place it into the bootimg folder.
        a.    You should now have 2 files in this folder:  bootimg.exe, boot.img
4.    In your Command Prompt window now, type in the following:

 bootimg.exe --unpack-bootimg

       b.    You should get some output in the window, ending with “compress:  True”
5.    Now in your bootimg folder, you should have multiple files, and one folder.
       a.    Open the folder initrd.
       b.    Open the file fstab.shamu in Notepad, Notepad++, or my favorite Sublime 3
               i.    DON’T USE WORD!
       c.    Here is the line you’ll want to look at, as this is where the edit is made (it’s showing 2 here, but it is technically all on one line, as you’ll see):

/dev/block/platform/msm_sdcc.1/by-name/userdata    /data        ext4    rw,nosuid,nodev,noatime,nodiratime,noauto_da_alloc,nobarrier    wait,check,formattable,forceencrypt=/dev/block/platform/

       d.    The edit is made to this part:

       e.    Change the text forceencrypt to:  encryptable
               i.    Line should now read as shown:
              ii.    Here’s the full line:

/dev/block/platform/msm_sdcc.1/by-name/userdata    /data        ext4    rw,nosuid,nodev,noatime,nodiratime,noauto_da_alloc,nobarrier    wait,check,formattable,encryptable=/dev/block/platform/

         f.    Save the changes to the file.
                i.    DON’T change other things here if you don’t know what they will do, as you will boot loop!
         g.    Close the file.
6.    In your Command Prompt window, type in the following:

bootimg.exe --repack-bootimg

7.    You’ll notice in C:\bootimg there will be 3 files now, bootimg.exe, boot-new.img, and boot-old.img.
         a.    boot-old.img is the ORIGINAL UNMODIFIED boot.img file
         b.    boot-new.img is the MODIFIED boot.img file
8.    Place the boot-new.img file where ever you keep your factory image files, and now it is ready for flashing to your phone via fastboot.
         a.    Connect phone to computer.
         b.    Boot into bootloader.
         c.    Type in (Makes sure fastboot can “see” your device):  

fastboot devices

         d.    Run (erases boot partition first, then next command flashes your boot-new.img file to the boot partition):

fastboot erase boot


fastboot flash boot boot-new.img

9.    Reboot phone, you’re done!

10.  If you get a boot loop, you can always boot back into the bootloader and flash the stock factory image boot.img file, just flash that file via Step 8.


Edited by RMarkwald
adding bootimg.exe for download

Share this post

Link to post
Share on other sites

Thanks @RMarkwald for providing these each update, and for providing the how-to.  Ironically, I think Google is also done with the N6 as of this month, so I suppose we'll let you "off the hook" for providing updates.  =;)

Edited by JohnB

Share this post

Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now