Author Topic: Guide to fix endless "FTL Restore " openiboot +linux loop  (Read 9351 times)

dario

  • Guest
Guide to fix endless "FTL Restore " openiboot +linux loop
« on: July 04, 2010, 02:55:48 PM »
Note: If this is the wrong section, fill free to move it

Are your stuck at this screen:

Code: [Select]
ftl: Found production format: 43303035
ftl: Successfully found FTL context block: 3679
ftl: Possible unclean shutdown, last FTL metadata type written was 0x4f
ftl: FTL_Open cannot load FTLCxt!
ftl: restore searching for latest FTL context...
ftl: restore found useable FTL context with usnDec = 0x2dfc8
ftl: Detected version 46560001 b9a9fffe
ftl: restore scanning virtual blocks 0 - 999
ftl: restore scanning virtual blocks 1000 - 1999
ftl: restore scanning virtual blocks 2000 - 2999
ftl: restore scanning virtual blocks 3000 - 3894
ftl: restore creating mapping table...
ftl: restore scanning logical blocks 0 - 999
ftl: restore scanning logical blocks 1000 - 1999
ftl: restore scanning logical blocks 2000 - 2999
ftl: restore scanning logical blocks 3000 - 3871
ftl: restore determing free vbs...
ftl: restore wNumOfFreeVb = 6, number of log vbs = 14
ftl: restore -- log 0, wLbn = 0, wVbn = 269, pagesUsed = 1, pagesCurrent = 1, isSequential = 0
ftl: restore -- log 1, wLbn = 250, wVbn = 3606, pagesUsed = 357, pagesCurrent = 8, isSequential = 0
ftl: restore -- log 2, wLbn = 252, wVbn = 3751, pagesUsed = 383, pagesCurrent = 151, isSequential = 0
ftl: restore -- log 3, wLbn = 253, wVbn = 471, pagesUsed = 414, pagesCurrent = 181, isSequential = 0
ftl: restore -- log 4, wLbn = 300, wVbn = 373, pagesUsed = 377, pagesCurrent = 84, isSequential = 0
ftl: restore -- log 5, wLbn = 301, wVbn = 449, pagesUsed = 166, pagesCurrent = 16, isSequential = 0
ftl: restore -- log 6, wLbn = 303, wVbn = 512, pagesUsed = 397, pagesCurrent = 290, isSequential = 0
ftl: restore -- log 7, wLbn = 304, wVbn = 3843, pagesUsed = 465, pagesCurrent = 405, isSequential = 0
ftl: restore -- log 8, wLbn = 338, wVbn = 3740, pagesUsed = 96, pagesCurrent = 60, isSequential = 0
ftl: restore -- log 9, wLbn = 339, wVbn = 329, pagesUsed = 343, pagesCurrent = 274, isSequential = 0
ftl: restore -- log 10, wLbn = 340, wVbn = 3658, pagesUsed = 39, pagesCurrent = 39, isSequential = 0
ftl: restore -- log 11, wLbn = 341, wVbn = 3779, pagesUsed = 75, pagesCurrent = 74, isSequential = 0
ftl: restore -- log 12, wLbn = 382, wVbn = 3590, pagesUsed = 3, pagesCurrent = 3, isSequential = 0
ftl: restore -- log 13, wLbn = 518, wVbn = 519, pagesUsed = 19, pagesCurrent = 11, isSequential = 0
ftl: restore successful!

Is it repeating it in linux? Do you want to throw your iPhone on the wall to see if you can break the wall?

Here is a guide to fix it (I found the solution buried in help thread but im writing a guide as it was a bit hard to find it)

Abstract:
It must be due to a bug in the ftl context search routing, but I don't seem to be able to find it out as that code is equivalent to ancient aramaic XD
You can see that the ftl context block is always the same, and the routine is not able to save the restore, as it always start restoring the same block number...

