yashsingh1/xdaforums huggingface dataset:
[HTC Sensation] trevd:
hi again.

After reading some more e2fsck need some extra options. apologises for that :o

Also as is usually the case with these things you're not the first person to have this problem. A quick xda search for "The needs_recovery flag is set" brings up this post

I've just tested it because my cache partition has the needs_recovery flag set so I ran the commands in that post in recovery and it did clear the needs_recovery flag. so in your case you need to boot into recovery make sure /system is NOT mount which should be the default state and run the following commands

adb shell
tune2fs -l /dev/block/mmcblk0p22 | grep features

this command get the list of filesystem features it should look something like this ( order may be different )

Filesystem features: has_journal resize_inode filetype needs_recovery extent sparse_super large_file

Next we'll run e2fsck with the right command this time :rolleyes: LOL

e2fsck -f /dev/block/mmcblk0p22

After that we can remove the old journal with tune2fs

tune2fs -O ^has_journal -c 1 -i 1d -m 0 /dev/block/mmcblk0p22

This should remove both the has_journal and needs_recovery flags from the feature list. Seeing as has_journal was set we'll turn it back on

tune2fs -O has_journal -c 1 -i 1d -m 0 /dev/block/mmcblk0p22

Note the caret symbol ( ^ ) which is the difference between the above to commands. This controls whether a feature should be added or removed

Finally check the feature list again

tune2fs -l /dev/block/mmcblk0p22 | grep features

It should now look like this or something similar, If it still has needs_recovery in the list then something is wrong

Filesystem features: has_journal resize_inode filetype extent sparse_super large_file

All we need to do now is pray to the ghost of steve jobs and say the magic words :)

reboot

And hopefully we might have a win for you! :good:
[HTC Sensation] amitshkuri:
when i write this line: e2fsck -f /dev/block/mmcblk0p22

i get this: Pass 1: Checking inodes, blocks, and sizes

Inodes that were part of a corrupted orphan linked list found. Fix<y>?

if i press "y" i get this: Inode 13765 is in use, but has dtime set. Fix<y>?

and more and more and more questions and cant continue with the next lines you gave me.

what to do?
[HTC Sensation] trevd:
e2fsck -f -y /dev/block/mmcblk0p22

That will answer yes to all questions!
[HTC Sensation] amitshkuri:
i did all exactly and still in a bootloop..

i got Filesystem features: has_journal resize_inode filetype extent sparse_super large_file

without the needs recovery, all went well.

