Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Error creating imagefile (Read-only file system)

Tags:

android

First of all this is not duplicate question and I have tried solutions from other similar threads but it looks like this case is different.

In my case I can successfully install and run other android project from the same emulator (x86 also tried arm) but this particular app project throws following error when installing also manually "adb install" from inside shell do not work either.

One of the error from log below is found (line number 232) https://android.googlesource.com/platform/system/vold/+/froyo/Loop.cpp

However I do not know if the error "No content provider..." is related to the same error stack.

If it had the write-permission error (sdcard or file system permission like that) then other apps should also not install!

This problematic app is a NDK project with a custom content provider which I tried omitting but no avail. it seems like content provider error is related to apk installation from os and not really the content provider from within the app.

I am tired of testing with a real device, I am worried this would degrade my phones life because I had to do it very often.

--------- beginning of /dev/log/main
D/AndroidRuntime( 1977): 
D/AndroidRuntime( 1977): >>>>>> AndroidRuntime START com.android.internal.os.RuntimeInit <<<<<<
W/linker  ( 1977): libdvm.so has text relocations. This is wasting memory and is a security risk. Please fix.
D/AndroidRuntime( 1977): CheckJNI is ON
D/dalvikvm( 1977): Trying to load lib libjavacore.so 0x0
D/dalvikvm( 1977): Added shared lib libjavacore.so 0x0
D/dalvikvm( 1977): Trying to load lib libnativehelper.so 0x0
D/dalvikvm( 1977): Added shared lib libnativehelper.so 0x0
D/dalvikvm( 1977): No JNI_OnLoad found in libnativehelper.so 0x0, skipping init
D/dalvikvm( 1977): Note: class Landroid/app/ActivityManagerNative; has 179 unimplemented (abstract) methods
E/memtrack( 1977): Couldn't load memtrack module (No such file or directory)
E/android.os.Debug( 1977): failed to load memtrack module: -2
D/AndroidRuntime( 1977): Calling main entry com.android.commands.pm.Pm
E/PackageHelper( 1680): Failed to create secure container smdl2tmp1
--------- beginning of /dev/log/system
W/ActivityManager( 1149): No content provider found for permission revoke: file:///data/local/tmp/myapp.apk
E/Vold    (  932): Error creating imagefile (Read-only file system)
E/Vold    (  932): ASEC image file creation failed (Read-only file system)
W/Vold    (  932): Returning OperationFailed - no handler for errno 30
E/DefContainer( 1680): Failed to create container smdl2tmp1
W/ActivityManager( 1149): No content provider found for permission revoke: file:///data/local/tmp/myapp.apk
D/dalvikvm( 1149): GC_EXPLICIT freed 161K, 22% free 5442K/6948K, paused 1ms+1ms, total 8ms
D/AndroidRuntime( 1977): Shutting down VM
like image 983
duckduckgo Avatar asked Jan 08 '23 09:01

duckduckgo


1 Answers

The problem might be either from:

  • an Android AOSP bug or a bug in the ROM you are using (misconfiguration)
  • something has caused the partition where the apps installed on the SD Card (or an emulated internal card) are stored, to be read only

"Apps on SD card are stored in an encrypted container for platform security purposes -- so that other applications can not modify or corrupt them. When mounting the SD card, these containers are mounted so that they can be accessed in the same way as apps stored in internal storage."

On your stacktrace the problem is this:

E/Vold ( 932): Error creating imagefile (Read-only file system)
E/Vold ( 932): ASEC image file creation failed (Read-only file system)

I've had a similar problem with an application that had defined in its AndroidManifest.xml the android:installLocation="preferExternal" and the following things worked for me (done independently of one another):

I/qtaguid ( 6299): Failed write_ctrl(u 40) res=-1 errno=22
I/qtaguid ( 6299): Untagging socket 40 failed errno=-22
W/NetworkManagementSocketTagger( 6299): untagSocket(40) failed with errno -22
D/Finsky  ( 6299): [1] 2.onResponse: Verification id=29 response=0
D/Finsky  ( 6299): [1] PackageVerificationReceiver.onReceive: Verification requested, id = 29
E/Vold    (  127): Error creating imagefile (Read-only file system)
E/Vold    (  127): ASEC image file creation failed (Read-only file system)
W/Vold    (  127): Returning OperationFailed - no handler for errno 30
E/PackageHelper( 6280): Failed to create secure container smdl733025106.tmp
W/DefContainer( 6280): Failed to copy package at /storage/emulated/0/myapp.apk
W/DefContainer( 6280): java.io.IOException: Failed to create container smdl733025106.tmp
W/DefContainer( 6280):  at com.android.defcontainer.DefaultContainerService.copyPackageToContainerInner(DefaultContainerService.java:327)
W/DefContainer( 6280):  at com.android.defcontainer.DefaultContainerService.access$000(DefaultContainerService.java:67)
W/DefContainer( 6280):  at com.android.defcontainer.DefaultContainerService$1.copyPackageToContainer(DefaultContainerService.java:108)
W/DefContainer( 6280):  at com.android.internal.app.IMediaContainerService$Stub.onTransact(IMediaContainerService.java:60)
W/DefContainer( 6280):  at android.os.Binder.execTransact(Binder.java:446)
  • As per https://developer.android.com/guide/topics/data/install-location.html change to android:installLocation="auto"

  • As per http://forum.xda-developers.com/showpost.php?p=58409922&postcount=4845 If you want to install it to "internal device storage", regardless of what the manifest says or what the system decides.

    Go to Settings > Apps > Open the menu > Preferred install location > set it to "Internal device storage". I had this set to "Let the system decide". This caused some of the APKs to fail the install, because they were marked to prefer the SD card as their installation location and thus they tried to install onto the SD and it just failed. Now that everything installs on the device, it works just fine.

  • If you want to install it to the "external storage"

    adb root
    adb shell
    mount -o rw,remount rootfs /
    chmod 777 /mnt/sdcard
    pm install /mnt/sdcard/myapp.apk
    mount -o ro,remount rootfs /

  • As per https://code.google.com/p/android/issues/detail?id=9593 && http://www.androidpolice.com/2011/04/19/fixing-the-couldnt-install-on-usb-storage-or-sd-card-problem-on-android/
    Only if you are able to find the smdl2tmp1.asec at the following paths or you get error

    smdl2tmp1 03-24 18:48:38.784: ERROR/Vold(86): ASEC file '/mnt/secure/asec/smdl2tmp1.asec' currently exists - destroy it first! (Address already in use)

    adb root
    adb shell rm /sdcard/.android_secure/smdl2tmp1.asec
    adb shell rm /mnt/secure/asec/smdl2tmp1.asec

like image 63
Alex Bitek Avatar answered Jan 15 '23 21:01

Alex Bitek