Repairing a corrupt hard disk

My hdd seems to have become completely corrupted. It was the hdd on NTFS that I used for Win7. I’d been getting weird slowdowns and hangups+crashes lately. On checking with chkdsk, it seems to freeze. Either it has a lot of bad sectors, or it’s physically done for..

Tried Gparted-Wouldnt finish scanning it

Chkdsk-Hangs

Ubuntu Live CD-Gparted-Hangs

Win7-Installation Formatter-Doesnt proceed to the stage of formatting!

Finally did this in Ubuntu Live CD:

$fdisk
The number of cylinders for this disk is set to 60801.
There is nothing wrong with that, but this is larger than 1024,
and could in certain setups cause problems with:
1) software that runs at boot time (e.g., old versions of LILO)
2) booting and partitioning software from other OSs
(e.g., DOS FDISK, OS/2 FDISK)

Command (m for help): p

Disk /dev/sda: 500.1 GB, 500107862016 bytes
255 heads, 63 sectors/track, 60801 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Disk identifier: 0x84b8ae6e

Device Boot      Start         End      Blocks   Id  System
/dev/sda1   *           1       60802   488386528+   7  HPFS/NTFS

Command (m for help): d
Selected partition 1

Command (m for help): p

Disk /dev/sda: 500.1 GB, 500107862016 bytes
255 heads, 63 sectors/track, 60801 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Disk identifier: 0x84b8ae6e

Device Boot      Start         End      Blocks   Id  System

Command (m for help): n
Command action
e   extended
p   primary partition (1-4)
p
Partition number (1-4): 1
First cylinder (1-60801, default 1):
Using default value 1
Last cylinder, +cylinders or +size{K,M,G} (1-60801, default 60801):
Using default value 60801

Command (m for help): p

Disk /dev/sda: 500.1 GB, 500107862016 bytes
255 heads, 63 sectors/track, 60801 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Disk identifier: 0x84b8ae6e

Device Boot      Start         End      Blocks   Id  System
/dev/sda1               1       60801   488384001   83  Linux

Command (m for help): t
Selected partition 1
Hex code (type L to list codes): L