is there hope? :(
[HTC Sensation] trevd:
Time to rinse and repeat, Grab the dmesg and the logcat and lets see what it's saying now? Also Have you tried reflashing the rom, it's possible the tune2fs has deleted some files but we can only find out by looking at the logs!
[HTC Sensation] amitshkuri:
i tried now to reflashed and still bootloop :/

i attached the new demsg and logcat.

thank you for all the help!
[HTC Sensation] trevd:
Not a problem on the help. At least you bought an interesting problem to solve :D It's not your normal bootloop cause. :D

hmmm , It seems to have gone back to needs recovery.... Ok. Can you run the command from earlier but this time do not re-add the journal feature, so these commands

tune2fs -l /dev/block/mmcblk0p22 | grep features
e2fsck -f -y -v /dev/block/mmcblk0p22
tune2fs -O ^has_journal -c 1 -i 1d -m 0 /dev/block/mmcblk0p22
tune2fs -l /dev/block/mmcblk0p22 | grep features

#EDIT Mount as read only to mark it ready for mounting
mount -ro -text4 /dev/block/mmcblk0p22 /system
reboot

can you copy the output of these commands and post them up, I'm just curious to see what its runnning.

Do you know how to make your boot image insecure and how to mount /system with rw by default?

If not can you send me the boot image you're using an i'll fix it up.

The plan is to attempt the fs repair and remove journaling which from what I understand can be responsible for triggering the needs_recovery. should that not work, the kernel will try running recovery on the fs at boot time but this time it won't need to remount the /system partition because it will be already mounted as rw ... that's the theory at least. :D

If it fails send the logs and we'll have a look a some other options depending on the log out. But I wouldn't be worried there's still a couple of more things we can leverage to fixup the system partition.
[HTC Sensation] amitshkuri:
i dont know how to make my boot image insecure and how to mount /system with rw by default. tell me how and i will!

and how i send you the boot.img? where i can find it?

i attached the logs.
[HTC Sensation] trevd:
Thanks, to make a boot image insecure you need to unpack the ramdisk and change the defualt.prop

ro.secure=0
ro.debuggable=1

in the init.rc

change the mount point for /system to be rw and the comment out the remount of rootfs. However before that, I spotted this in the e2fsck script

e2fsck: Invalid argument passed to ext2 library while rewriting block and inode bitmaps for /dev/block/mmcblk0p22

which is not very good. so can you run the commands again including the tune2fs ones but this time we will add collection of badblocks to e2fsck

e2fsck -f -y -v -c /dev/block/mmcblk0p22

Usual thing , Run it grab the logs. what rom are you running? I'll flash it to my phone.
[HTC Sensation] amitshkuri:
i am running vipers 1.6.3

i ran the commands again and add the extra to e2fsck and still got the same

"Invalid argument passed to ext2 library while rewriting block and inode bitmaps for /dev/block/mmcblk0p22" line.

and sorry of my Ignorance but i have no idea how to do what you said. unpack the radmisk? init.rc? where i can find these fils?
[HTC Sensation] trevd:
Ok, try e2fsck without the -v and -f , Don't worry about the boot image. I'll download the rom and Install it. I want to check the this recovery trigger isn't something the rom itself is doing.
[HTC Sensation] amitshkuri:
still the "Invalid argument..." and im pretty sure it isn't the rom because i had the same bootloop with ARHD and even with RUU..
[HTC Sensation] trevd:
hmmmmm , The error is a concern, What version of recovery are you using? and one last try on the e2fsck, using auto repair

e2fsck -fpcv /dev/block/mmcblk0p24

can you post the stats that come out of this. no need for tune2fs this time unless needs_recovery has been set for whatever reason.
[HTC Sensation] amitshkuri:
still the same error.

tune2fs -l /dev/block/mmcblk0p22 | grep features
Filesystem features: resize_inode filetype extent sparse_super large_file
~ # e2fsck -fpcv /dev/block/mmcblk0p22
e2fsck -fpcv /dev/block/mmcblk0p22
/dev/block/mmcblk0p22: Updating bad block inode.

2131 inodes used (4.16%)
25 non-contiguous files (1.2%)
3 non-contiguous directories (0.1%)
# of inodes with ind/dind/tind blocks: 89/90/90
Extent depth histogram: 1705
144101 blocks used (70.36%)
0 bad blocks
0 large files

1639 regular files
66 directories
52 character device files
46 block device files
23 fifos
0 links
281 symbolic links (281 fast symbolic links)
15 sockets
--------
2122 files
e2fsck: Invalid argument passed to ext2 library while rewriting block and inode bitmaps for /dev/block/mmcblk0p22
~ #

and i have 4ext recovery v1.0.0.5 rc5

you can see all my sensation story at the beginning of the thread.

the bootloop start suddenly after the device were off for one month
[HTC Sensation] trevd:
I've managed to recreate the e2fsck error condition on my sensation and basically I've been having a play around with a couple of things.

a strange thing is you have a lot less files than I do in your system.

Try rebooting now and see what happens. If that still bootloops we can use parted to remove the partition completely and recreate it as an ext2 partition. then after a couple of auto reboot cycles which recovery did automatically you can re-install the team viper rom with no wipe option.

I've just done this on mine and It's booted okay. I'll explain the parted command should the need arise.
[HTC Sensation] amitshkuri:
ok! it still bootloop, but every time i installed a rom i did a full wipe.

tell me how to remove the partition and create the ex2 partition! i'm excited :)
[HTC Sensation] trevd:
Did you look at the logs, it could well be a different type of boot loop

A full wipe is normally a recursive delete precisely for the reasons I'm about to point out

Although this should be perfectly safe. Using any tools like parted comes with it's risk if your not fully concentrating and I've learnt that the hard way.

That being said there is a bit of a safety net with the sensation because it has overlapping partitions which parted can't handle in full so we have to work on a single partition at a time meaning you can't format your entire internal memory in one keystroke bootloaders and all with one keypress.

adb shell
parted /dev/block/mmcblk0p22
print list

You should see something like this

Model: Unknown (unknown)
Disk /dev/block/mmcblk0p22: 839MB
Sector size (logical/physical): 512B/512B
Partition Table: loop

Number Start End Size File system Flags
1 0.00B 839MB 839MB ext4

Note the End Value , In our case 839MB we will use that next to recreate the partition

rm 1
mkpartfs ext2 0B 839MB

After this has completed you should see this message, press "i" to ignore it

Error: Error informing the kernel about modifications to partition
/dev/block/mmcblk0p22p1 -- Invalid argument. This means Linux won't know about
any changes you made to /dev/block/mmcblk0p22p1 until you reboot -- so you
shouldn't mount it or use it in any way before rebooting.
Ignore/Cancel?

finally quit partedand reboot back into recovery

quit
reboot recovery

Now you can install the rom with NO WIPE. After that. if it's Still bootlooping can you post me logs on this one and I'll say the Ideas are starting to thin out.

It'll still be totally possible to get the device to boot, even if you end up using a partitioned removal SDCard which I've done with a couple of devices before today
[HTC Sensation] amitshkuri:
it says my file system flags is ext 2. continue?

Model: Unknown (unknown)
Disk /dev/block/mmcblk0p22: 839MB
Sector size (logical/physical): 512B/512B
Partition Table: loop

Number Start End Size File system Flags
1 0.00B 839MB 839MB ext2
[HTC Sensation] trevd:
hmmm, That's interesting, Yes continue, we will at least be working with a fresh partition then.
[HTC Sensation] amitshkuri:
ok i wrote all and we still in bootloop. after i wrote "quit" i got "Information: You may need to update /etc/fstab."
[HTC Sensation] trevd:
Logs? I need to know whether it's still the same error?
[HTC Sensation] amitshkuri:
logs attached

maybe the problem is my firmware? or my hboot?

i had hboot- 1.27.0000 with stock recovery and s-off after i installed RUU.

then i flashed 4 ext recovery and firmware 3.33 and on the top of the bootloader it says "firmware 3.33" .

then i flashed to hboot 1.29.0000 because stock hboot and s-off not go well together and now on the top of the bootloader it says ***UNLOCKED***.

Maybe it's related? I'm just throwing ideas..
[HTC Sensation] trevd:
I don't think so but going by the circle that we seem to be going round in WTF do I know? :laugh:

I'm more concerned about the init.d file /system/etc/init.d/40ext4tweaks which is running tune2fs and resetting the has journal flag and basically undoing everything we did to the filesystems in recovery mode. So i'd try removing that file and then doing the stuff from earlier to remove the recovery flag ( tune2fs chk2fs etc)

And If that doesn't work I'm afraid I'll admit defeat because It's hurting my brain!! :eek:
[HTC Sensation] amitshkuri:
i knew this is a serious bootloop... can it be a hardware problem?
[HTC Sensation] ganeshp:
im lil late to the issue but ive seen something which mostly troubles soff users

HTC dev unlock dont go well with SOFF

so i suggest you to relock your bootloader then flash a patched hboot like juopunutbear/revolutionary

relock command

fastboot oem relock

then for flashing patched hboot ..you can get it from firmware thread by kohr-ah in sensation development section

first post -> at the end -> hbot patch from 1.29.0000 to 1.27.1100

get that and then flash the firmare

then reflash the rom and see

if this didnt solved the issue then "trevd" to the rescue again :)

