Tuesday, September 30, 2014

How to: Fix a random reboots on the HTC One M8


Some time ago I described a method to format the /data partition on the HTC One (M7) - How to: Fix a corrupted DATA partition on the HTC One. This method is suitable for more HTC devices (all with EXT4 support) and with the mkfs.ext4 tool you can format system and cache partitions as well. All you need to know is the proper /dev/block/mmcblk0pXY number of the partition you want to format.

However, formatting the partition always means that your data will be gone. On the HTC One M8 I noticed a problem, most likely caused by the wp_mod.ko module (module to disable system R/W protection). When the module is loaded too late and anything ever gets changed before the module is loaded the file-structure of the /data partition might (and probably will) get corrupted. As a result your device will reboot each time you'll try to make and change on the /system partition (even if mounted as RW). So removing, copying, moving, re-naming or editing any file on a system partition will result with the following message in the kernel log (last_kmsg.txt):


Formatting the /data partition is not the best idea for some and it's not needed in most cases.

Repair Process
  1. Download this mini-sdk package and extract it to c:\mini-sdk
  2. Download this fsck.ext4 binary and put it into c:\mini-sdk
  3. Connect your device to the PC
  4. Boot your device in recovery mode
  5. Open a command prompt on the PC (cmd.exe), type and confirm each command with ENTER:
  6. cd /d c:\mini-sdk
  7. adb push fsck.ext4 /tmp
  8. adb shell
  9. chmod 777 /tmp/fsck.ext4
  10. /tmp/fsck.ext4 -fn /dev/block/mmcblk0p47

This will fix your /data partition and you should see the following output (numbers in the last line will be different in each case):

e2fsck 1.42.9 (28-Dec-2013)
Pass 1: Checking inodes, blocks, and sizes
Pass 2: Checking directory structure
Pass 3: Checking directory connectivity
Pass 4: Checking reference counts
Pass 5: Checking group summary information
/dev/block/mmcblk0p47: 19050/712704 files (2.7% non-contiguous), 2320338/2850816 blocks


Your /data partition is now fixed and you should no longer experience random reboots problem on your device (assuming that the corrupted /data partition was the source of the problem). Keep in mind that the fsck.ext4 -fn command can be used to check other EXT4 partitions on any device that has EXT4 file-system structure. All you need to know is the partition name or block number.


Do you have any questions or comments? Feel free to share! Also, if you like this article, please use media sharing buttons (Twitter, G+, Facebook) below this post!


For latest news follow Android Revolution HD on popular social platforms: