Related
Various aspects of the Nook system are signed with a signature from Barnes & Noble.
There are a few places where signatures are compared.
Various system apps used a single "shared id" and they must all have the same signature.
/system/framework/framework-res.apk must have a correct signature with respect to AndroidManifest.xml.
In any case, it's your Nook, what are you going to do?
Re-signing the system
make a full backup and make sure that it is good
create your own signature http://developer.android.com/tools/publishing/app-signing.html
make a directory for your patch
create the subdirectory META-INF\com\google\android\
put a copy of update-binary in there
write a updater-script and put it in there
create the subdirectory system\app
create the subdirectory system\framework
For each of your APKs in /system/app and also /system/framework/framework-res.apk:
unzip them somewhere
delete the whole directory META-INF from them
zip the directory
jarsigner them with your own personal signature
zipalign the APK (optional if you are lazy and don't see the point)
put it in the appropriate patch directory
Then:
zip the patch directory
copy it to your SD card
make sure that your WiFi is turned on if you are using ADB over WiFi!
recovery boot using ClockworkMod
install the patch from SD card
reboot
updater-script
Code:
# Replace signed components
mount("ext2", "/dev/block/mmcblk0p5", "/system");
package_extract_dir("system/app", "/system/app");
package_extract_dir("system/framework", "/system/framework");
unmount("/system");
# Delete packages.xml
mount("ext3", "/dev/block/mmcblk0p8", "/data");
delete("/data/system/packages.xml");
unmount("/data");
Flies in the ointment, caveats, etc...
The packages.xml contains some form of certs that have all changed.
Right now, the simplest way I know to deal with this is just to delete packages.xml.
The problem is, this will break most user applications since the user IDs will no longer agree.
The easiest thing to do is just to reinstall them.
For applications with a lot of data, it would be best to back up the configs or data.
When you first boot up, you may think that you are in a "boot loop".
The boot animation will run continuously.
If you have ADB connect still (and you had better!) you can fix this.
Your launcher application is probably causing lots of error on startup.
There are two ways to fix the problem with the launcher (or any other app)
uninstall and reinstall it
go into /data/data/com.myapp.whatever and chown everything to the user id of the application.
Code:
busybox chown -R 10011: databases
Don't chown the lib directory if there is one.
Then you should have a device that boots up normally.
Good luck, Mr. Phelps.
Renate NST said:
create your own signature http://developer.android.com/tools/publishing/app-signing.html
Click to expand...
Click to collapse
Renate,
Won’t it be easier to use Andriod media key?
If we do, we can patch packages.xml, instead of deleting it, right?
Renate NST said:
For each of your APKs in /system/app and also /system/framework/framework-res.apk:
unzip them somewhere
delete the whole directory META-INF from them
zip the directory
jarsigner them with your own personal signature
zipalign the APK (optional if you are lazy and don't see the point)
put it in the appropriate patch directory
Click to expand...
Click to collapse
I wrote a script to do just that, can be adapted easily...
Code:
@set keystore=..\keys\media.jks
@set storepass=android
@set alias=media
@set resigned_dir=.\new
@for %%i in ( .\*.apk ) do @(
echo %%i
copy %%i %resigned_dir%\%%~ni_%%~xi
zip -d %resigned_dir%\%%~ni_%%~xi META-INF\*
jarsigner -keystore %keystore% -storepass %storepass% %resigned_dir%\%%~ni_%%~xi %alias%
zipalign -f 4 %resigned_dir%\%%~ni_%%~xi %resigned_dir%\%%~ni%%~xi
del %resigned_dir%\%%~ni_%%~xi
)
@goto :eof
Just my 2 cents…
---------- Post added at 04:31 PM ---------- Previous post was at 04:22 PM ----------
Renate NST said:
...
Then you should have a device that boots up normally.
Good luck, Mr. Phelps.
Click to expand...
Click to collapse
Guys,
If you run into a problem following Renate steps, it’ll be practically impossible to troubleshot without logcat log.
It might be a bit safer to use ADB over USB then over Wireless.
Even if you run into boot loop, ADB should work still.
I’m not 100% sure, if you need framework operational to establish wireless connection (for ADB to use).
ADB over USB definitely doesn't need framework running.
Yes, of course I used a script to resign the individual APKs.
Yours is nice though.
I'm not sure what you mean by "Android media key".
Do you mean the androiddebug key?
Did you re-sign framework-res.apk too?
Well, one advantage of deleting packages.xml is that it gets rid of the cruft.
I was thinking of just writing a little utility that resolved the renumbered user ids and fixed file ownership.
P.S. WiFi works fine when the boot animation is still looping.
The loop animation just runs until something wants to use the screen.
The system is actually 100% up at that point.
It's just that your home application (a launcher probably) can't run.
You can still start an application by am start intent.
That's also a warning to not presume that your Nook is dead just because the display loops.
Renate NST said:
Yes, of course I used a script to resign the individual APKs.
Yours is nice though.
Click to expand...
Click to collapse
Thank you!
Renate NST said:
I'm not sure what you mean by "Android media key".
Do you mean the androiddebug key?
Click to expand...
Click to collapse
I don’t remember now, it was long time ago.
AFAIR, it was 4 keys
testkey -- a generic key for packages that do not otherwise specify a key.
platform -- a test key for packages that are part of the core platform.
shared -- a test key for things that are shared in the home/contacts process.
media -- a test key for packages that are part of the media/download system.
You can download them still from Google repository
http://mirror.yongbok.net/pub/pub/linux/android/repository/build/target/product/security/
Most ppl call media key androiddebug key, don’t ask me why.
Renate NST said:
Did you re-sign framework-res.apk too?
Click to expand...
Click to collapse
Not as of now. Waiting for your Reader.apk...
Renate NST said:
Well, one advantage of deleting packages.xml is that it gets rid of the cruft.
I was thinking of just writing a little utility that resolved the renumbered user ids and fixed file ownership.
Click to expand...
Click to collapse
I dunno if it recreates UserID properly.
I.e. you have apps A, B, C installed they got UserIDs 10001, 10002 & 10003 respectively.
Then you uninstall A & B and delete delete packages.xml, would C get 10003 still?
Need to test it.
Renate NST said:
P.S. WiFi works fine when the boot animation is still looping.
The loop animation just runs until something wants to use the screen.
The system is actually 100% up at that point.
Click to expand...
Click to collapse
Yep. Thanks for confirming this!
Renate NST said:
It's just that your home application (a launcher probably) can't run.
You can still start an application by am start intent.
That's also a warning to not presume that your Nook is dead just because the display loops.
Click to expand...
Click to collapse
When I see Nook booting image "with running dots", ADB is up already.
I was under impressing that’s the image ppl see while in boot loop.
ps shows it as bootanimation process
I guess, we are NOT on the same page again…
The running dots (boot animation) gets started as the system starts.
It just runs until something takes over the screen.
If it runs continuously, it could mean that the system is in a boot loop or
simply that no application is rising to the challenge to do something.
On the other hand, if the dots are running, but it hiccups and starts over from the first dot, that's a real boot loop.
Renate NST said:
The running dots (boot animation) gets started as the system starts.
It just runs until something takes over the screen.
If it runs continuously, it could mean that the system is in a boot loop or
simply that no application is rising to the challenge to do something.
On the other hand, if the dots are running, but it hiccups and starts over from the first dot, that's a real boot loop.
Click to expand...
Click to collapse
Renate,
I neither completely agree with you on bootanimation app nor want to pollute this thread with useless (IMO) discussion about it. If you want discuss it further – could you open another thread?
Well, I proved that you can take Settings.apk and SettingsProvider.apk off the emulator, sign them and install them.
There are a number of problems with that, starting out that the opening screen is white on white.
Also, my Nook seems to think it's a phone now and the hack that I did for the "n" button is broken.
I switched back to the stock version.
On the plus side, my Nook now opens with just a button press and no swiping.
I remember some people were interested in that.
It's probably something in settings.db
Renate NST said:
Well, I proved that you can take Settings.apk and SettingsProvider.apk off the emulator, sign them and install them.
Click to expand...
Click to collapse
AFAIR, everything on emulator is signed with keys I posted and nothing with B&N key - you don't need to resign.
Renate NST said:
Various aspects of the Nook system are signed with a signature from Barnes & Noble.
Click to expand...
Click to collapse
Renate,
I can write a script (Win) to do:
Parse packages.xml to find APKs run as 'shared-user name="android.media" userId="10000"'
Pull (backup) them to PC
Resign
Stop framework
Push resigned APKs to NST
Replace B&N cert reference in packages.xml to the one we used
Start framework
It might be some manual steps...
Do you think it might be useful?
And another script to restore...
First thing, I think that doing a system update to replace (as recommended in my first post) is overkill.
I wasn't sure whether simply starting and stopping the framework from the shell would be sufficient.
Apparently it is.
My only excuse is that I've bricked my Nook about 20 times and was being conservative.
What you want to sign your Nook with is your choice.
I hadn't looked into using any common signatures.
Android only mentions the single debug key in their documentation.
The emulator apks are signed with an Android signature, but not the same as the debug key.
ApokrifX said:
I can write a script (Win) to do:
Parse packages.xml to find APKs run as 'shared-user name="android.media" userId="10000"'
Click to expand...
Click to collapse
Ok, but there is also all the other sharedUserId="1000"
I'm not sure how the cert references work in packages.xml
Does it work for framework-res.apk too?
Looks like I cannot answer your question.
I guess, we can create a table [sharedUserId] – [App], [sharedUserId] – [Cert] and [Cert] - [App]
It can shed some light on how it works.
I can see same sharedUserId used with different certs, so apps should use different android users...
See below:
Don’t know how to map sharedUserId to android user yet.
My [current] understanding is:
userId "10000" and above are apps generated.
Below – for system use.
I have now:
<package name="com.bn.nook.quickstart" codePath="/system/app/QuickStartActivity.apk" system="true" ts="1217592000000" version="7" sharedUserId="1000">
<cert index="4" />
<package name="com.google.android.server.checkin" codePath="/system/app/GoogleCheckin.apk" system="true" ts="1292347460000" version="7" sharedUserId="1000">
<sigs count="1">
<cert index="13" />
Obviously, due to cert mismatch, "com.bn.nook.quickstart" & "com.google.android.server.checkin" should use different users.
---------- Post added at 09:29 PM ---------- Previous post was at 09:04 PM ----------
ApokrifX said:
Looks like I cannot answer your question.
I guess, we can create a table [sharedUserId] – [App], [sharedUserId] – [Cert] and [Cert] - [App]
It can shed some light on how it works.
Click to expand...
Click to collapse
Here we go:
Code:
0 10019 com.google.android.apps.gtalkservice /system/app/gtalkservice.apk
0 10019 com.google.android.googleapps /system/app/GoogleApps.apk
0 10019 com.google.android.providers.gmail /system/app/GmailProvider.apk
0 10019 com.google.android.providers.talk /system/app/TalkProvider.apk
0 10021 com.google.android.gm /system/app/Gmail.apk
0 10022 com.android.vending /system/app/Vending.apk
1 10002 com.android.globalsearch /system/app/GlobalSearch.apk
1 10002 com.android.googlesearch /system/app/GoogleSearch.apk
1 10002 com.android.inputmethod.latin /system/app/LatinIME.apk
1 10002 com.android.launcher /system/app/Launcher.apk
1 10002 com.android.providers.applications /system/app/ApplicationsProvider.apk
1 10002 com.android.providers.contacts /system/app/ContactsProvider.apk
1 10002 com.android.providers.userdictionary /system/app/UserDictionaryProvider.apk
10 10001 com.adobe.air /system/app/AirRuntime.apk
10 10017 de.devmil.minimaltext /data/app/mt262.apk
10 10023 com.google.android.talk /system/app/Talk.apk
11 10013 com.ngc.fora /data/app/com.ngc.fora.apk
12 10015 siir.es.adbWireless /data/app/siir.es.adbWireless-1.apk
13 1000 com.google.android.providers.subscribedfeeds /system/app/GoogleSubscribedFeedsProvider.apk
13 1000 com.google.android.server.checkin /system/app/GoogleCheckin.apk
14 10018 com.david1171.minimalistblack /data/app/com.david1171.minimalistblack-1.apk
15 10014 com.smart.swkey /data/app/SWKey21.apk
16 10030 com.asksven.betterbatterystats /data/app/com.asksven.betterbatterystats.apk
17 10027 jackpal.androidterm /data/app/jackpal.androidterm.apk
18 10029 com.googlecode.droidwall.free /data/app/com.googlecode.droidwall.free.apk
19 10016 org.adw.launcher /data/app/org.adw.launcher-1.apk
2 10026 org.coolreader /data/app/org.coolreader.apk
20 10012 com.noshufou.android.su /data/app/Superuser.apk
3 10024 berserker.android.apps.sshdroid /data/app/berserker.android.apps.sshdroid.apk
4 1000 android /system/framework/framework-res.apk
4 1000 com.android.providers.settings /system/app/SettingsProvider.apk
4 1000 com.android.providers.subscribedfeeds /system/app/AccountAndSyncSettings.apk
4 1000 com.android.settings /system/app/Settings.apk
4 1000 com.bn.app.crypto.server /system/app/CryptoServer.apk
4 1000 com.bn.authentication.svc /system/app/BnAuthenticationService.apk
4 1000 com.bn.demomode /system/app/DemoMode.apk
4 1000 com.bn.devicemanager /system/app/DeviceManager.apk
4 1000 com.bn.nook.quickstart /system/app/QuickStartActivity.apk
4 1000 com.bn.syschecksum /system/app/SysChecksum.apk
4 1000 com.bn.waveformdownloader.svc /system/app/WaveformDownloader.apk
4 10005 com.android.certinstaller /system/app/CertInstaller.apk
4 10009 com.android.packageinstaller /system/app/PackageInstaller.apk
4 1001 com.android.phone /system/app/Phone.apk
4 1001 com.android.providers.telephony /system/app/TelephonyProvider.apk
4 10011 android.tts /system/app/TtsService.apk
5 10000 com.android.gallery /system/app/Gallery.apk
5 10000 com.android.providers.downloads /system/app/DownloadProvider.apk
5 10000 com.android.providers.drm /system/app/DrmProvider.apk
5 10000 com.android.providers.media /system/app/MediaProvider.apk
5 10000 com.bn.nook.accessories /system/app/Accessories.apk
5 10000 com.bn.nook.affiledownloadservice /system/app/AFfileDownloadService.apk
5 10000 com.bn.nook.cloud.service /system/app/CloudService.apk
5 10000 com.bn.nook.community /system/app/NookCommunity.apk
5 10000 com.bn.nook.dadmin /system/app/DownloadAdmin.apk
5 10000 com.bn.nook.home /system/app/Home.apk
5 10000 com.bn.nook.library /system/app/Library.apk
5 10000 com.bn.nook.reader.activities /system/app/Reader.apk
5 10000 com.bn.nook.shop /system/app/Shop.apk
5 10000 com.bn.nook.social /system/app/Social.apk
6 10025 com.andoku.two.free /data/app/com.andoku.two.free.apk
7 10028 org.connectbot /data/app/org.connectbot.apk
8 10003 com.bn.cloud.svc /system/app/BnCloudRequestSvc.apk
8 10004 com.android.browser /system/app/Browser.apk
8 10006 com.bn.deviceregistrator /system/app/DeviceRegistrator.apk
8 10007 com.android.htmlviewer /system/app/HTMLViewer.apk
8 10008 com.android.music /system/app/Music.apk
8 10010 com.svox.pico /system/app/PicoTts.apk
9 10020 com.benhirashima.nookcolorsettings /system/app/NookColorTools.apk
ApokrifX said:
Don’t know how to map sharedUserId to android user yet.
Click to expand...
Click to collapse
Need help with this one... :crying:
Yes, the cert indexes are the same for all the things that are signed with the same signature,
but they can even be different in some cases.
All my the apps I wrote and signed with my own key are 0.
All of the system that I signed with my own key are 1.
All of the other cert indexes go from 2 to 8.
The problem is, these are indexes into something and I don't know what/where that is.
When you change a signature, you have to change the something.
When you change signatures in most cases, the system shrugs and rebuilds packages,xml
It's mostly changing the signature on framework-res.apk (name="android") that causes the biggest problems.
For another perspective on the whole package management, try this:
Code:
dumpsys package > /sdcard/package.txt
(This generates a lot of text, hence the redirect.)
Renate NST said:
Android only mentions the single debug key in their documentation.
Click to expand...
Click to collapse
URL?
Renate NST said:
The emulator apks are signed with an Android signature, but not the same as the debug key.
Click to expand...
Click to collapse
Compared few keys (Subject Key Identifiers) out of curiosity:
Android keys
Code:
testkey 48:59:00:56:3D:27:2C:46:AE:11:86:05:A4:74:19:AC:09:CA:8C:11
shared CB:4C:7E:2C:DB:B3:F0:AD:A9:8D:AB:79:96:8D:17:2E:9D:BB:1E:D1
platform 4F:E4:A0:B3:DD:9C:BA:29:F7:1D:72:87:C4:E7:C3:8F:20:86:C2:99
media CA:29:3C:AA:8B:C0:ED:3E:54:2E:EF:42:05:A2:BF:F2:B5:7E:4D:75
NC2.1 EMU
Code:
Browser 48:59:00:56:3D:27:2C:46:AE:11:86:05:A4:74:19:AC:09:CA:8C:11
LatinIME CB:4C:7E:2C:DB:B3:F0:AD:A9:8D:AB:79:96:8D:17:2E:9D:BB:1E:D1
framework-res 4F:E4:A0:B3:DD:9C:BA:29:F7:1D:72:87:C4:E7:C3:8F:20:86:C2:99
MediaProvider CA:29:3C:AA:8B:C0:ED:3E:54:2E:EF:42:05:A2:BF:F2:B5:7E:4D:75
---------- Post added at 10:13 PM ---------- Previous post was at 10:07 PM ----------
Renate NST said:
Yes, the cert indexes are the same for all the things that are signed with the same signature,
but they can even be different in some cases.
All my the apps I wrote and signed with my own key are 0.
All of the system that I signed with my own key are 1.
All of the other cert indexes go from 2 to 8.
The problem is, these are indexes into something and I don't know what/where that is.
Click to expand...
Click to collapse
Ok. Just to make sure, we are on same page again:
When cert mentioned 1st time, it got encoded right into packages.xml key="3082...9308a"
Next time it used, it's referenced by index.
Code:
<package name="com.google.android.providers.talk" codePath="/system/app/TalkProvider.apk" system="true" ts="1292347460000" version="7" sharedUserId="10019">
<sigs count="1">
<cert index="0" key="3082...9308a" />
...
<package name="com.google.android.googleapps" codePath="/system/app/GoogleApps.apk" system="true" ts="1292347460000" version="130" sharedUserId="10019">
<sigs count="1">
<cert index="0" />
Do you mean something else?
---------- Post added at 10:16 PM ---------- Previous post was at 10:13 PM ----------
Renate NST said:
Yes, the cert indexes are the same for all the things that are signed with the same signature,
but they can even be different in some cases.
All my the apps I wrote and signed with my own key are 0.
All of the system that I signed with my own key are 1.
Click to expand...
Click to collapse
Interesting...
Could you extract CERT.RSA from "the app" and "the system app" and compare, please?
---------- Post added at 10:22 PM ---------- Previous post was at 10:16 PM ----------
[/COLOR]
Renate NST said:
For another perspective on the whole package management, try this:
Code:
dumpsys package > /sdcard/package.txt
Click to expand...
Click to collapse
How do we map:
Code:
Package [com.asksven.betterbatterystats] (49ea9250):
userId=10030 gids=[1015, 3003]
to names we see with ls -l
ApokrifX said:
URL?
When cert mentioned 1st time, it got encoded right into packages.xml key="3082...9308a"
Next time it used, it's referenced by index.
Click to expand...
Click to collapse
Yup, it looks like you are 100% correct.
FWR signed signed with my key is different than an app signed with my key.
They are the same, except for the last 256 bytes which are different.
As you can see, the keys in package.xml are of different lengths
and at least in the cases that I checked are shorter than length(cert)-256 even.
Moreover the end of the keys in packages.xml don't agree with the same position.
http://developer.android.com/tools/publishing/app-signing.html
The SDK tools create the debug keystore/key with predetermined names/passwords:
Keystore name: "debug.keystore"
Keystore password: "android"
Key alias: "androiddebugkey"
Key password: "android"
CN: "CN=Android Debug,O=Android,C=US"
Click to expand...
Click to collapse
The point is not that this single key is documented, the point is that the others are not.
Renate NST said:
FWR signed signed with my key is different than an app signed with my key.
They are the same, except for the last 256 bytes which are different.
As you can see, the keys in package.xml are of different lengths
and at least in the cases that I checked are shorter than length(cert)-256 even.
Click to expand...
Click to collapse
Right.
Could you compare certs "X509v3 Subject Key Identifier", please?
Renate NST said:
Moreover the end of the keys in packages.xml don't agree with the same position.
Click to expand...
Click to collapse
I’m not sure, I get this...
Renate NST said:
The point is not that this single key is documented, the point is that the others are not.
Click to expand...
Click to collapse
---------- Post added at 11:15 PM ---------- Previous post was at 11:01 PM ----------
Looks like in certs in packages.xml are stored in pkcs8 hex format:
shared.pk8
Code:
0000000000: 30 82 04 BE 02 01 00 30 │ 0D 06 09 2A 86 48 86 F7
0000000010: 0D 01 01 01 05 00 04 82 │ 04 A8 30 82 04 A4 02 01
0000000020: 00 02 82 01 01 00 C8 C2 │ DB FD 09 4A 2D F4 5C 3F
0000000030: F1 A3 2E D2 18 05 EC 72 │ FC 58 D0 17 97 1B D0 F6
packages.xml
Code:
<cert index="2" key="3082...b2db" />
They can be easily dumped from packages.xml right into pkcs8 format, no need to get them from packages.
I know practically nothing about signing and certs specifically.
Taking this as a black box question:
Given a signed package, extract the cert with a zip tool,
how do you convert that data into something to write into packages.xml?
Yes, all the ASCII text is in both of these but the cert in the apk and the cert in packages are wildly different.
Yes, you could make a project of this and delve into the Android code to see where it all comes from but the effort seems excessive.
We know that if you delete packages.xml entirely it will get rebuilt (although not with the same non-shared ids as before).
Why not try just deleting all the certs and leaving the rest of it alone?
Renate NST said:
I know practically nothing about signing and certs specifically.
Taking this as a black box question:
Given a signed package, extract the cert with a zip tool,
how do you convert that data into something to write into packages.xml?
Click to expand...
Click to collapse
I didn’t do this part yet.
I guess, a bit fiddling with openssl or keytool will do just fine.
Renate NST said:
Yes, all the ASCII text is in both of these but the cert in the apk and the cert in packages are wildly different.
Click to expand...
Click to collapse
If you post both (from packages.xml), I’ll decrypt them.
I’m pretty sure, they are different.
Renate NST said:
Yes, you could make a project of this and delve into the Android code to see where it all comes from but the effort seems excessive.
Click to expand...
Click to collapse
Yep. There is no point.
Renate NST said:
We know that if you delete packages.xml entirely it will get rebuilt (although not with the same non-shared ids as before).
Why not try just deleting all the certs and leaving the rest of it alone?
Click to expand...
Click to collapse
I wrote already, what might be different if you do it.
IMO, just patching it might be safer...
BTW: I decoded certs from packages.xml - there 4 different ones from B&N there.
ApokrifX said:
I decoded certs from packages.xml - there 4 different ones from B&N there.
Click to expand...
Click to collapse
I still don't know what the tool is or how it operates.
I'm not saying that what is packed in an APK is different in substance from the cert in packages.xml,
I'm just saying that they are not trivially binary convertible from one to another.
If you just delete packages.xml you can either fix the non-shared user ids in packages
or fix the owners for /data/data directories.
I already have an auditing tool for resolving such user id discrepancies
and finding orphaned /data/data directories for apps that were deleted and not uninstalled.
It doesn't do anything, but it reports it so that you can.
Renate NST said:
I still don't know what the tool is or how it operates.
I'm not saying that what is packed in an APK is different in substance from the cert in packages.xml,
I'm just saying that they are not trivially binary convertible from one to another.
Click to expand...
Click to collapse
I dunno, they are trivially convertible, try for yourself:
Unzip CERT.RSA from stock Reader.apk
Obviously (or not), CERT.RSA is pkcs7 and certs in packages.xml are hex strings x509
Let’s convert pkcs7 -> x509
Code:
openssl pkcs7 -inform DER -in CERT.RSA -out CERT.PEM -print_certs
openssl x509 -inform PEM -in CERT.PEM -outform DER -out CERT.x509.DER
Now open CERT.x509.DER is any hex editor:
Code:
0000000000: 30 82 04 96 30 82 03 7E │ A0 03 02 01 02 02 09 00
0000000010: CF 3F 93 2A 95 18 91 A5 │ 30 0D 06 09 2A 86 48 86
...
0000000480: BF 46 EB 99 2F F8 A8 9A │ 1F 66 2D 91 4F 0C 93 FE
0000000490: 44 7D 2F D0 C2 CC DC F7 │ 5E 84
And compare with packages.xml
Code:
<cert index="5" key="308204963082037ea003020102020900cf3f932a951891a5300d06092a864886
…
bf46eb992ff8a89a1f662d914f0c93fe447d2fd0c2ccdcf75e84" />
Renate NST said:
If you just delete packages.xml you can either fix the non-shared user ids in packages or fix the owners for /data/data directories.
I already have an auditing tool for resolving such user id discrepancies
and finding orphaned /data/data directories for apps that were deleted and not uninstalled.
It doesn't do anything, but it reports it so that you can.
Click to expand...
Click to collapse
What about this case:
ApokrifX said:
I dunno if it recreates UserID properly.
I.e. you have apps A, B, C installed they got UserIDs 10001, 10002 & 10003 respectively.
Then you uninstall A & B and delete delete packages.xml, would C get 10003 still?
Need to test it.
Click to expand...
Click to collapse
Do we need to do anything manually or deleting packages.xml will recreates everything properly?
Well, you seem to have a handle on all this.
I've never heard of pkcs7 or any of its friends.
Deleting packages.xml will result in the non-shared user ids to be assigned in order as the APKs are discovered by the PackageManager.
User ids are only used for file permissions on /data/data as far as I know.
Where is this generated? "B004Y1WCDE"
127|[email protected]:/storage/sdcard0/.imagecache/com.amazon.venezia/com.plexapp.android # ls -la
drwxrwxr-x root sdcard_rw 2014-07-18 06:12 B004Y1WCDE
[email protected]:/storage/sdcard0/.imagecache/com.amazon.venezia/com.plexapp.android #
Does anyone know?
Thanks
Jeff
jdf99 said:
Where is this generated? "B004Y1WCDE"
127|[email protected]:/storage/sdcard0/.imagecache/com.amazon.venezia/com.plexapp.android # ls -la
drwxrwxr-x root sdcard_rw 2014-07-18 06:12 B004Y1WCDE
[email protected]:/storage/sdcard0/.imagecache/com.amazon.venezia/com.plexapp.android #
Does anyone know?
Thanks
Jeff
Click to expand...
Click to collapse
That is the ASIN (i think that's what they call it... Amazon ID basically) of Plex:
http://www.amazon.com/gp/product/B004Y1WCDE
Hello.
Where is stored the raw file for the User Dictionary of HTC Sense Input keyboard ? It's obviously not the classic /data/data/com.android.providers.userdictionary/databases/user_dict.db ... because I wiped the file, rebooted, and HTC SI still kept memories of some words. After using backup restaure tools like UDM, HTCSI also can't see new words.
Thanks.
State of art:
For every one: the classic user dictionary is in /data/data/com.android.providers.userdictionary/databases/user_dict.db as SQLite3 . It's very easy to extract:
echo "SELECT word FROM words;" | sqlite3 /data/local/tmp/user_dict.db | sort | uniq | sed ':a;N;$!ba;s/\n/\|/g' > /data/local/tmp/PersonalDictionary.htcudb
providing you have SQLite3 somewhere in your PATH.
The base HTC IME dictionary is here: /data/data/com.htc.sense.ime/app_db/dlm_export
The SD backup is not on emulated (I have asked for emulated SD from internal memory), but on real physical external SD:
/storage/ext_sd/.data/HTC_IME/PersonalDictionary
The method to find the two last files were:
- touch /data/local/tmp/plop
- make a change in the dic, or a backup
- find /storage/ext_sd/ -newer /data/local/tmp/plop
or
- find /data/data -newer /data/local/tmp/plop
You have to re-touch the plop each time.
Once /data/data/com.android.providers.userdictionary/databases/user_dict.db is exported into /data/local/tmp/PersonalDictionary.htcudb, two things are possible:
- copy the file into /storage/ext_sd/.data/HTC_IME/PersonalDictionary, and make a manual import from HTC Sense Input dictionary manager
- attach the file to an email, and open the attachement from HTC-Mail, what will restaure the attached backup.
I have found the following command to ask for restauring the backup:
Code:
am start -a android.intent.action.VIEW -d "content:" -t "application/ime-config" -n com.htc.sense.ime/.ui.RestoreUDB -f "0x00080001"
But I do not get the confirmation toast. Because I don't find where the cache file is stored by HTC-Mail, for IME. Since I run stuff from scripts, that command does not work as is; in my case, I have to run it in this context:
Code:
setprop service.adb.tcp.port 5555
stop adbd
start adbd
adb connect 127.0.0.1
adb shell id
adb shell su -c id
adb shell su -c am start [...]
otherwise I get a nasty error about permission issues:
Starting: Intent { act=android.intent.action.VIEW dat=content: typ=application/ime-config flg=0x80001 cmp=com.htc.sense.ime/.ui.RestoreUDB }
java.lang.SecurityException: Permission Denial: starting Intent { act=android.intent.action.VIEW dat=content: typ=application/ime-config flg=0x10080001 cmp=com.htc.sense.ime/.ui.RestoreUDB } from null (pid=29007, uid=2000) requires com.htc.permission.APP_DEFAULT
Click to expand...
Click to collapse
Work for an other day:
- try to construct the am start call for backup restauration from SD (previous line was for email attachement) => give up
- find how to export and rebuild (via script) /data/data/com.htc.sense.ime/app_db/dlm_export
- find if this dictionary is gaining, or loosing any word => stats now on way: cron is recording daily the size of files
- remove dups from /data/data/com.android.providers.userdictionary/databases/user_dict.db (clean PROVIDER file)
- during export, I want to inject Contact details (first name, name, town name)
*** *** ***
The base problem I have is that HTC Sens keyboard is very good, for daily use, but randomly looses settings, and parts of the dics (some times words added the last days; some times 98% of it, only keeping 10 or 15 words).
I want to monitor the IME dic, and produce a system alert when this dic is found to have lost words, and after user confirmation, restaure the IME dic (with an older version of the file, or by rebuilding it).
Some other files may be interesting, in the same folder: mdb_contact_name seem to be a raw text version of com.android.providers.userdictionary/databases/user_dict.db . stm_dump is also very large. IME dictionary has a concept of alias (and auto-replace); but I don't know where this is stored. I also wonder where the word usage statistics are stored (for suggestions).
The big minus I found in this keyboard is that suggestions are always limited to 3 words on the first line (the one always available) (in portrait); Gingerbread and Hackers offer up to 12 words: as much as they can print on screen. Also, suggestions only include literal words: words with letters only; it never suggests words with numbers (unless I already typed one in currect word) or punctuation (statistics show that some words are very often followed by question mark, comma, or full stop).
Now that I am used to the height of HTC Sens keyboard, I make many typos with smaller boards; but smaller boards leave much more screen space for chat. Sens is very good for writing emails; but instant messaging like Skype and Yahoo use too much screen space, and smaller kbd would leave more chat history visible. But Sens has a better word prediction for intuitive chat ...
***
Recoding daily stats of files:
Code:
find /data/data/com.htc.sense.ime/app_db/dlm_export.history -mtime 0 | grep "e" || {
for i in dlm_export mdb_contact_name stm_dump
do
{ echo -n "$(date +%Y-%m-%d_%H-%M-%S) : " ; ls -l /data/data/com.htc.sense.ime/app_db/$i | awk '{print $4}' ; } >> /data/data/com.htc.sense.ime/app_db/${i}.history
done
This code will work even with non existing history. Then wait history is 1D old .... I have found that one history per file is easier to re-read than one for all. Injecting date this way date +%Y-%m-%d_%H-%M-%S ; echo -n " : " used to introduce an undesired NL..
Proof that stupid dictionary bugs:
Code:
-rw------- 1 root root 0 2016-01-24 23:40 dlm_export
-rw------- 1 root root 1274 2015-09-02 10:15 kdb_0c09.cfg
-rw------- 1 root root 1274 2016-01-24 02:29 kdb_0c0c.cfg
-rw------- 1 root root 1281 2014-10-08 14:56 kdb_0d03.cfg
-rw------- 1 root root 1250 2015-12-20 18:18 kdb_0d09.cfg
-rw------- 1 root root 1250 2016-01-24 23:48 kdb_0d0c.cfg
-rw------- 1 root root 28902 2016-01-25 17:01 mdb_contact_name
-rw------- 1 root root 20 2016-01-25 17:01 sc_mdb_contact_name
-rw------- 1 root root 0 2016-01-24 23:40 stm_dump
-rw------- 1 root root 0 2016-01-25 17:01 tc_mdb_contact_name
-rw------- 1 root root 83251 2016-01-29 20:01 dlm_export
-rw------- 1 root root 1274 2015-09-02 10:15 kdb_0c09.cfg
-rw------- 1 root root 1274 2016-01-29 07:30 kdb_0c0c.cfg
-rw------- 1 root root 1281 2014-10-08 14:56 kdb_0d03.cfg
-rw------- 1 root root 1250 2015-12-20 18:18 kdb_0d09.cfg
-rw------- 1 root root 1250 2016-01-29 19:48 kdb_0d0c.cfg
-rw------- 1 root root 28954 2016-01-29 20:57 mdb_contact_name
-rw------- 1 root root 20 2016-01-29 20:57 sc_mdb_contact_name
-rw------- 1 root root 225751 2016-01-29 09:57 stm_dump
-rw------- 1 root root 0 2016-01-29 20:57 tc_mdb_contact_name
-rw------- u0_a39 u0_a39 145060 2016-02-04 23:44 dlm_export
-rw------- root root 29 2016-02-05 01:01 dlm_export.history
-rw------- u0_a39 u0_a39 1274 2015-09-02 10:15 kdb_0c09.cfg
-rw------- u0_a39 u0_a39 1274 2016-02-04 21:20 kdb_0c0c.cfg
-rw------- u0_a39 u0_a39 1281 2014-10-08 14:56 kdb_0d03.cfg
-rw------- u0_a39 u0_a39 1250 2015-12-20 18:18 kdb_0d09.cfg
-rw------- u0_a39 u0_a39 1250 2016-02-05 00:32 kdb_0d0c.cfg
-rw------- u0_a39 u0_a39 29036 2016-02-05 00:32 mdb_contact_name
-rw------- root root 57 2016-02-05 01:01 mdb_contact_name.history
-rw------- u0_a39 u0_a39 20 2016-02-05 00:32 sc_mdb_contact_name
-rw------- u0_a39 u0_a39 225751 2016-02-04 16:07 stm_dump
-rw------- root root 59 2016-02-05 01:01 stm_dump.history
-rw------- u0_a39 u0_a39 0 2016-02-05 00:32 tc_mdb_contact_name
Clearly: dlm_export and stm_dump were empty 2 weeks ago. Due to the nature of cheap backup, I was wondering if by huge hasard, those files were empty due to rsync glitches (if wifi is lost during file transfert, and glitch occurs while working on THIS file ... one chance in a trillion): such a glitch may produce an empty file; one, and ONE ONLY. Not two: rsync can't have corrupted dlm_export AND stm_dump at the same time. Thus, they are both empty due to a HTC Sens bug. The one that often makes the IME forget about second lang, and no vibrator.
Nobody knows if the loss of content of dlm_export could be related to HTC Sense keyboard issues ?
I wiped /data/misc/ to get out of a recovery bootloop. Turns out that doing so breaks the wifi mac address in CM. I'm able to temporarily set my address in /data/wifi/misc/config:
Code:
echo "cur_etheraddr=XX:XX:XX:XX:XX:XX" > /data/misc/wifi/config
The problem is that when I reboot, that file goes back to 00:00:00:00:00:00.
Digging around CM kernel source showed me what files are important.
Code:
CONFIG_BCMDHD_FW_PATH="/system/etc/firmware/fw_bcmdhd.bin"
CONFIG_BCMDHD_NVRAM_PATH="/system/etc/wifi/bcmdhd.cal"
CONFIG_BCMDHD_CONFIG_PATH="/data/misc/wifi/config"
/system/etc/wifi/bcmdhd.cal is showing a good mac address.
I KDZ'ed back to stock and everything worked great there. As soon as I flashed CM14.1 again it didn't work. It isn't a problem with the build, since it was working until I wiped /data/misc/.
Does anyone know how to fix this? I'm curious what config says on a working device, so could someone tell me what it says for them? I want to know 1) if /data/misc/wifi/config exists and 2) if it shows a real mac address or a bunch of zeros. I can't get CM file manager to open the file, so here's how to do it in adb:
Code:
adb shell "su 0 cat '/data/misc/wifi/config'"
What files are in /data/misc/wifi?
I'm not really looking for a workaround, since I could add that first script to a startup script or something. I want a permanent fix that won't go away next time I flash a rom.
Sorry for the long post. Any help would be appreciated. I've spend hours on this already.
Hi!
I also use your workaround now and i automated it, so thanks for ending my pain for the moment, but i would also like to see a permanent fix for this. I tried every available stock rom and all available methods to aply it to bring back what cm seams to be depending on for setting the mac - but no success. To me this looks like a bug - not a very common one, but still a bug because the stock roms do not have any problem at all, only cm does.
br, Martin
theprogramguy said:
Does anyone know how to fix this? I'm curious what config says on a working device, so could someone tell me what it says for them? I want to know 1) if /data/misc/wifi/config exists and 2) if it shows a real mac address or a bunch of zeros.
.
Click to expand...
Click to collapse
I am on RR ROM which is CM based
What I can say is yes this file exists and yes it contains my real MAC address
theprogramguy said:
What files are in /data/misc/wifi?
.
Click to expand...
Click to collapse
[email protected]:/ # ls -la /data/misc/wifi
total 152
drwxrwx--- 4 wifi wifi 4096 2016-12-14 08:12 .
drwxrwx--t 32 system misc 4096 2016-12-04 19:44 ..
-rw-r--r-- 1 system wifi 32 2015-01-02 02:58 config
-rw-rw---- 1 system wifi 21 2015-01-22 07:44 entropy.bin
-rw-rw---- 1 system wifi 252 2016-11-17 15:05 hostapd.conf
-rw------- 1 system system 868 2016-11-14 08:33 ipconfig.txt
-rw------- 1 system system 29695 2016-12-13 11:04 networkHistory.txt
-rw-rw---- 1 wifi wifi 219 2015-01-22 07:44 p2p_supplicant.conf
drwxrwx--- 2 wifi wifi 4096 2015-01-22 07:44 sockets
-rw------- 1 system system 41 2016-11-17 14:54 softap.conf
drwxrwx--- 2 wifi wifi 4096 2015-01-02 02:58 wpa_supplicant
-rw-rw---- 1 wifi wifi 1647 2016-12-14 08:12 wpa_supplicant.conf
[email protected]:/ #
My first thought was that the mac address is generated from the misc partition but as far as I can see it seems to be not. At least I can't find a string matching my current mac.
interesting is that I searched the misc partition (I love Linux and the tool strings) and found my imei written in there..
Well as you wrote you haven't the problem on stock:
Do you cleaned out the WiFi config file before when testing stock? Afaik it should be cleaned out automatically though but just to be sure.. What happens when you delete that file on stock and reboot? Will it get regenerated?
You identified it that the ROM sources are the reason good. But I don't think you should look at the kernel sources only. Check the CM sources as well I believe here you will get better findings.
.
steadfasterX said:
[email protected]:/ # ls -la /data/misc/wifi
total 152
drwxrwx--- 4 wifi wifi 4096 2016-12-14 08:12 .
drwxrwx--t 32 system misc 4096 2016-12-04 19:44 ..
-rw-r--r-- 1 system wifi 32 2015-01-02 02:58 config
-rw-rw---- 1 system wifi 21 2015-01-22 07:44 entropy.bin
-rw-rw---- 1 system wifi 252 2016-11-17 15:05 hostapd.conf
-rw------- 1 system system 868 2016-11-14 08:33 ipconfig.txt
-rw------- 1 system system 29695 2016-12-13 11:04 networkHistory.txt
-rw-rw---- 1 wifi wifi 219 2015-01-22 07:44 p2p_supplicant.conf
drwxrwx--- 2 wifi wifi 4096 2015-01-22 07:44 sockets
-rw------- 1 system system 41 2016-11-17 14:54 softap.conf
drwxrwx--- 2 wifi wifi 4096 2015-01-02 02:58 wpa_supplicant
-rw-rw---- 1 wifi wifi 1647 2016-12-14 08:12 wpa_supplicant.conf
[email protected]:/ #
Click to expand...
Click to collapse
Here's mine. It seems practically the same just missing hostapd.conf. I think I've seen it here before though.
h811:/ # ls -la /data/misc/wifi
total 44
drwxrwx--- 4 wifi wifi 4096 2016-12-14 17:07 .
drwxrwx--t 39 system misc 4096 2014-12-31 19:21 ..
-rw-r--r-- 1 system wifi 32 2016-12-12 18:32 config
-rw-rw---- 1 system wifi 21 2016-12-13 03:15 entropy.bin
-rw------- 1 system system 166 2016-12-13 03:25 ipconfig.txt
-rw------- 1 system system 3814 2016-12-14 17:07 networkHistory.txt
-rw-rw---- 1 wifi wifi 237 2014-12-31 19:26 p2p_supplicant.conf
drwxrwx--- 2 wifi wifi 4096 2016-12-13 03:15 sockets
-rw------- 1 system system 49 2014-12-31 19:25 softap.conf
drwxrwx--- 2 wifi wifi 4096 2014-12-31 19:21 wpa_supplicant
-rw-rw---- 1 wifi wifi 949 2016-12-14 17:07 wpa_supplicant.conf
steadfasterX said:
My first thought was that the mac address is generated from the misc partition but as far as I can see it seems to be not. At least I can't find a string matching my current mac.
Click to expand...
Click to collapse
Maybe it matches the mac in /system/etc/wifi/bcmdhd.cal (macaddr=)? I found that I had a slightly different one there.
steadfasterX said:
You identified it that the ROM sources are the reason good. But I don't think you should look at the kernel sources only. Check the CM sources as well I believe here you will get better findings.
Click to expand...
Click to collapse
https://github.com/CyanogenMod/android_device_lge_g4-common/blob/cm-14.1/hwaddrs/getmac.c
I found this earlier and it shows CM mounting misc and doing something with /data/misc/wifi/config. I thought it was reading config, but it looks like it's actually writing it there after reading it from somewhere else in misc. That would explain why it gets reset. Do you understand where it's reading from? I'm having a hard time reading C.
Specifically this part:
Code:
int fd1, fd2;
char macbyte;
char macbuf[3];
int i;
fd1 = open("/dev/block/bootdevice/by-name/misc",O_RDONLY);
fd2 = open("/data/misc/wifi/config",O_WRONLY|O_CREAT|O_TRUNC,S_IRUSR|S_IWUSR|S_IRGRP|S_IROTH);
write(fd2,"cur_etheraddr=",14);
for (i = 0; i<6; i++) {
lseek(fd1,0x3000+i,SEEK_SET);
lseek(fd2,0,SEEK_END);
read(fd1,&macbyte,1);
sprintf(macbuf,"%02x",macbyte);
write(fd2,&macbuf,2);
if (i!=5) write(fd2,":",1);
}
It looks like our bluetooth mac is getting set in the same way later on.
I'm thinking about setting up a CM build environment again and playing with my own builds to try to see what's up.
steadfasterX said:
interesting is that I searched the misc partition (I love Linux and the tool strings) and found my imei written in there..
Click to expand...
Click to collapse
Nice. I just looked at what CM is reporting my IMEI as, to see if it got reset, but it looks good. I know that cell data is still working, so I'd expect my IMEI to be right.
steadfasterX said:
Well as you wrote you haven't the problem on stock:
Do you cleaned out the WiFi config file before when testing stock? Afaik it should be cleaned out automatically though but just to be sure.. What happens when you delete that file on stock and reboot? Will it get regenerated?
Click to expand...
Click to collapse
I didn't try that. I was in a hurry to get back to CM so I could set it up for daily use. I'll try doing stuff like that soon if we don't figure have anything else to go on. It's getting too late to do it here tonight.
Yesterday I tried to extract misc.img from the kdz but none of the tools I found were able to successfully do it. Something was corrupt. My plan was to look at it or flash it in fastboot and see if anything changes.
GOT IT!
It's actually pretty simple, but I've never done anything quite like this before.
Overview:
Make an img of misc
Edit it in a hex editor
Overwrite misc with the img
Reboot
You could do this entirely on your phone, but I'll walk you through doing it using adb on your computer.
1. Make an img of misc and pull it to your computer.
Code:
adb shell "su -c 'dd if=/dev/block/bootdevice/by-name/misc of=/sdcard/misc.img'"
adb pull /sdcard/misc.img
2. Edit misc.img in a hex editor (I used HexEdit on Windows)
Find the hex offset 3000. Now edit 3000-3005 with your wifi mac address. For example "00 90 3D F1 A2 31".
The bluetooth mac address appears to be stored at 4000, so you could set it there if you wanted/needed to.
3. Write the img
Code:
adb push misc.img /sdcard/misc_edited.img
adb shell "su -c 'dd if=/sdcard/misc_edited.img of=/dev/block/bootdevice/by-name/misc'"
4. Reboot
Code:
adb reboot
If it all works, it's okay to delete the img files we left in /sdcard
Code:
adb shell "rm /sdcard/misc*.img"
Makes totally sense! Just for your information the file in
/system/etc/wifi/bcmdhd.cal
contains a mac address but it is not the same as in the Wi-Fi config file
Thanks for sharing this walkthrough it will help others having the same issue
Thank you!!
You are a MF genius!!! I have the same problem but with an LG G3 Beat, and I wanted to know if this works the same with my device. Thank you bro!
I have Kodi installed and been having problem with "low storage" and continuous hangs on the system. It is rooted.
I was checking file sizes and noticed that this one is suspiciously quiet large:
/data/data/com.amazon.tv.launcher/databases/mbcache.db
[email protected]:/data/data/com.amazon.tv.launcher/databases # ls -l
-rw-rw---- amz_a46 amz_a46 20480 2016-12-18 16:29 cmsapi.db
-rw-rw---- amz_a46 amz_a46 12824 2016-12-18 16:29 cmsapi.db-journal
-rw-rw---- amz_a46 amz_a46 3998175232 2016-12-18 16:32 mbcache.db
-rw------- amz_a46 amz_a46 65536 2016-12-18 16:32 mbcache.db-shm
-rw------- amz_a46 amz_a46 524288 2016-12-18 16:32 mbcache.db-wal
On a system that has total 5GB this seems troubling.
Not sure where is the problem. How to fix this?
I have the same exact problem! Rooted aftv1, this has happened first time few weeks ago, it took some time to find this file and delete it. two days ago I found it already grown again to 4gb.
Tried to change file permission but it's still growing.
Any help from the experts would be really appreciated.
Is it safe to delete mbcache.db?
blurp76 said:
I have the same exact problem! Rooted aftv1, this has happened first time few weeks ago, it took some time to find this file and delete it. two days ago I found it already grown again to 4gb.
Tried to change file permission but it's still growing.
Any help from the experts would be really appreciated.
Click to expand...
Click to collapse
Thanks for your reply.
Yes, I deleted it, back it is growing back. What is weird is this only been happening recently, and I have not done any changes to my FireTV 1. i am wondering if Amazon launcher has changed and expected all users to have updated their firmwares to something more recent that what I have.
I hope someone would be able to help us figure this out.
sneezing_corgi said:
Is it safe to delete mbcache.db?
Click to expand...
Click to collapse
Yes, safe to delete, but it grows back.
blacknwhite77 said:
I have Kodi installed and been having problem with "low storage" and continuous hangs on the system. It is rooted.
I was checking file sizes and noticed that this one is suspiciously quiet large:
/data/data/com.amazon.tv.launcher/databases/mbcache.db
[email protected]:/data/data/com.amazon.tv.launcher/databases # ls -l
-rw-rw---- amz_a46 amz_a46 20480 2016-12-18 16:29 cmsapi.db
-rw-rw---- amz_a46 amz_a46 12824 2016-12-18 16:29 cmsapi.db-journal
-rw-rw---- amz_a46 amz_a46 3998175232 2016-12-18 16:32 mbcache.db
-rw------- amz_a46 amz_a46 65536 2016-12-18 16:32 mbcache.db-shm
-rw------- amz_a46 amz_a46 524288 2016-12-18 16:32 mbcache.db-wal
On a system that has total 5GB this seems troubling.
Not sure where is the problem. How to fix this?
Click to expand...
Click to collapse
Did you figure this out? I wonder if it's Photos coming from amazon...4GB seems extreme but if it were left unattended maybe. First try going into settings>manage apps>photos and clear cache then check the to see if mbcache reduced in size. If so then there's your issue. Set your screensaver to something else or maybe turn it off. Let me know how you make out. I might be able to help
KLit75 said:
Did you figure this out? I wonder if it's Photos coming from amazon...4GB seems extreme but if it were left unattended maybe. First try going into settings>manage apps>photos and clear cache then check the to see if mbcache reduced in size. If so then there's your issue. Set your screensaver to something else or maybe turn it off. Let me know how you make out. I might be able to help
Click to expand...
Click to collapse
Hi Klite75,
I checked photos app and there is not much data there, around 5M, I cleared the cache but nothing affected the mbcache. I also checked the screensaver and found that I have it off, and "never" run.
What is weird is that the FireTV has been off since yesterday, but when I checked the mbcache.db file through adb from my PC I found that it was accessed some 30 minutes ago?!!! Who is accessing this file while the FireTV off?
[email protected]:/data/data/com.amazon.tv.launcher/databases # ll
-rw-rw---- amz_a46 amz_a46 20480 2016-12-19 19:43 cmsapi.db
-rw-rw---- amz_a46 amz_a46 12824 2016-12-19 19:43 cmsapi.db-journal
-rw-rw---- amz_a46 amz_a46 64180224 2016-12-20 18:17 mbcache.db
-rw------- amz_a46 amz_a46 32768 2016-12-20 18:17 mbcache.db-shm
-rw------- amz_a46 amz_a46 11317672 2016-12-20 18:17 mbcache.db-wal
blacknwhite77 said:
Hi Klite75,
I checked photos app and there is not much data there, around 5M, I cleared the cache but nothing affected the mbcache. I also checked the screensaver and found that I have it off, and "never" run.
What is weird is that the FireTV has been off since yesterday, but when I checked the mbcache.db file through adb from my PC I found that it was accessed some 30 minutes ago?!!! Who is accessing this file while the FireTV off?
[email protected]:/data/data/com.amazon.tv.launcher/databases # ll
-rw-rw---- amz_a46 amz_a46 20480 2016-12-19 19:43 cmsapi.db
-rw-rw---- amz_a46 amz_a46 12824 2016-12-19 19:43 cmsapi.db-journal
-rw-rw---- amz_a46 amz_a46 64180224 2016-12-20 18:17 mbcache.db
-rw------- amz_a46 amz_a46 32768 2016-12-20 18:17 mbcache.db-shm
-rw------- amz_a46 amz_a46 11317672 2016-12-20 18:17 mbcache.db-wal
Click to expand...
Click to collapse
Fire tv doesn't really turn off.
I checked mine (aftv1 rooted running OS5) & mbcache is filling up--about 32 MB.
If I had to wager a guess Id say theres an app thats downloading lots of data.
I did a little search but came up with nada
If I had time to wait around I might sit tight, maybe someone has a solution...
Otherwise do a factory reset and see if it happens again.
KLit75 said:
Fire tv doesn't really turn off.
I checked mine (aftv1 rooted running OS5) & mbcache is filling up--about 32 MB.
If I had to wager a guess Id say theres an app thats downloading lots of data.
I did a little search but came up with nada
If I had time to wait around I might sit tight, maybe someone has a solution...
Otherwise do a factory reset and see if it happens again.
Click to expand...
Click to collapse
Would it be possible for me to track the network connections the FireTV has, and which ones are being active? Maybe that would give me a clue which app is doing that. But I have no idea how to do such network monitoring.
blacknwhite77 said:
Would it be possible for me to track the network connections the FireTV has, and which ones are being active? Maybe that would give me a clue which app is doing that. But I have no idea how to do such network monitoring.
Click to expand...
Click to collapse
Anything's possible, unfortunately off the top of my head I dont have a method. Long shot youd have one but years ago I'm pretty sure I could keep tabs on that when I had DDWRT installed on my router.
***speaking of my fuzzy memory (read lots of stuff here) and Im about 80% certain someone posted here that was able to track specific network activity, though he didn't share his method. Don't think anyone asked.
Sorry. I've come to the conclusion that if I spend too much time struggling with android, the easiest thing to do is nuke it--factory reset. You can make a backup 1st so if the issue reappears you just go back and your data will be there.
Between last night and this morning, I did not switch on the FireTV and to my knowledge all applications are (forced quit).
But I see the the mbcache.db file has increased from 64M to 88M. There is definitely something going on that is not right.
[email protected]:/data/data/com.amazon.tv.launcher/databases # ll
-rw-rw---- amz_a46 amz_a46 20480 2016-12-19 19:43 cmsapi.db
-rw-rw---- amz_a46 amz_a46 12824 2016-12-19 19:43 cmsapi.db-journal
-rw-rw---- amz_a46 amz_a46 64180224 2016-12-20 18:17 mbcache.db
-rw------- amz_a46 amz_a46 32768 2016-12-20 18:17 mbcache.db-shm
-rw------- amz_a46 amz_a46 11317672 2016-12-20 18:17 mbcache.db-wal
[email protected]:/data/data/com.amazon.tv.launcher/databases # ll
-rw-rw---- amz_a46 amz_a46 20480 2016-12-19 19:43 cmsapi.db
-rw-rw---- amz_a46 amz_a46 12824 2016-12-19 19:43 cmsapi.db-journal
-rw-rw---- amz_a46 amz_a46 88875008 2016-12-21 07:43 mbcache.db
-rw------- amz_a46 amz_a46 65536 2016-12-21 07:43 mbcache.db-shm
-rw------- amz_a46 amz_a46 524288 2016-12-21 07:43 mbcache.db-wal
I have spare ddwrt router that I can program as a switch and have it sit in between the FireTV and the 1st router. But I don't know how to monitor all traffic going through this 2bd ddwrt router. Any help is appreciated.
I did chmod on the file to 0.
So far it has not accumulated any more data, hopefully that solves the issue.
Code:
[email protected]:/data/data/com.amazon.tv.launcher/databases # ll
-rw-rw---- amz_a46 amz_a46 20480 2016-12-21 19:34 cmsapi.db
-rw-rw---- amz_a46 amz_a46 12824 2016-12-21 19:34 cmsapi.db-journal
---------- root root 0 2016-12-22 23:33 mbcache.db
-rw------- amz_a46 amz_a46 294912 2016-12-22 21:07 mbcache.db-shm
-rw------- amz_a46 amz_a46 17271072 2016-12-22 21:07 mbcache.db-wal
[email protected]:/data/data/com.amazon.tv.launcher/databases # ll
-rw-rw---- amz_a46 amz_a46 20480 2016-12-21 19:34 cmsapi.db
-rw-rw---- amz_a46 amz_a46 12824 2016-12-21 19:34 cmsapi.db-journal
---------- root root 0 2016-12-22 23:33 mbcache.db
-rw------- amz_a46 amz_a46 294912 2016-12-23 09:51 mbcache.db-shm
-rw------- amz_a46 amz_a46 828152 2016-12-23 09:51 mbcache.db-wal
[email protected]:/data/data/com.amazon.tv.launcher/databases # ll
-rw-rw---- amz_a46 amz_a46 20480 2016-12-21 19:34 cmsapi.db
-rw-rw---- amz_a46 amz_a46 12824 2016-12-21 19:34 cmsapi.db-journal
---------- root root 0 2016-12-22 23:33 mbcache.db
-rw------- amz_a46 amz_a46 294912 2016-12-23 09:51 mbcache.db-shm
-rw------- amz_a46 amz_a46 828152 2016-12-23 09:51 mbcache.db-wal
[email protected]:/data/data/com.amazon.tv.launcher/databases # ll
-rw-rw---- amz_a46 amz_a46 20480 2016-12-21 19:34 cmsapi.db
-rw-rw---- amz_a46 amz_a46 12824 2016-12-21 19:34 cmsapi.db-journal
---------- root root 0 2016-12-22 23:33 mbcache.db
-rw------- amz_a46 amz_a46 294912 2016-12-23 09:51 mbcache.db-shm
-rw------- amz_a46 amz_a46 828152 2016-12-23 09:51 mbcache.db-wal
[email protected]:/data/data/com.amazon.tv.launcher/databases # ll
-rw-rw---- amz_a46 amz_a46 20480 2016-12-21 19:34 cmsapi.db
-rw-rw---- amz_a46 amz_a46 12824 2016-12-21 19:34 cmsapi.db-journal
---------- root root 0 2016-12-22 23:33 mbcache.db
-rw------- amz_a46 amz_a46 294912 2016-12-23 09:51 mbcache.db-shm
-rw------- amz_a46 amz_a46 828152 2016-12-23 09:51 mbcache.db-wal
[email protected]:/data/data/com.amazon.tv.launcher/databases # ll
-rw-rw---- amz_a46 amz_a46 20480 2016-12-23 12:38 cmsapi.db
-rw-rw---- amz_a46 amz_a46 12824 2016-12-23 12:38 cmsapi.db-journal
---------- root root 0 2016-12-22 23:33 mbcache.db
-rw------- amz_a46 amz_a46 294912 2016-12-23 12:39 mbcache.db-shm
-rw------- amz_a46 amz_a46 524288 2016-12-23 12:39 mbcache.db-wal
blacknwhite77 said:
I did chmod on the file to 0.
So far it has not accumulated any more data, hopefully that solves the issue.
Click to expand...
Click to collapse
I too started running into the out of storage space problem a few weeks ago and arrived at the large mbcache.db and mbcache.db-wal files. I SCP'd them off of the firetv to look at offline, and they are SQLite database files that seem to cache all of the app/media metadata information that is pulled down from amazon (name/description/links to images and background images/etc).
Some sample snippets from the database:
Code:
$strings -a mbcache.db | head -n1
SQLite format 3
$strings -a mbcache.db | egrep ^text | head -n10
textOFields of Battle
textMBest of Movies
textPRecently Added TV
textJTrending TV
textZOriginal & Exclusive Movies
textSRecommended Drama TV
textaRecommended Science Fiction Movies
textNElection Movies
textWTop Movies & TV on Prime
textWAmazon Original Comedies
Note: XDA wouldn't let me post links, but I wanted to demonstrate above that the database also calls images/background images via http for items in the launcher.
I don't think removing the permissions that make these files writable is necessarily the correct fix though, or at least if you still plan on using the stock Amazon launcher, which many of us do. When this file is not writable (chmod 0), several of the menu items (home/prime/tv/movies/etc) will not populate with anything and get stuck on a loading screen and remain empty. The device needs to be able to pull down metadata and write to the mbcache files for items to populate in these menus.
After I removed the files and rebooted the firetv, the new mbcache file created was about 5mb. I'll need to do some monitoring to see how often this file is written to and how quickly it grows, but I suspect what is happening is this file is append only and continues to grow as new items are added to the amazon library online and are cached locally on the firetv. If that is the case, it makes me wonder if it was an oversight in the firmware coding to not set a max file size and clean/purge old cached items. If it's a slow increase of ~5mb per day or so, that might explain why it took so long to finally exhaust all available free space on the firetv and only recently started becoming an apparently issue for us.
I'm currently running 51.1.6.3. I'm going to monitor/test for a few days on this firmware, and then I'm going to flash the latest pre-rooted stock 5.2.1.1 and see if there's any difference. If there is nothing in the firmware to limit the size that this file can grow to or purge old cached items out, then it might need to be a file that needs to be manually removed by users at some regular interval (1-12 months) or something.
For anyone not using the amazon launcher (firedtvlauncher or similar), then the chmod 0 solution will probably be fine. My comments are really more aimed at retaining stock amazon launcher functionality while addressing the file size issue.
This is just after some preliminary troubleshooting and will need to do some further monitoring/testing, but hope this info helps for anyone else running into the problem.
entropyaz said:
I too started running into the out of storage space problem a few weeks ago and arrived at the large mbcache.db and mbcache.db-wal files. I SCP'd them off of the firetv to look at offline, and they are SQLite database files that seem to cache all of the app/media metadata information that is pulled down from amazon (name/description/links to images and background images/etc).
Some sample snippets from the database:
Code:
$strings -a mbcache.db | head -n1
SQLite format 3
$strings -a mbcache.db | egrep ^text | head -n10
textOFields of Battle
textMBest of Movies
textPRecently Added TV
textJTrending TV
textZOriginal & Exclusive Movies
textSRecommended Drama TV
textaRecommended Science Fiction Movies
textNElection Movies
textWTop Movies & TV on Prime
textWAmazon Original Comedies
Note: XDA wouldn't let me post links, but I wanted to demonstrate above that the database also calls images/background images via http for items in the launcher.
I don't think removing the permissions that make these files writable is necessarily the correct fix though, or at least if you still plan on using the stock Amazon launcher, which many of us do. When this file is not writable (chmod 0), several of the menu items (home/prime/tv/movies/etc) will not populate with anything and get stuck on a loading screen and remain empty. The device needs to be able to pull down metadata and write to the mbcache files for items to populate in these menus.
After I removed the files and rebooted the firetv, the new mbcache file created was about 5mb. I'll need to do some monitoring to see how often this file is written to and how quickly it grows, but I suspect what is happening is this file is append only and continues to grow as new items are added to the amazon library online and are cached locally on the firetv. If that is the case, it makes me wonder if it was an oversight in the firmware coding to not set a max file size and clean/purge old cached items. If it's a slow increase of ~5mb per day or so, that might explain why it took so long to finally exhaust all available free space on the firetv and only recently started becoming an apparently issue for us.
I'm currently running 51.1.6.3. I'm going to monitor/test for a few days on this firmware, and then I'm going to flash the latest pre-rooted stock 5.2.1.1 and see if there's any difference. If there is nothing in the firmware to limit the size that this file can grow to or purge old cached items out, then it might need to be a file that needs to be manually removed by users at some regular interval (1-12 months) or something.
For anyone not using the amazon launcher (firedtvlauncher or similar), then the chmod 0 solution will probably be fine. My comments are really more aimed at retaining stock amazon launcher functionality while addressing the file size issue.
This is just after some preliminary troubleshooting and will need to do some further monitoring/testing, but hope this info helps for anyone else running into the problem.
Click to expand...
Click to collapse
Thank you very much!
Yes, I suspected the file has to do with Amazon launcher caching media, but did not have the proper skills to investigate the file, you did an excellent job there.
I have been thinking about flashing to a newer firmware but I dont want to lose root. It is a first gen firetv so it might also start to slow down with new firmware.
You are correct about the "no movies loaded" at the start screen after I chmod permissions, but so far this was the only thing that worked. I already tried to remove the file but it starts piling up really quickly, I am sure Amazon started allowing higher resolution media which eats memory quicker (maybe a way to slow down devices and forces people buying the next gen).
Anyways, keep us informed on what you find and come up with as a solution.
My best guess is that it has to do with FW 5.2.4.0 & all the changes it brings. Specially on the server side of things. This just started to happen as this changes took place.
http://www.aftvnews.com/fire-tv-update-5-2-4-0-was-halted-due-to-appstore-server-load-concerns/
As for the mbcache.db & related files being reconstructed very quickly even after being deleted I think it's related to this new FW 5.2.4.0 GUI "feature" (auto-playing video and audio on home screen interface) which we on older FW have no way of controlling. And there for this cache repopulate themselves in days. When we have never been affected by this for years of our devices usage.
http://www.aftvnews.com/how-to-disa...dio-on-the-new-fire-tv-home-screen-interface/
This is all my assumption, but I think it's no coincidence that for the most part FireOS 3 devices on really old FW are the worst affected. Newer FW handles this cache's better since Amazon knew their cache needs where increasing with each update & new features & GUI changes.
One of my FTV1's is @ the latest PreRooted Rom. That MBCache.db is @ 18.6 MiB after a week of usage. This is why I think age of FW has to do with outdated handling of the MBCache.db & other cache files in my opinion.
Bottom line, the older FW you have on your FTV1 the more likely to have this "out of space" due to MBCache.db problems.
I dealt with this issue back in early December or so. I deleted the mbcache.db and freed up GBs of space. Of course it has grown to GBs of space again, so I just deleted it again. Well not sure what was different from last time to this time, but I noticed my TV went blank; I couldn't get the AFTV to display anything. Pressed all the buttons, turned my TV on and off, cycled inputs, just figured it was a glitch. So, I finally tried the force reset, by holding the Home and Play buttons. To my surprise it actually rebooted, so I felt better. It showed the Amazon splash screen and my Boot recovery options, but when it got fully loaded, the TV screen was blank again. I tried to run kodi using my press Home button twice shortcut, but it didn't work.
I keep checking the database to see if it is growing, but it seems to be stuck at 5536. I'm curious, is it safe to delete the other file databases in the databases folder? I'm curious if one of them became corrupted or got out of sync with the mbcache.db when I deleted it.
Modify_inc said:
I dealt with this issue back in early December or so. I deleted the mbcache.db and freed up GBs of space. Of course it has grown to GBs of space again, so I just deleted it again. Well not sure what was different from last time to this time, but I noticed my TV went blank; I couldn't get the AFTV to display anything. Pressed all the buttons, turned my TV on and off, cycled inputs, just figured it was a glitch. So, I finally tried the force reset, by holding the Home and Play buttons. To my surprise it actually rebooted, so I felt better. It showed the Amazon splash screen and my Boot recovery options, but when it got fully loaded, the TV screen was blank again. I tried to run kodi using my press Home button twice shortcut, but it didn't work.
I keep checking the database to see if it is growing, but it seems to be stuck at 5536. I'm curious, is it safe to delete the other file databases in the databases folder? I'm curious if one of them became corrupted or got out of sync with the mbcache.db when I deleted it.
Click to expand...
Click to collapse
Same here. What I thought was the solution (changing permissions on the file) actually messed up my FireTV. I can't even power the FireTV on from my remote, I have to pull the plug and replug, and even then I get to the loading movies/...etc screen with spinning wheel for ever, remote doesn't do anything.
I am wondering if it is time to load a ROM or something that has the newest firmware bits but keep root.
Or maybe simply move on and buy a FireTV 2.
I too have been having this low memory issue. I'm on quite an old firmware and also having an issue with the FireTv randomly rebooting to recovery (CWM). I don't even have much installed on my system. I have a simple Kodi (No library content on it), Netflix, YouTube, and Total Commander and I still consistently run out of space. At most, I've only been able to keep about .5 gig free. When I get home tonight I will check the size of these files and see how much it frees up. I think it is time to take the plunge and install TWRP then the latest pre-root. I don't think I can keep firestarter running after that though. :/
Might be useful to just write a small script that runs at boot to delete the file and force it to start over.
mattvirus said:
Might be useful to just write a small script that runs at boot to delete the file and force it to start over.
Click to expand...
Click to collapse
The only thru solution is to upgrade FW to FireOS 5. Since the cache file will quickly rebuild itself.