0  Empty           1e  Hidden W95 FAT1 80  Old Minix       bf  Solaris
1  FAT12           24  NEC DOS         81  Minix / old Lin c1  DRDOS/sec (FAT-
2  XENIX root      39  Plan 9          82  Linux swap / So c4  DRDOS/sec (FAT-
3  XENIX usr       3c  PartitionMagic  83  Linux           c6  DRDOS/sec (FAT-
4  FAT16 <32M      40  Venix 80286     84  OS/2 hidden C:  c7  Syrinx
5  Extended        41  PPC PReP Boot   85  Linux extended  da  Non-FS data
6  FAT16           42  SFS             86  NTFS volume set db  CP/M / CTOS / .
7  HPFS/NTFS       4d  QNX4.x          87  NTFS volume set de  Dell Utility
8  AIX             4e  QNX4.x 2nd part 88  Linux plaintext df  BootIt
9  AIX bootable    4f  QNX4.x 3rd part 8e  Linux LVM       e1  DOS access
a  OS/2 Boot Manag 50  OnTrack DM      93  Amoeba          e3  DOS R/O
b  W95 FAT32       51  OnTrack DM6 Aux 94  Amoeba BBT      e4  SpeedStor
c  W95 FAT32 (LBA) 52  CP/M            9f  BSD/OS          eb  BeOS fs
e  W95 FAT16 (LBA) 53  OnTrack DM6 Aux a0  IBM Thinkpad hi ee  GPT
f  W95 Ext’d (LBA) 54  OnTrackDM6      a5  FreeBSD         ef  EFI (FAT-12/16/
10  OPUS            55  EZ-Drive        a6  OpenBSD         f0  Linux/PA-RISC b
11  Hidden FAT12    56  Golden Bow      a7  NeXTSTEP        f1  SpeedStor
12  Compaq diagnost 5c  Priam Edisk     a8  Darwin UFS      f4  SpeedStor
14  Hidden FAT16 <3 61  SpeedStor       a9  NetBSD          f2  DOS secondary
16  Hidden FAT16    63  GNU HURD or Sys ab  Darwin boot     fb  VMware VMFS
17  Hidden HPFS/NTF 64  Novell Netware  b7  BSDI fs         fc  VMware VMKCORE
18  AST SmartSleep  65  Novell Netware  b8  BSDI swap       fd  Linux raid auto
1b  Hidden W95 FAT3 70  DiskSecure Mult bb  Boot Wizard hid fe  LANstep
1c  Hidden W95 FAT3 75  PC/IX           be  Solaris boot    ff  BBT
Hex code (type L to list codes): c
Changed system type of partition 1 to c (W95 FAT32 (LBA))

Command (m for help): p

Disk /dev/sda: 500.1 GB, 500107862016 bytes
255 heads, 63 sectors/track, 60801 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Disk identifier: 0x84b8ae6e

Device Boot      Start         End      Blocks   Id  System
/dev/sda1               1       60801   488384001    c  W95 FAT32 (LBA)

Command (m for help): w
The partition table has been altered!

Calling ioctl() to re-read partition table.

WARNING: If you have created or modified any DOS 6.x
partitions, please see the fdisk manual page for additional
information.
Syncing disks.
[email protected]:~$ sudo mkfs -t fat32 /dev/sda1
mkfs.fat32: No such file or directory
[email protected]:~$ mkfs
Usage: mkfs [-V] [-t fstype] [fs-options] device [size]
[email protected]:~$ sudo apt-get mkfs.fat2
E: Invalid operation mkfs.fat2
[email protected]:~$ sudo apt-get mkfs.fat32
E: Invalid operation mkfs.fat32
[email protected]:~$ sudo apt-get mkfs
E: Invalid operation mkfs
[email protected]:~$ sudo mkfs -t ext4 /dev/sda1
mke2fs 1.41.4 (27-Jan-2009)
Filesystem label=
OS type: Linux
Block size=4096 (log=2)
Fragment size=4096 (log=2)
30531584 inodes, 122096000 blocks
6104800 blocks (5.00%) reserved for the super user
First data block=0
Maximum filesystem blocks=0
3727 block groups
32768 blocks per group, 32768 fragments per group
8192 inodes per group
Superblock backups stored on blocks:
32768, 98304, 163840, 229376, 294912, 819200, 884736, 1605632, 2654208,
4096000, 7962624, 11239424, 20480000, 23887872, 71663616, 78675968,
102400000

Writing inode tables: done
Creating journal (32768 blocks): done
Writing superblocks and filesystem accounting information: done

This filesystem will be automatically checked every 29 mounts or
180 days, whichever comes first.  Use tune2fs -c or -i to override.
[email protected]:~$ fsck.ext4 -cDfty -C 0 /dev/sda1
e2fsck 1.41.4 (27-Jan-2009)
fsck.ext4: Permission denied while trying to open /dev/sda1
You must have r/w access to the filesystem or be root
[email protected]:~$ sudo fsck.ext4 -cDfty -C 0 /dev/sda1
e2fsck 1.41.4 (27-Jan-2009)

 

The following is from http://justcheckingonall.wordpress.com/2010/07/18/howto-repair-broken-ext4-partitions/

 

 

HowTo Repair Broken ext4 Partitions

Every now and then, you might run into a situation where your *nix installation won’t start due to a corrupted/damaged journal, be it due to power failure or disk failure.

That’s where fsck comes in handy.

You should boot from live distribution, such as Ubuntu live CD (running fsck on a mounted system is very dangerous), and run fsck on your file system, one partition at a time. Here’s my favourite setting:

fsck.ext4 -cDfty -C 0 /dev/sd**[/code]

  • -c – check for bad sectors
  • -D – optimize directories if possible
  • -f – force check, even if filesystem seems clean
  • -t – print timing stats (use -tt for more)
  • -y – assume answer “yes” to all questions (such as, “do you want to continue”)
  • -C 0 – print progress info to stdout
  • /dev/sd** – the partition to check, e.g. /dev/sda1 for first partition (1) on first hard disk (a), etc.

For reiser FS you can use the following:

fsck.reiserfs --fix-fixable -y /dev/sd**[/code]


You are reading this post on Joel G Mathew’s tech blog. Joel's personal blog is the Eyrie, hosted here.

How to unroot the HTC Desire

How to Unroot the HTC Desire

Other Descriptions:

How to Revert to Stock

What to do before taking my phone back to the service centre?

How to restore my phone after a failed OTA update on a Rooted phone

My phone is stuck at the HTC Quietly brilliant screen/My boot animation keeps looping, What to do?


Courtesy:
To EddyOS for the Tutorial on getting the PB99IMG from the RUU

I didnt find any newbie friendly guides for unrooting the HTC Desire, on XDA. Even some external ones arent that easy to follow, unless you have a very good idea about what is going on.

The main purpose of this post is to benefit people who have got an SLCD bricked device on their hands with nothing displayed except a blank screen, and cannot remember the key sequences necessary to activate the unrooting process, or to run the OTA Update and get to Android recovery. You will note that I have added the time taken at each step in the process. This will benefit people with SLCD bricks waiting anxiously without seeing anything on screen.

For a complete guide on Unbricking an HTC Desire, please see my thread here.

There are two methods of unrooting an HTC Desire.
Methods:

  1. Get the latest RUU for your region from Shipped Roms. This is an exe file. You can run this file directly from PC. Then connect your device when so prompted.
  2. The second method is to flash the rom.zip directly from the Android bootloader interface, after renaming the Rom.zip (which is actually obtained from the RUU) to PB99IMG.zip [See EddyOS’s excellent step-by-step guide for dummies, in the FAQ below]

Method1 does not need any explanation (If necessary, I will add illustrations of this process later along with error codes)
Method2 is illustrated below.

Note: The following post illustrates the actual steps necessary to unroot your HTC Desire by running the PB99IMG.zip. This is also the method to upgrade the software with the RUU, the last method to fix bootloops cause by a bad boot, and also the way to unbrick an SLCD bricked Desire. Note that another simple method exists to unroot the device, and that is by directly running the exe file of the RUU from Windows. Though simple, this is slightly riskier, since complications with Windows drivers, or a sudden power surge or PC reboot can semibrick/brick your device. The following method using PB99IMG.zip eliminates those problems.

Unrooting is just one of the steps necessary to unbrick an SLCD bricked HTC Desire. The process is a pain for these users because they cant see anything on the screen and left pressing keys in sequence, whose function they can only guess. Also they need to wait specific amounts of time before pressing the sequences.

I’m making visible the steps which the Android system proceeds through, when you run a PB99IMG.zip to unroot your Android device. I’ve also included the time taken before each step while running the WWE 2.29 RUU as PB99IMG.zip. The time isnt much different for other ROMs. To be sure, just give it about 30secs more than the time I’ve noted.

Initial steps:

  1. Create a goldcard if you want to convert a branded Desire to unbranded, or vice versa, or to make a Desire of one region (CID) accept software written for a phone of another region.
  2. After creating the goldcard, format it as FAT32. If more than one partition exist, delete the rest, and format one as Primary and FAT32.
  3. Put the file PB99IMG.zip into the root of the goldcard. Note that the name must be PB99IMG.zip and not PB99IMG.zip.zip. Windows has a tendency to rename it as the latter.
  4. If you dont already have the PB99IMG.zip, you can get it by running the RUU, and while the RUU is loaded (dont start the RUU upgrade. Just click on the exe, and when the welcome screen of RUU shows up,) search in your Temp folder for the file rom.zip. Hint: To quickly navigate to Temp, Type the following into the Run window: %TEMP% [If you still get this step confused, see EddyOS’s excellent tutorial on this, in the FAQ below]
  5. To run the PB99IMG.zip, just reboot with Vol- and power button pressed.

I’m describing the whole boot process below for Reference, though.

Hboot mode (Vol- & Power key. Key them pressed for a 5-6 secs

FOR INSTALLING ANY RUU AS PB99IMG.ZIP

Press Vol- , then w/o releasing it, press Power button + Vol –

After 3-4 secs, the following screen shows up momentarily:

· Fastboot
· Recovery
· Clear Storage
· Simlock
This shows the above few options for 2-3 seconds, and then directly checks for PB99IMG.ZIP. It displays:
SD Checking…
Loading…
PB99DIAG.ZIP
Pb99DIAG.nbh
PB99IMG.ZIP
When it finds PB99IMG.zip, it starts to load it (13 secs after you press the Vol- & power key)
It gives the next options after 2min 20seconds (for the WWE 2.29 RUU) from the initial key press of Vol- and Power key.
Parsing………………….[SD zip]
1. Bootloader
2. Radio V2
3. Radio_Cust
4. Boot
5. Recovery
6. System
7. Userdata
8. Splash1
9. Splash2

Do you want to update device?
<Vol Up> Yes
<Vol Down> No
So, net key sequences involved:
· Back+Power
· Power again
· Vol Up
If we chose No, next option:
Do you want to reboot device?
<Vol Up> Yes
<Vol Down> No

If you pressed Yes, then:
Update is in progress..
Do not power off your device.
1. Bootloader –OK
2. Radio V2 –OK
3. Radio_Cust –OK
4. Boot –OK
5. Recovery-Unzipping/Updating
6. System
7. Userdata
8. Splash1
9. Splash2
It cycles through each of these in turn. For me, it took exactly 2 min 17 secs for time when I chose to apply update, to when update was completed.

(Note: At times, it may update the bootloader and reboot. If you have an SLCD screen, when the device reboots, you may not see anything onscreen (black). At this point, it is notable that the device boots to Fastboot instead of Bootloader, so you will need to press Power button again to get it to resume the update process. Once it completes, you will be presented the options to reboot the device. So you just need to Press Vol + after some time)

It displays:
Update complete
So you want to reboot device?
<Vol Up> Yes
<Vol Down> No

Congratulations. Your phone is now officially unrooted.
On rebooting, HTC screen shows up for a few seconds.
Then a green Down arrow in a green circle shows up for another 5-6 seconds.
Then, HTC screen again.
Finally, HTC screen disappears and the HTC Quietly brilliant logo shows.
Your device now boots into the Android phone.
Total time taken: 6min 30 seconds.

If the Rom is incompatible with your SLCD device, at the reboot stage, you will hear the momentary vibration. Then after about 10-20secs, you will hear the HTC Quietly Brilliant tone. The phone will boot, and the keys light up after about a min, indicating that the Android system has booted up. Since the Rom is incompatible, there’s still nothing on screen. To shutdown the booted up phone, press power key, then swipe your finger vertically up-down like you do to unlock your phone normally, which is exactly what you’re doing. Then keep Power button pressed until the phone vibrates. This means it is presenting you with the Power menu. At this point press the trackball once, then once more. The phone will now shutdown. At this point you can flash your SLCD compatible update.zip (OTA) and unbrick it.

FASTBOOT mode

Back+Power key:
4 options:
· Bootloader (For running PB99IMG.zip)->Choose with Power key (This loads the Bootloader/Hboot mode)
· Reboot
· Reboot bootloader
· Power down

Bootloader (Hboot mode) or PB99IMG update mode.

Performs the following check on the PB99IMG.zip:
1. Bootloader
2. Radio V2
3. Radio_Cust
4. Boot
5. Recovery
6. System
7. Userdata
8. Splash1
9. Splash2
Do you want to start update?
Vol Up: Yes
Vol Down: No
So, net key sequences involved:
· Back+Power
· Power again
· Vol Up

If we chose No, next option:

Do you want to reboot device?
<Vol Up> Yes
<Vol Down> No

No brings up the following options:

  • · Fastboot
  • · Recovery
  • · Clear Storage
  • · Simlock

 


You are reading this post on Joel G Mathew’s tech blog. Joel's personal blog is the Eyrie, hosted here.

How to Unbrick a Desire

 

Elementary Frequently asked questions have been included at the latter part of this post..

If this thread helps you understand more about your device or solve your problems, don’t forget to Rate and Vote for this thread. That will make sure that other people who face the same problems find it easily, without having to sift through hundreds of useless posts.


Caution! CREATING A GOLD CARD IS THE MOST IMPORTANT AND PRIMARY STEP TO DO BEFORE YOU ROOT OR UNROOT YOUR DEVICE, WHETHER IT IS BRANDED OR UNBRANDED.

IF YOU EVER WANT TO RETURN YOUR PHONE FOR WARRANTY, THIS IS ESSENTIAL, AND CAN GET YOU OUT OF MOST CASES OF SLCD BRICKS.

What was my problem (a.k.a What is an SLCD bricked Desire? a.k.a Why is there nothing on my Desire screen after running an RUU/flashing an incompatible ROM)?

I had an SLCD Desire. When I ran Alpharev on it, it did S-OFF. When I ran the RUU (which was incompatible for my SLCD, and actually meant for an AMOLED Desire), I effectively unrooted it, though not restoring it to the factory state (which is the function of an RUU). Because the version of RUU was incompatible with SLCD displays, I ended up with No Display on Screen (Black screen) and a phone without a working Recovery. The only way I know the phone’s hardware is ok is because on pressing power button it vibrates.

Steps to try unbricking an SLCD bricked Desire:

Symptoms: Powering on the device just makes a vibration without anything on screen.

Previous History: You may or may not have done an S-OFF, then tried flashing an incompatible RUU for your device. You might have had an SLCD Desire, then flashed an RUU meant for an AMOLED Desire


If you had made a Goldcard earlier, you’re in luck. You can restore your device with a generic SLCD RUU available for your device, by either running the RUU or by flashing the rom.zip from the RUU.exe file (Tip. This file gets extracted to %TEMP% folder when you run an RUU)

Things you need to know before you try solving your problem:

 

  • Know how to use adb from the command prompt. If you dont have adb or dont know how to use it, read this. (Courtesy: VanillaTbone )
  • Be familiar and identify the RUU for your device on shipped-roms site. [An RUU (ROM Upgrade utility) is an application released by the manufacturer to upgrade/install ROMs). Installing RUUs essentially unroots the phone and reverts it to stock (what you got when you bought the phone. An RUU is usually flashed and the rooting process reversed when you want to return your phone to service for warranty purpose]
  • How to create and use a goldcard. (Just download this tool (Credits and All Rights by [email protected]), and run it.)
  • How to navigate to the temporary folder of your Windows PC (Hint: In the run box, type %TEMP%
  • How to turn your device on into Recovery mode and Fastboot without seeing the screen (Please see below)
  • Understand the various options and sequences of keypresses required to perform an RUU update with a PB99IMG.zip, and the various options and sequences to enter the Android Bootloader, Hboot, Recovery menus (This complete guide can guide you through the process of performing a RUU, OTA update, and the various options of Hboot and Recovery without seeing anything on screen.)


Simple search on XDA can unravel more details about these simple mysteries.

Now, the steps to go about solving your problem: (All methods used to unbrick the Desire, essentially try to unroot it with an original manufacturer’s version of files and revert to stock. In fact, the methods are same as the ones to Unroot your device. The only problem is that the issue is compounded because you cant see anything on your screen. Ironically, the problem of SLCD bricks happen when you try to unroot and the solution itself is to unroot it! )

  1. Find out if you have a generic unbranded HTC Desire, or a branded one. A branded Desire has a special Code (Customer ID) which prevents you from flashing a ROM meant for any other brand and also blocks a Generic WWE RUU. If you’re from India, it is branded with HTC_038. If you’re unbranded, things are looking much easier for you, as generic WWE RUUs for SLCD are easily available. Run the following code from the sdk folder to find out if your device is branded
    Code:
     fastboot oem gencheckpt[/code]
    
  2. This displays the CustID Code as HTC__ (and a number). If these numbers are the same as included in the cidnum value in the file android-info.txt, your device is unbranded. I have noted the following cidnums are unbranded: HTC__001, HTC__E11, HTC__N34, HTC__203, HTC__102, HTC__K18, HTC__405, HTC__Y13, HTC__A07, HTC__304, HTC__016, HTC__032. I'm not sure whether it is an exclusive list. To find out if an RUU is compatible for your ROM, the value displayed by fastboot oem gencheckpt has to be included in the cidnum list of the RUU. If it isnt included, you will need to use a goldcard to bypass the cidnum checks done by the RUU.
  3. Check if you have made a goldcard (A goldcard is a normal microsd card modified to become special while your device was in working condition. It will allow you to restore your device using a generic RUU or an OTA or allow you to switch between software meant for different regions). The purpose of a goldcard is that when apparently incompatible ROMs are flashed with a goldcard inside the device, the flashing process skips certain checks like the Customer ID check (and hence no CID error). Note however that you cannot ordinarily install software of a lower version just because you have a goldcard. Note also that it is the software version which is important, and not the Bootloader version. Note that if you want to downgrade your software to a lower version, it is easiest to use Teppic74's utility (Link1 or Link2), and downgrade to his version of the RUU (1.21), then upgrade to your version of RUU. If your device is SLCD, always make sure the software you're about to flash does support an SLCD screen. As a general rule of thumb, flashing any version <2.0 may be dangerous. Teppic74 assures us that the version 1.21 his utility comes with, is compatible with SLCDs.
  4. If you dont have a goldcard, you might try to create one at this point. (This may work only for some people. In fact I found that I could not get adb to interact with my device in Hboot/Recovery mode) Try to see if Recovery can be booted up. Poweroff phone, then power it on by pressing Vol- and Poweron key, then wait 30sec and press Vol Down and Poweron button again. At this time, phone mightget detected (if the recovery is working) in Windows (as shown by the icon in the bottom right of taskbar and a notification sound.Type:


    Code:
    adb devices[/code]
    

    If this displays a code SH**** after "List of devices", you're in luck. You can issue an adb command and get a CID of your device, following which you can create a goldcard.

    After creating a goldcard (See the start of the post for how to do it) , it will allow you to run a generic SLCD RUU. Check this link for a latest RUU.

  5. Note that you can flash an RUU in three ways. One is to just run it from Windows. . The Second is to run the RUU, and monitor your TEMP folder for changes. A directory starting with weird characters in its name appears while the RUU is run. Within that you may find a rom.zip file, which can be flashed onto your device with Fastboot.exe. The advantage is that in most bricked cases, even if the recovery wont run, Fastboot will.
  6. If you dont have a goldcard, and adb doesnt show the device in Recovery mode, it means Recovery is corrupted too. In this case, check if the device can interact with adb in FastBoot mode. Power off device. Then Poweron by pressing Back key and Power on key. Again try adb devices command. If it shows the device, follow the steps of previous step. Some people ask you just power on the device and wait for 3-7 mins and then to check if the device interacts with adb. Note that if adb successfully displays the device serial code, you can successfully create a goldcard.
  7. You can also create a goldcard by putting your microsd card into a friend's phone and following the steps needed to create a gold card, provided that your friend's phone was purchased in the same country. Note that you have to do this with YOUR goldcard. You cant have him create a goldcard, and use his CID. But you can have him mail his goldcard to you, again if you have the same brand of device from the same country.
  8. If adb doesnt show your device in either Fastboot (previous step) or in Recovery, then you're in trouble. The only way to unbrick your softbricked device is to get a Generic RUU for your device (Check shipped roms site, or search XDA), and flash it. There is also a method if you have the original OTA zip for your device. Note that the generic ROM wont flash (without a gold card) if you have a branded device. Check teppic74's posts on XDA for this method.

For those, who have searched forum after forum for any solution, note the following:

IF YOU SOFT BRICKED AN SLCD BRANDED DESIRE WHICH HAD AN UPDATED VERSION OF HBOOT BY FLASHING AN INCOMPATIBLE RUU, AND IF THE DISPLAY WONT TURN ON NOW, YOU CANNOT RESTORE THE PHONE TO WORKING CONDITION UNLESS YOU HAVE A CORRECT RUU FOR THE UPDATED HBOOT, OR A GOLDCARD. Dont waste your time looking for more solutions online. You wont find them. There is a method for downgrading an updated HBoot to a lower version. I can't assure you that it works on a bricked Desire though.

AN INDIAN HTC DESIRE IS A BRANDED DEVICE. IT IS BRANDED AS HTC_038. IT IS ALSO AN SLCD DEVICE IN MOST CASES. So, before Rooting an Indian HTC Desire, keep a gold card ready.

Dont worry about Warranty being lost if it is a new phone. HTC has to repair it according to their Warranty policy.

FREQUENTLY ASKED QUESTIONS (FAQ)

1. What is an RUU?

RUU stands for ROM upgrade utility. These are officially released by HTC for upgrading ROMs. Many ROMs have been leaked over the years, and they have been hosted at Shipped-Roms. Running an RUU essentially reverts the ROM on your device to stock (what came on the phone when you bought it), unrooting it in the process.

2. Is running an RUU safe?

It depends. If your device is an SLCD, running anything less than version 2.x has the potential to brick your device unless it is specifically certified to work with your device.

3. What do I need to do before I run an RUU?

  1. Decide that you definitely want to unroot your phone
  2. Create a goldcard. Never mind whether you think your phone is unbranded. You never know. I did not know when I ran an RUU, that my phone was actually branded, though it wasn't locked to an operator. I ended up bricking this phone, but creating this thread.
  3. Install the pc drivers for HTC Sync. But Exit from HTC Sync app or uninstall the app. Dont uninstall the HTC driver though.
  4. Connect the device to pc. Put the goldcard in the device, and run the RUU.

4. How to Unroot your HTC Desire to stock.
This is a repetition of the above FAQ. Unrooting essentially involves running the RUU, either as .exe from PC, or as a PB99img.zip from phone.

I've dedicated a whole thread on How to Unroot your Desire Safely. Read about it here.

Whatever you do, DO NOT turn off the device manually unless the software tells you to. If something goes wrong, dont switch off phone. Keep the phone on while trying a solution. Newer RUUs dont usually wreck a phone, and with a goldcard, you can always recover. But, the flash SHOULD NOT be interrupted by switching off or disconnecting the cable.

Always start with a battery with >50% power (full recommended).

5.
What is PB99IMG.zip? How do I use it?

It is the actual ROM in zip format.This is a part of the RUU. The RUU is an exe file, and when you run this file, it creates a folder in your Temp folder(Type %TEMP% in your Run Window, and press Enter). Delete all the files and folders in your Temp and then run the RUU. You will see two folders created when you run RUU. One of them (name starts with { curly brackets). Within that is another folder which contains many files, one of them is rom.zip. You need to put it in the root of your sdcard, and rename it to PB99IMG.zip. Then, when you start phone by Back Button + Power button (Fastboot), this file is automatically found by the device and prompts you to update ROM with this file. Note that you may need a gold card. Note also that in Windows, if you try renaming the file, it may get renamed to PB99IMG.zip.zip. Delete the extra trailing extension.

I've dedicated a whole thread on How to Unroot your Desire Safely with PB99IMG.zip. Read about it here.

6. Why do I need to create a goldcard?

When an RUU is run, there are many checkpoints which need to be passed before your ROM can be updated. One is the version check. Ordinarily, you cannot upgrade to a lower version. Another is the CID check (cidnum variable). CID is different for different regions. There are some regions which have unbranded devices (the WWE edition). Branded phones cannot be normally upgraded to a ROM meant for another region, including the unbranded WWE RUU.

Note that I've written normally
CID check and (But not the
software version check ) can be bypassed by putting a goldcard in the phone while running the RUU or upgrading from the PB99IMG.zip. The software version check cannot be bypassed. You can downgrade however with Teppic74's utility, and then upgrade with the RUU of your choice.

6.1 What else do I need to know about a goldcard?

A goldcard is a modification of the sector bytes of the sdcard, replacing the initial bytes of its Sector 0 (Offsets 00000000 - 00000170 ) with a certain code. Once a phone is booted into FastBoot, the device automatically checks the memory card for a few files. One of them is PB99IMG.zip in case of the Desire. This file is the upgrade utility/RUU in zip format. If this is found on th card, the system will automatically check the integrity of the file and prompt the user to upgrade his system ROM.

If the file PB99IMG.zip is presented in a Goldcard at the time of Fastboot, the upgrade will ignore CID checks (Ignores the region code locked on your device). Thus you can essentially debrand (flash software meant for another region) a phone with a goldcard and a PB99IMG.zip. The other way of course as I've already described is by simply running an RUU while the phone is booted/in Fastboot with a goldcard in. But I've had weird problems with RUUs. PB99IMG.zip method of unrooting can work even when battery is very low, does not need a connection to a pc at the time, and hence is a lot safer, since you wont brick your phone just because your power went off/computer crashed!

Note that Running an RUU=Flashing the PB99IMG.zip. They are the same thing, PB99IMG.zip is a zip file obtain by extracting the zip from an RUU exe file.

6.2 Can I use a Goldcard as my usual Sd-card?

You can, but it is better not to. A goldcard is your magic ring, a device to use if all else fails, an almost sure way of unbricking your phone. If you keep it in your phone all the time, you increase the chances of corruption. I advice you to keep your goldcard safe and secure someplace. Let's hope you don't need to use it, but if woe betide, you have to, then you can get your system back.

6.3 Is a goldcard destroyed when formatted or partitioned?

Definitely Not. Formatting does not write to the Sector 0 offsets used by a goldcard. Note however that defective partitioning or formatting can interfere with the ability of the Android system to "view" the files on the goldcard. The PB99IMG.zip may not work. But it can immediately be corrected by formatting the card to FAT32 and recreating the file.

6.4 Do I need to have the goldcard formatted by the phone?

Not really, though this has been recommended.

6.5 Can I use a goldcard from someone else?

Yes you may.
It is true that if someone else can read the CID of YOUR sd card (from his phone) and give it to you, with the CID code, you can make it a goldcard without a phone. Once you have a CID code, the other steps don't need a phone. Note that CID is unique to the card and not to the phone/region of the phone. You can have anyone anywhere read the CID code of his/card amd mail it to you. You can make it a goldcard without your phone. See also 6.6 below.

6.6 Can I create a Goldcard without a phone?

You can if you have Linux. You need a Laptop card reader slot and Linux. Once in Linux, navigate to a folder like /sys/block/mmcblk0/device/cid

I havent tested it out in a LiveCD. Check it out and tell me.

Programmers have tried writing applications to interface the sdcard in USB mode to get its CID number, but it needs a PCI slot or device-a phone-Either Android/Windows Mobile. A PC application may be specifically written for a PCI based card reader to read the CID, but such an application would be hardware specific for the particular brand of PCI card reader. You cant use it unless you are a programmer and know to do that. As far as I know there are currently no Windows programs that do that.

To clarify, Once again,

The only thing you need from your memory card to create a goldcard, is its unique CID number (which is inserted by the manufacturer of the card)

The CID is unique to a memory card. It is not specific to the device
You can get the CID of the sdcard from:

  • Any Android phone which can connect and use the adb command.
  • An Android phone with the GoldCard Helper market app.
  • A Linux operating system running on a Notebook with PCI slot which can read a memory card. Note: YOU CANNOT GET CID FROM LINUX FROM A USB CARD READER of a PC/Laptop. You need the PCI card slot.
  • You can even get the CID from a Garmin proprietory OS or a Windows mobile based phone. There are utilities available online using these, which can be seen in a Google search.
  • Do not try to get CID from any PC via USB cable. It can display a CID code but not the correct one. It is said that "USB lies about the CID".


6.7 I am not interested in Rooting/Debranding. Do I need to create a Goldcard?

No. Not until you you think of rooting it.

6.8 I have an unbranded device. Do I need a goldcard?

First, be 100% sure that yours is an unbranded device. Just because you bought it from HTC and because there is no branding does not mean you have an unbranded Desire. There may not be visible branding, but it may be branded with HTC.

In short, Create a goldcard whether you have a branded or unbranded Desire. You cant do harm by making a 1Gb (Any size greater than around 256 Mb) card a goldcard. But in case you inadvertently brick your system, a goldcard is the way you may get it back!

7. What if my device is not recognized in Recovery? (Cannot get adb in recovery)

It's a driver issue. You need to install a driver. First make sure that HTC Sync has been installed with all its drivers. Go to Computer, Rightclick and choose Properties>Device Manager. You can see an error code in one of the devices. Right Click it and choose Update Driver. Next, Choose, Choose from a list of Devices. Choose Android device. Windows gives a list of three drivers. Choose the one labelled adb interface. Windows says that the driver may not be compatible. Ignore and choose Ok. When you click Done, Unplug the usb cable and reconnect it. You can now get Adb in Recovery.

8. How to recover from an Alpharev Joker Loop (a.k.a How to Recover from a Corrupted Recovery/Boot)

I got a boot loop at the Alpharev Joker today while trying out Data2SD on my Desire. Basically, the Stock rooted Teppic rom was working fine for 15-20 reboots, then suddenly a lot of force closes happened. On rebooting, The Joker started to appear and disappear. In short, Boot was corrupted. I tried getting into Clockworkmod Recovery. It was corrupted too. I tried searching for an explanation. Got none.

The Solution:

Copied my Nandroid backup files (*.img) to Tools folder
Then,fastboot flash boot boot.img
fastboot reboot
It rebooted and got me into Android home, then promptly restarted..Which meant half the problem is over. Tried to get into recovery again, but Joker looped.
fastboot flash recovery recovery-clockwork-2.5.0.7-bravo.img

fastboot shutdown
fastboot reboot-bootloader
It worked! I got back my recovery

Alternately, try flashing either Clockworkmod or Amon-Ra recovery from Fastboot, and then install a Custom ROM

9. You said I can run PB99IMG.zip in Fastboot/Recovery by pressing a combination of keys, waiting for some time etc. What is actually happening?

When you press Vol- and Power, your device boots to Hboot and checks for certain system files in the root of your system, One of them is PB99IMG.zip, which is actually a part of the RUU which comes as a Windows executable file (exe). If PB99IMG.zip is found in the root of your sdcard, the system automatically checks it, and prompts you to use it to update your system. We know what the prompts are, and by asking you to wait for some time and press Vol, Power keys etc, we're walking you through the various prompts which you cannot see on your screen because the SLCD is bricked

10. My system was rooted and I then applied an OTA update. It's now giving me bootloops. What should I do?

Try the following:
Wipe the phone from Recovery menu.
Access recovery by pressing Vol- and Power button till system boots up.
Press Vol- to select Recovery, press Power button to choose recovery .
When the red triangle is shown, press Both Vol+ and Power button together.
Choose: Wipe data/factory reset, and then Choose: Reboot system.
If it still gives an error, you may need to apply an RUU.

FREQUENTLY ASKED QUESTIONS (FAQ) Continued..

11. How to unroot to my region's software if the only RUU available online is incompatible with my SLCD phone.

This is especially important for Indian Desire users. You can safely run any RUU>2.0 version. Below that, you need to confirm with those who have run it, whether its safe for SLCD. If you create a goldcard, though, you can get back to your manufacturer version of the software even after bricking it. Be careful here.

Method:

  1. Get the OTA update for your region. Save it to pc as "update.zip"
  2. Use an SLCD-unsupported RUU (supposing that only that version is available from your carrier). This will temporarily brick the phone.
  3. Put the OTA as update.zip in the root folder of sdcard,
  4. Use the key combinations for running the update.zip (without seeing anything on screen) from the Android recovery
  5. The OTA restores system to an SLCD-compatible Froyo version.


It's a bit tricky, but workable for those who dont have the proper RUUs

12. What do I do if my phone does not get detected by Windows?

You could try uninstalling all HTC Drivers (uninstall+delete) from Programs & Features in Win, and the Device manager. Then reboot pc, dc from internet and connect the phone. Your phone should get connected, but you should be prompted for driver install. If instead of getting prompted, you find that the driver gets automatically installed, you should manually repeat the above process to remove the drivers. Restart once again.

Now install HTC Sync once again, uninstall HTC Sync program alone (keeping the drivers and driver installation in place). Now connect phone in Recovery and Fastboot. The right drivers should now get installed. Format the sdcard as FAT32, try the Downgrade tool once again. This process should take care of any driver issues.

13. What is a USB Brick and how do I fix it?
Read this post by Rudolfje. The fix is here

14. What is True Bricking and "Semi-Bricking"?
Note that the term "Semi-Bricking" is a neologism. I use it to refer to the state of a phone where you are unable to restore it to a usable state either because of flashing an incompatible rom for an slcd phone leading to the phone being unusable, and further you cannot flash an RUU because a gold card is unavailable and a CID-appropriate RUU is unavailable

A true bricking means you are not able to reset it even with an RUU. This happens because of flashing an Radio incompatible for the SPL (Second Program Loader). So, remember: Don't flash a radio until you understand fully the process of flashing and it is absolutely essential. If you flash a radio meant for another device, your device is Bricked! You cant fix it yourself!

 


You are reading this post on Joel G Mathew’s tech blog. Joel's personal blog is the Eyrie, hosted here.