EDIT:

btw the earlier hboot you have which says "firmware 3.33" is indeed patched hboot and its not stock hboot
[HTC Sensation] amitshkuri:
ok i did this now i have:

-revolutionary-

PYRAMID PVT SHIP S-OFF RL

HBOOT-1.27.1100

RADIO-11.24A.3504.31_M

OpenADSP-v05.6.0.2226.00.0418

eMMC-boot

i flashed the rom again with full wipe and still bootloop. i checked the logs still the

107): The needs_recovery flag is set. Please run e2fsck before clearing

107): the has_journal flag.

:(

***EDIT***

ok i forgot to flash the firmware after i flashed the patch!

i did this from the beginning and still in bootloop but i think the logs are different.

i attached the logs hope you can help me!
[HTC Sensation] amitshkuri:
any one? is my phone brick? please help.. i will try all, Ruu,s-on, any thing!
[HTC Sensation] malybru:
Hi,

Now that your hboot is back to "Revolutionary",it may be worth trying to run a RUU again.

:)
[HTC Sensation] amitshkuri:
after i flashed the firmware my hboot is "firmware 3.33" .
[HTC Sensation] DennisBold:
Try:

adb reboot bootloader
fastboot erase system
fastboot erase userdata
fastboot erase boot
fastboot erase recovery

