Jump to content

Welcome to CyanogenMod

Welcome to our forum. Like most online communities you must register to post, but don't worry this is a simple free process that requires minimal information for you to signup. Be a part of the CyanogenMod Forum by signing in or creating an account. You can even sign in with your Facebook or Twitter account.
  • Start new topics and reply to others
  • Subscribe to topics and forums to get automatic updates
  • Get your own profile and make new friends
  • Download files attached to the forum.
  • Customize your experience here
  • Share your CyanogenMod experience!
Guest Message by DevFuse
 

Recover apps2ext - Get 'em back! (script)


  • Please log in to reply
54 replies to this topic

#1 -Stevo-

-Stevo-
  • Members
  • 1297 posts
  • LocationSalt Lake City, Utah
  • Country:us
  • Device Model:HTC Vision G2
  • MOD Version:CM7.0.0-RCX
  • Recovery Image:ClockworkMod

Posted 12 July 2010 - 11:10 PM

Upgraded to cm6 and lost all of your apps on your ext partition?

I put together a little script to run once you've upgraded to cm6 that will recover your apps from ext and install them to the new froyo apps2sd implementation.


For some reason i can't upload it to CM forums at the moment so here are the external links:

http://goaruna.com/cqr3
-or-
http://www.mediafire...yzkzzz2givmhzmm

UPDATED WITH A SMALL CHANGE added -r to the install portion to reinstall instead of just failing due to a duplicate being found, to test it i reinstalled 5.0.8 and moved ALL of my apps to the ext partition. i rebooted into recovery, flashed cm6, gapps, recoverext2-signed, etc.. and once booted i ran the script. all 56 apps installed to the froyofat folder and all of my apps are in good working order.

If when installing you see errors about certificates, this means the apk was most likely not signed correctly. resign the app and install it manually.

I didn't get any container errors, but i suspect that is because it was run from a fresh cm6 install and i hadnt messed with the application settings yet.

after flashing from recovery REBOOT and run TERMINAL and type the command
recoverext

DO NOT RUN WHILE YOU ARE MOUNTED TO YOUR PC

THIS CAN TAKE ANYWHERE FROM 5 to 20 MINUTES IF YOU HAVE A $#@%LOAD OF APPS.

Make sure in CyanogenMod Settings you have the application install path as automatic or external.

Depending on the number of apps you have this can take Quite a while, be patient.


I dont use apps2sd when i tested this it was only about ten apk's and one .zip file that was there. if you have no zips, disregard the error at the end of the script.

EDIT: tested with about 50 apps, worked just fine.

Problems? Issues? let me know, like i said i don't extensively use apps2sd so my testing of this was limited.

don't want to download and flash? then copy this script into a text file and sh it from terminal.