So lets find a workaround. when you shutdown uncleanly the iphone, the ftl is not in sync, so we must restore it. if you have a new iphone or freshly restored it, your NAND is clear: you have to mark all block for worn out cells (yes, the more you use your iphone, the more you waste your nand.... don't worry thats normal, you can write around 1 milion times the same cell: the ftl is there to balance the writings so u write always different memory location and it will live long XD)
To mark the blocks you simply write them, the ftl will mark the worn out block "unusable" and will never check it again (unless you restore the phone again). if you don't, checking the ftl will take LONG! on my 8GB it takes 20 mins, on 16GB it takes 40 mins. after filling your nand, it takes a couple of seconds

Whatever you do this or not, if you dont COMPLETELY fill out your nand, you can miss the ftl context block, and for some reason, that "special" block could have a problem (maybe its worn out?).

Workaround:

Boot iOS, scp this script:

Code: [Select]
#!/bin/sh

[ -e /private/deletemeafterandroidboot ] && rm -rf /private/deletemeafterandroidboot
[ -e /private/var/deletemeafterandroidboot ] && rm -rf /private/var/deletemeafterandroidboot
mkdir /private/deletemeafterandroidboot
mkdir /private/var/deletemeafterandroidboot

let i=0

echo "Starting to fill first partition.... (this wont take much)"

while [ $? -eq 0 ];  do
let i=i+1
cp -uv /private/var/zImage /private/deletemeafterandroidboot/zImage${i}
done

echo "Starting to fill second partition.... (this will take much lol)"

while [ $? -eq 0 ];  do
let i=i+1
cp -uv /private/var/zImage /private/var/deletemeafterandroidboot/zImage${i}
done

echo "All done, forcing fsck and rebooting, bye bye =)"
fsck
reboot

execute it and wait forever for the autoreboot (if i didnt mess the script, i didnt wait forever to test the last 2 lines, lol)
Now boot into android.

Notice:
Be warned that you have to manually delete /private/deletemeafterandroidboot and
/private/var/deletemeafterandroidboot

those 2 directory completely fill your iphone (which was our pourpose)

Cheers
Dario Russo

Offline shyboy

  • Member
  • Posts: 38
  • Karma: +0/-0
    • View Profile
Re: Guide to fix endless "FTL Restore " openiboot +linux loop
« Reply #1 on: September 29, 2010, 08:24:49 PM »
Any easy way to do that????
means boot into IOS connect to ubuntu type this code into terminal :o :o :o :o :o

Offline shyboy

  • Member
  • Posts: 38
  • Karma: +0/-0
    • View Profile
Re: Guide to fix endless "FTL Restore " openiboot +linux loop
« Reply #2 on: October 04, 2010, 02:45:38 PM »
any help about this topic.... :-\

Offline nickp666

  • Administrator
  • Member
  • *****
  • Posts: 689
  • Karma: +45/-0
    • View Profile
    • http://www.nickpack.com
  • iDevice: Various
  • iDroid Version: Latest
  • Jailbreak: Various
Re: Guide to fix endless "FTL Restore " openiboot +linux loop
« Reply #3 on: October 05, 2010, 02:13:53 PM »
Just updating darios script with the new kernel path:
Code: [Select]
#!/bin/sh

[ -e /private/deletemeafterandroidboot ] && rm -rf /private/deletemeafterandroidboot
[ -e /private/var/deletemeafterandroidboot ] && rm -rf /private/var/deletemeafterandroidboot
mkdir /private/deletemeafterandroidboot
mkdir /private/var/deletemeafterandroidboot

let i=0

echo "Starting to fill first partition.... (this wont take much)"

while [ $? -eq 0 ];  do
let i=i+1
cp -uv /private/var/idroid/zImage /private/deletemeafterandroidboot/zImage${i}
done

echo "Starting to fill second partition.... (this will take much lol)"

while [ $? -eq 0 ];  do
let i=i+1
cp -uv /private/var/idroid/zImage /private/var/deletemeafterandroidboot/zImage${i}
done

echo "All done, forcing fsck and rebooting, bye bye =)"
fsck
reboot

Offline Vances

  • Member
  • Posts: 23
  • Karma: +0/-0
    • View Profile
Re: Guide to fix endless "FTL Restore " openiboot +linux loop
« Reply #4 on: October 10, 2010, 05:44:59 PM »
How to do that? i try to do this, but still have problem. Also I try to reflash my iOS but still not change :-[

Offline formigator

  • Member
  • Posts: 1
  • Karma: +0/-0
    • View Profile
  • iDevice: iphone 2g 3.1.2
  • Jailbreak: redsn0w
Re: Guide to fix endless "FTL Restore " openiboot +linux loop
« Reply #5 on: November 02, 2010, 03:55:21 PM »
Thanks Dario, you've  saved my day, it works perfect!!

Thank you man

Offline dblandin

  • Member
  • Posts: 1
  • Karma: +0/-0
    • View Profile
  • iDevice: iPhone 4S / iPhone 3G
  • iDroid Version: Spamophzki 1.0.3
  • Jailbreak: PwnageTool
Re: Guide to fix endless "FTL Restore " openiboot +linux loop
« Reply #6 on: February 25, 2012, 02:55:18 PM »
Worked perfectly! Thanks so much for the script!

Just to clarify for process for others who may not be as familiar with the unix command line (although you all probably are if you're on this forum...):

1. Save Nick's script below as a new .sh file (script.sh is fine) within your home directory (/Users/YourUserName) using your favorite text editor (TextEdit is fine but make sure you save as Plain Text, not Rich Text Format).

Code: [Select]
#!/bin/sh

[ -e /private/deletemeafterandroidboot ] && rm -rf /private/deletemeafterandroidboot
[ -e /private/var/deletemeafterandroidboot ] && rm -rf /private/var/deletemeafterandroidboot
mkdir /private/deletemeafterandroidboot
mkdir /private/var/deletemeafterandroidboot

let i=0

echo "Starting to fill first partition.... (this wont take much)"

while [ $? -eq 0 ];  do
let i=i+1
cp -uv /private/var/idroid/zImage /private/deletemeafterandroidboot/zImage${i}
done

echo "Starting to fill second partition.... (this will take much lol)"

while [ $? -eq 0 ];  do
let i=i+1
cp -uv /private/var/idroid/zImage /private/var/deletemeafterandroidboot/zImage${i}
done

echo "All done, forcing fsck and rebooting, bye bye =)"
fsck
reboot

2. Open up a shell (Terminal on OSX is fine).
3. Install OpenSHH via Cydia on your iPhone if it is not already installed, make sure that it's enabled (usually is unless you've toggled it off), and connect your computer and iPhone to the same network.
4. Determine iPhone's IP address in Settings -> WiFI -> Your Network or SBSettings
5. Run following terminal commands (default iPhone root password is 'alpine' *you should change this sometime*)

Code: [Select]
scp ~/script.sh root@iPhoneIPAddress:~/
ssh root@192.168.15.12
chmod +x ~/script.sh
./script.sh

* This copy's the script.sh file from your local user's home directory to the iPhone's root home directory, opens up a secure shell to the iPhone logged in as root, changes the permissions for the script.sh file to allow execution, and finally executes the script.
6. Let the script run its course
7. Boot back into iOS
8. Open up Terminal again.
9. Run the following terminal commands to cleanup after the script (again, default iPhone root password is 'alpine')

Code: [Select]
ssh root@192.168.15.12
rm -r /private/var/deletemeafterandroidboot
rm -r /private/deletemeafterandroidboot

10. Power down and iPhone and restart into Android

Done.