Then attempt to flash a Gingerbread RUU while still in Fastboot.

This will only work on an S-OFF, Unlocked bootloader.
[HTC Sensation] amitshkuri:
im super cid so i can run any RUU right?
[HTC Sensation] ganeshp:
yes but of same device though

like sensation normal pyramid RUU

if XE then RUU has "LE" in its name
[HTC Sensation] amitshkuri:
one more question before i do it. now my bootloader is relocked, and you said its not good to unlock with htc dev when i s-off. so how to unlock ?
[HTC Sensation] malybru:
Hi,

Look HERE

Second post:

HBoot 1.27.1100 Patch (Go from Hboot 1.29.0000 to 1.27.1100)

:)
[HTC Sensation] amitshkuri:
i dont understand this! why after i erased system, user data, boot and recovery and ran a new clean RUU im still in this bootloop?!

what i do wrong?
[HTC Sensation] DennisBold:
Nothing. Best guess is there's something wrong with the EMMC NAND or boot image*, but we can keep on trying.

Copy the ROM, PG58IMG (http://d-h.st/SuC) and 4EXT (Attached, extract recovery.img) to the folder with ADB.

fastboot oem rebootruu
fastboot format system
fastboot format recovery
fastboot format boot
fastboot flash PG58IMG.zip
fastboot flash recovery recovery.img
fastboot flash ROM.zip
fastboot erase cache
fastboot reboot-bootloader
[HTC Sensation] amitshkuri:
what ROM to copy?
[HTC Sensation] DennisBold:
Any ROM will do. Why not try a CM10 ROM?
[HTC Sensation] amitshkuri:
i get "INFO[ERR] Command error !!!" in the first command.

maybe because my boot is locked now?
[HTC Sensation] DennisBold:
RUUs use the same method to flash a new ROM and HBOOT. It may be case sensitive.

Try; fastboot oem rebootRUU

If that doesn't work, flash a recovery (fastboot flash recovery recovery.img) and format all partitions using the recovery.
[HTC Sensation] amitshkuri:
ok the white htc logo showed up. now "format system" give this:

usage: fastboot [ <option> ] <command>

commands:

update <filename> reflash device from update.zip

flashall flash boot + recovery + system

flash <partition> [ <filename> ] write a file to a flash partition

erase <partition> erase a flash partition

getvar <variable> display a bootloader variable

boot <kernel> [ <ramdisk> ] download and boot kernel

flash:raw boot <kernel> [ <ramdisk> ] create bootimage and flash it

devices list all connected devices

reboot reboot device normally

reboot-bootloader reboot device into bootloader

options:

-w erase userdata and cache

-s <serial number> specify device serial number

-p <product> specify product name

-c <cmdline> override kernel commandline

-i <vendor id> specify a custom USB vendor id

-b <base_addr> specify a custom kernel base address

-n <page size> specify the nand page size. default: 2048
[HTC Sensation] DennisBold:
I'm getting my commands mixed up. :rolleyes:

Ignore the format commands (and there is a chance that changes need to be made to the ROM .ZIP file to make it flash from fastboot, so ignore any errors if it happens) Once done, boot up into 4EXT and format all partitions again as 4EXT will complain that it can't access 'system'. Then flash your chosen ROM again.
[HTC Sensation] amitshkuri:
CM 10.1 boots up!!!!!

but after a few secconds its freezing for about 15 secconds and reboot.. :/
[HTC Sensation] DennisBold:
Logcat and DMESG please?
[HTC Sensation] amitshkuri:
dmesg get "device not found"

logcat- "waiting for device"

when the phone boots up it showed the choose lang menu and if i not press start its not freeze. when i press start its freezing and reboot

*edit*

i got some errors when i wrote the commands you gave me before. maybe i need to flash hboot,recovery,rom again?
[HTC Sensation] DennisBold:
Opps. My fault. ADB needs to be setup from within CM10s developer options. Remember to update HBOOT (if I forgot to mention that)

Try another modified stock sense based ROM, perhaps ARHD?

Format all partitions in 4EXT before flashing.

Paste the errors if you have them.
[HTC Sensation] amitshkuri:
oh! i was sure it going to boot now.

i tried Vipers 1.6.3 and it never went so far with the animation boot. its freezing for few secconds on animation and restart
[HTC Sensation] DennisBold:
Let's hope so.
[HTC Sensation] amitshkuri:
no.. stuck in animation boot and reboot again :(
[HTC Sensation] DennisBold:
DMESG or a logcat?
[HTC Sensation] amitshkuri:
logcat doesnt work:

adb server is out of date. killing...

ADB server didn't ACK

* failed to start daemon *

error:

same message again and again.

dmesg attached.
[HTC Sensation] DennisBold:
Can you reboot into recovery and mount /system?

Try installing this ROM: http://xdaforums.com/showthread.php?t=1098849

Also, what error is ADB giving you?
[HTC Sensation] amitshkuri:
ok i did it. now what? reboot?

**edit**

this error:

* daemon not running. starting it now on port 5037 *

* daemon started successfully *

** daemon still not running- waiting for device -

adb server is out of date. killing...

* daemon started successfully *

** daemon still not runningerror: cannot connect to daemon

adb server is out of date. killing...

* daemon started successfully *

** daemon still not running- waiting for device -

adb server is out of date. killing...

* daemon started successfully *

error: protocol fault (no status)

* daemon not running. starting it now on port 5037 *

* daemon started successfully *

** daemon still not running- waiting for device -

adb server is out of date. killing...

* daemon started successfully *

** daemon still not runningerror: cannot connect to daemon

adb server is out of date. killing...

* daemon started successfully *

** daemon still not running- waiting for device -

adb server is out of date. killing...

* daemon started successfully *

and again and again. ok i will try
[HTC Sensation] DennisBold:
I wanted to check if you had any problems mounting it.

I missed a line in DMESG.

<3>[ 1.947357] mmc0: No card detect facilities available

Reboot and in ADB:

mke2fs /dev/block/mmcblk0p22
mke2fs /dev/block/mmcblk0p23
mke2fs /dev/block/mmcblk0p24
mke2fs /dev/block/mmcblk0p28

Let me know the response.

If you still can't get into ADB, flash an RUU.
[HTC Sensation] amitshkuri:
adb shell mke2fs /dev/block/mmcblk0p22
adb server is out of date. killing...
* daemon started successfully *
mke2fs 1.41.12 (17-May-2010)
Filesystem label=
OS type: Linux
Block size=4096 (log=2)
Fragment size=4096 (log=2)
Stride=0 blocks, Stripe width=0 blocks
51296 inodes, 204799 blocks
10239 blocks (5.00%) reserved for the super user
First data block=0
Maximum filesystem blocks=209715200
7 block groups
32768 blocks per group, 32768 fragments per group
7328 inodes per group
Superblock backups stored on blocks:
32768, 98304, 163840

Writing inode tables: done
Writing superblocks and filesystem accounting information: done

This filesystem will be automatically checked every 26 mounts or
180 days, whichever comes first. Use tune2fs -c or -i to override.

adb shell mke2fs /dev/block/mmcblk0p23
mke2fs 1.41.12 (17-May-2010)
Filesystem label=
OS type: Linux
Block size=4096 (log=2)
Fragment size=4096 (log=2)
Stride=0 blocks, Stripe width=0 blocks
76480 inodes, 305852 blocks
15292 blocks (5.00%) reserved for the super user
First data block=0
Maximum filesystem blocks=314572800
10 block groups
32768 blocks per group, 32768 fragments per group
7648 inodes per group
Superblock backups stored on blocks:
32768, 98304, 163840, 229376, 294912

Writing inode tables: done
Writing superblocks and filesystem accounting information: done

This filesystem will be automatically checked every 26 mounts or
180 days, whichever comes first. Use tune2fs -c or -i to override.

adb shell mke2fs /dev/block/mmcblk0p24
mke2fs 1.41.12 (17-May-2010)
/dev/block/mmcblk0p24 is apparently in use by the system; will not make a filesystem here!

adb shell mke2fs /dev/block/mmcblk0p28
mke2fs 1.41.12 (17-May-2010)
Filesystem label=
OS type: Linux
Block size=1024 (log=0)
Fragment size=1024 (log=0)
Stride=0 blocks, Stripe width=0 blocks
5136 inodes, 20480 blocks
1024 blocks (5.00%) reserved for the super user
First data block=1
Maximum filesystem blocks=20971520
3 block groups
8192 blocks per group, 8192 fragments per group
1712 inodes per group
Superblock backups stored on blocks:
8193

Writing inode tables: done
Writing superblocks and filesystem accounting information: done

This filesystem will be automatically checked every 33 mounts or
180 days, whichever comes first. Use tune2fs -c or -i to override.

it says "/mmcblk0p24 is apparently in use by the system"
[HTC Sensation] DennisBold:
OK, that's the /cache partition.

umount /cache
mke2fs -j /dev/block/mmcblk0p24
e2fsck /dev/block/mmcblk0p24
e2fsck /dev/block/mmcblk0p24 -f

Let me know the output.
[HTC Sensation] amitshkuri:
sorry my mistake

*edit*

>adb shell umount /cache

umount: can't umount /cache: Invalid argument
[HTC Sensation] DennisBold:
No mistake, I figure I might as well tell you what's going on, well sort of. I'm bad at explaining.
[HTC Sensation] amitshkuri:
it's ok. thank you for helping :)

umount /cache not work.

>adb shell umount /cache

umount: can't umount /cache: Invalid argument
[HTC Sensation] DennisBold:
Try:

unmount /dev/block/mmcblk0p24
[HTC Sensation] amitshkuri:
its umount or unmount?

>adb shell unmount /dev/block/mmcblk0p24

/sbin/sh: unmount: not found

>adb shell umount /dev/block/mmcblk0p24

umount: can't umount /dev/block/mmcblk0p24: Invalid argument
[HTC Sensation] DennisBold:
Try

umount -f /cache
mke2fs -j /dev/block/mmcblk0p24
[HTC Sensation] amitshkuri:
still:

adb shell umount -f /cache

umount: can't forcibly umount /cache: Invalid argument
[HTC Sensation] DennisBold:
I'm going to say /cache isn't mounted then.

Let's try:

mke2fs -j /dev/block/mmcblk0p24
[HTC Sensation] amitshkuri:
ok this is the output:

adb shell mke2fs -J /dev/block/mmcblk0p24

Bad journal options specified.

Journal options are separated by commas, and may take an argument which
is set off by an equals ('=') sign.

Valid journal options are:
size=<journal size in megabytes>
device=<journal device>

The journal size must be between 1024 and 10240000 filesystem blocks.
[HTC Sensation] DennisBold:
Try lowercase:

mke2fs -j /dev/block/mmcblk0p24

or

mke2fs /dev/block/mmcblk0p24