#!/system/bin/sh
#RecoverExt by Stevo
#mount ext on /sd-ext
echo "Preparing ext partition.."
mount -o remount,rw /
mkdir /sd-ext
mount /dev/block/mmcblk0p2 /sd-ext
echo "Done"
#install apks to external storage
echo "Installing apk files to SD card (this may take several minutes)"
for I in /sd-ext/app/*.apk; do pm install -s -r $I; done
for I in /sd-ext/app/*.zip; do pm install -s -r $I; done
#unmount ext partition
umount /dev/block/mmcblk0p2
#remove ext mount folder
rm -rf /sd-ext/
mount -o remount,ro /
echo "Done."

thanks Vaevictus for asking about apps2sd and giving me the idea/helping with the scripting. unmounting and removal of sd-ext "to not confuse the noobs" suggested by Loonacy

#2 Andrew Low

Andrew Low
  • Members
  • 126 posts
  • Twitter:andrew_low
  • Country:ca
  • Device Model:Samsung Galaxy S i9000m
  • MOD Version:7.1
  • Recovery Image:ClockworkMod

Posted 13 July 2010 - 12:46 AM

Seems to have worked well. Saved me a huge amount of reinstall via the Market.  +1

#3 Andrew Low

Andrew Low
  • Members
  • 126 posts
  • Twitter:andrew_low
  • Country:ca
  • Device Model:Samsung Galaxy S i9000m
  • MOD Version:7.1
  • Recovery Image:ClockworkMod

Posted 13 July 2010 - 12:57 AM

View PostAndrew Low, on 13 July 2010 - 12:46 AM, said:

Seems to have worked well. Saved me a huge amount of reinstall via the Market.  +1


Hmm, spoke too soon.  Post reboot - I have default icons and get "app not installed" errors when clicking on them. :(

Apps are installed still - if I go to the drawer, there they are.

#4 -Stevo-

-Stevo-
  • Members
  • 1297 posts
  • LocationSalt Lake City, Utah
  • Country:us
  • Device Model:HTC Vision G2
  • MOD Version:CM7.0.0-RCX
  • Recovery Image:ClockworkMod

Posted 13 July 2010 - 01:22 AM

do they open from the drawer?

did you run fix_permissions or anything?

i decided to try this after nandroid backup with ALL my apps, and it worked splendidly, are you plugged into your PC? cause you lose any apps installed on SD if you're mounted.

#5 doctormojo

doctormojo
  • Members
  • 202 posts
  • Country:us
  • Device Model:HTC Vision
  • MOD Version:CM7
  • Recovery Image:ClockworkMod

Posted 13 July 2010 - 10:03 PM

Will this recover app data as well, or will it just do a fresh re-install of all the apps?  Looking at the script, it appears to my untrained eye that it is just a fresh install, but I wanted to make sure...

#6 AbsoluteZero

AbsoluteZero

    Droid Moderator

  • Moderators
  • 1542 posts
  • LocationWashington DC
  • Country:us
  • Device Model:mako,toro,grouper,TP,D1
  • MOD Version:CM10.1,CM10.1,CM10.1,CM9,Nightly#174
  • Recovery Image:ClockworkMod

Posted 13 July 2010 - 10:11 PM

View Postdoctormojo, on 13 July 2010 - 10:03 PM, said:

Will this recover app data as well, or will it just do a fresh re-install of all the apps?  Looking at the script, it appears to my untrained eye that it is just a fresh install, but I wanted to make sure...
Probably need to restore app data with something like TitBackup since it's located in /data not /sd-ext.
Try running this script then restore "Data Only" in TitBackup (not sure if it will work, just suggesting).

#7 Jerrold

Jerrold
  • Members
  • 4 posts
  • Device Model:|2|
  • MOD Version:5.0.8 t4
  • Recovery Image:Cyanogen

Posted 13 July 2010 - 11:02 PM

Dear -Stevo-

You are my frakkin' hero.

That's all...

#8 tdeangelis

tdeangelis
  • Members
  • 2 posts
  • Twitter:tjdeangelis
  • Device Model:|3|
  • MOD Version:cyanogen 5.0.7.1
  • Recovery Image:Cyanogen

Posted 13 July 2010 - 11:31 PM

First off, thanks for all your hard work! Second, what can I do to just  remove the partition, and recover the lost space? I have already manually reinstalled ALL my apps (i guess i am just more ambitious, lol), so i don't need to move anything. All i want is my space back...windows reports that my 16GB sd card is actually only a 14.3 GB card (i MAY have done the partition thing a FEW times trying to resolve this on my own..lol).

Any help is appreciated!

#9 Queso2469

Queso2469
  • Members
  • 23 posts
  • Country:us
  • Device Model:G2
  • MOD Version:Latest CM7 RC or Stable
  • Recovery Image:ClockworkMod

Posted 13 July 2010 - 11:39 PM

It goes back to the animated boot whenever I try this.

#10 remington.style

remington.style
  • Members
  • 18 posts
  • LocationVienna, Austria
  • Country:at
  • Device Model:|3|
  • MOD Version:6
  • Recovery Image:Cyanogen

Posted 13 July 2010 - 11:51 PM

my Androphone says:

Preparing ext partition..
mount: not found
mkdir failed for 
and so on

what am i doing wrong?

#11 sprandel

sprandel
  • Members
  • 24 posts
  • Twitter:sprandel17
  • LocationSaint Paul, MN
  • Country:us
  • Device Model:Droid
  • MOD Version:5.0.8
  • Recovery Image:ClockworkMod

Posted 14 July 2010 - 12:14 AM

$ su
# recoverext
Preparing ext partition..
mount: mounting /dev/block/mmcblk0p2 on /sd-ext failed: Invalid argument
Done
Installing apk files to SD card (this may take several minutes)
        pkg: /sd-ext/app/*.apk
Failure [INSTALL_FAILED_CONTAINER_ERROR]
        pkg: /sd-ext/app/*.zip
Failure [INSTALL_FAILED_CONTAINER_ERROR]
umount: can't umount /dev/block/mmcblk0p2: Invalid argument
Done.
#

#12 kwrose14

kwrose14
  • Members
  • 18 posts
  • Device Model:|2|
  • MOD Version:Cyanogen 5.0.8
  • Recovery Image:Amon_RA

Posted 14 July 2010 - 12:26 AM

Flashed the zip in recovery as instructed and reboot. I let it sit and have everything load. Open terminal, type in su and at the next prompt type in recoverext. Terminal responds with the following

Preparing ext partition..
Done
Installing apk files to SD card (this may take several minutes)
       pkg: /sd-ext/app/Gallery3D.apk
Failure [INSTALL_PARSE_FAILED_NO_CERTIFICATES]

and then the cursor just sits there

what went wrong and how can this be fixed ?

Thanks for your help

#13 Firerat

Firerat
  • Members
  • 1803 posts
  • Twitter:firer4t
  • Country:uk
  • Device Model:Dream aka G1 aka trout
  • MOD Version:CM6 Magpie Ezt 2708
  • Recovery Image:ClockworkMod

Posted 14 July 2010 - 01:25 AM

View Postsprandel, on 14 July 2010 - 12:14 AM, said:

$ su
# recoverext
Preparing ext partition..
mount: mounting /dev/block/mmcblk0p2 on /sd-ext failed: Invalid argument
Done
Installing apk files to SD card (this may take several minutes)
        pkg: /sd-ext/app/*.apk
Failure [INSTALL_FAILED_CONTAINER_ERROR]
        pkg: /sd-ext/app/*.zip
Failure [INSTALL_FAILED_CONTAINER_ERROR]
umount: can't umount /dev/block/mmcblk0p2: Invalid argument
Done.
#


logcat will show an error about a file already existing
delete that file, and it will work fine

can't remember the file name, but it should be in the logcat

#14 Mr_Tricorder

Mr_Tricorder

    Really Impressive Title

  • Donators
  • 753 posts
  • Twitter:Mr_Tricorder
  • LocationCollege Station, Texas
  • Country:us
  • Device Model:Epic 4G Touch
  • MOD Version:Leaked EL13 + Root
  • Recovery Image:TWRP

Posted 14 July 2010 - 01:58 AM

Ack!  Random reboot while script was running!  Everything seems ok though.  Hopefully I can finish recovering the rest of my apps.

EDIT:  It looks like the reboot isn't quite so random.  I've ran the script two more times and it reboots at the same point each time.

#15 Queso2469

Queso2469
  • Members
  • 23 posts
  • Country:us
  • Device Model:G2
  • MOD Version:Latest CM7 RC or Stable
  • Recovery Image:ClockworkMod

Posted 14 July 2010 - 02:50 AM

View PostMr_Tricorder, on 14 July 2010 - 01:58 AM, said:

Ack!  Random reboot while script was running!  Everything seems ok though.  Hopefully I can finish recovering the rest of my apps.

EDIT:  It looks like the reboot isn't quite so random.  I've ran the script two more times and it reboots at the same point each time.

I'm getting reboot on first app which happens to be mail.apk or something similar.

#16 Andrew Low

Andrew Low
  • Members
  • 126 posts
  • Twitter:andrew_low
  • Country:ca
  • Device Model:Samsung Galaxy S i9000m
  • MOD Version:7.1
  • Recovery Image:ClockworkMod

Posted 14 July 2010 - 02:55 AM

View Post-Stevo-, on 13 July 2010 - 01:22 AM, said:

do they open from the drawer?

did you run fix_permissions or anything?

i decided to try this after nandroid backup with ALL my apps, and it worked splendidly, are you plugged into your PC? cause you lose any apps installed on SD if you're mounted.

Well something was sick with my CM6 install as it failed later with a boot loop.  I was able to open them from the drawer - and as evidenced, many others are getting this to work fine for them.

#17 -Stevo-

-Stevo-
  • Members
  • 1297 posts
  • LocationSalt Lake City, Utah
  • Country:us
  • Device Model:HTC Vision G2
  • MOD Version:CM7.0.0-RCX
  • Recovery Image:ClockworkMod

Posted 14 July 2010 - 02:56 AM

Random reboots are common in general, I've run this with more and more apps and haven't seen problems.

#18 Kyle Potts

Kyle Potts
  • Members
  • 26 posts
  • Twitter:kylepotts
  • Device Model:|2|
  • MOD Version:5.0.8 Test #
  • Recovery Image:Amon_RA

Posted 14 July 2010 - 04:32 AM

Did a logcat like firerat said. File is /mnt/secure/asec/smdl2tmp1.asec. Delete that and everything works ok. Thanks firerat

#19 tsuyaa

tsuyaa
  • Members
  • 5 posts
  • Twitter:tsuyaa
  • Country:sg
  • Device Model:|2|
  • MOD Version:Dream/Sapphire Nightly builds
  • Recovery Image:Amon_RA

Posted 14 July 2010 - 04:46 AM

I tried deleting the file via terminal using

-rm /mnt/secure/asec/smdl2tmp1.asec

but it didn't solve the problems. Am I doing something wrong?

#20 Kyle Potts

Kyle Potts
  • Members
  • 26 posts
  • Twitter:kylepotts
  • Device Model:|2|
  • MOD Version:5.0.8 Test #
  • Recovery Image:Amon_RA

Posted 14 July 2010 - 04:51 AM

View Posttsuyaa, on 14 July 2010 - 04:46 AM, said:

I tried deleting the file via terminal using

-rm /mnt/secure/asec/smdl2tmp1.asec

but it didn't solve the problems. Am I doing something wrong?

I did an rm -rf. Maybe delete the rest of the asec files? Try a reboot see if the file reappears and try again. Or do a logcat and see if any other files pop up.