neurodroid / cryptonite

EncFS and TrueCrypt on Android
GNU General Public License v2.0
203 stars 49 forks source link

on terminal df gives I/O error #23

Closed neurodroid closed 10 years ago

neurodroid commented 10 years ago

From betaf...@gmail.com on May 15, 2012 20:44:10

What steps will reproduce the problem? 1. terminal

  1. df -h
  2. I/O error on encfs mountpoint.
  3. ls mountpoint shows the files without problems What is the expected output? What do you see instead? see above What version of the product are you using? On what operating system? latest Please provide any additional information below. is is fixable by you? without a fix i cannot mount bind some folder to the encfs mountpoint, camera says "sdcard not accessable"

Original issue: http://code.google.com/p/cryptonite/issues/detail?id=23

neurodroid commented 10 years ago

From christoph.schmidthieber@gmail.com on May 16, 2012 13:02:36

While I can reproduce this error, I have no idea what is causing it. Maybe the busybox/bionic flavour of df can't deal with nodev mounts? How exactly do you "mount bind" to the encfs mount point?

neurodroid commented 10 years ago

From betaf...@gmail.com on May 16, 2012 13:11:46

mount -o bind /mnt/encfs/bilder /mnt/sdcard/DCIM

neurodroid commented 10 years ago

From christoph.schmidthieber@gmail.com on May 31, 2012 14:01:04

"mount -o bind' seems to work for some users (see issue #28 ) while df fails so that I'm not sure whether the df problem is related at all. What's the error message when you try to execute "mount -o bind'?

neurodroid commented 10 years ago

From betaf...@gmail.com on June 01, 2012 09:37:43

mount bind works. the only problem is the camera app refused to work when i bind the dcim folder. i think becaus it cannot stat the free space.

neurodroid commented 10 years ago

From sigintma...@gmail.com on September 13, 2012 08:34:07

Problem located not in cryptonite itself, but in .../encfs-1.7.4/encfs/encfs.cpp: encfs_statfs() function. This handler not implemented for Android and do nothing, just return status -EIO. As result system can't get statfs data for encfs mount point and can't show free space on the volume. Many programs can't handle this situation. If you do replacement(converter) code from missing function statvfs() to statfs() function from Android NDK and try recompiled encfs binary, you'll see df command show stats now.

I'm perform some tests with this code: ...

include <sys/vfs.h>

... // statfs works even if encfs is detached.. int encfs_statfs(const char path, struct statvfs st) { EncFS_Context *ctx = context();

int res = -EIO;

//ifndef ANDROID //TODO: find equivalent for Android try { (void)path; // path should always be '/' for now.. rAssert( st != NULL ); string cyName = ctx->rootCipherDir;

rLog(Info, "doing statfs of %s", cyName.c_str());

struct statfs buf;

memset(&buf,0,sizeof(buf));
res = statfs(cyName.c_str(), &buf);

//res = statvfs( cyName.c_str(), st );
if(!res) 
{
st->f_bsize=buf.f_bsize;
    st->f_frsize=buf.f_frsize;
    st->f_blocks=buf.f_blocks;
    st->f_bfree=buf.f_bfree;
    st->f_bavail=buf.f_bavail;
    st->f_files=buf.f_files;
    st->f_ffree=buf.f_ffree;
    st->f_favail=buf.f_ffree;
    st->f_fsid|=buf.f_fsid.__val[1];
    st->f_fsid<<=16;
    st->f_fsid|=buf.f_fsid.__val[0];
    st->f_flag=0;
    st->f_namemax=buf.f_namelen;
    // adjust maximum name length..
    st->f_namemax     = 6 * (st->f_namemax - 2) / 8; // approx..
}
if(res == -1)
    res = -errno;
} catch( rlog::Error &err )
{
rError("error caught in statfs");
err.log( _RLWarningChannel );
}

//endif return res; }

neurodroid commented 10 years ago

From christoph.schmidthieber@gmail.com on September 13, 2012 09:03:25

Thanks for the info. Will try to test your patch this weekend. If you have some time, could you try to modify encfs-android.patch so that it incorporates your changes? That would make it easier to apply your patch. There's a helper script (mkpatch.sh) to generate the patch.

neurodroid commented 10 years ago

From sigintma...@gmail.com on September 14, 2012 10:03:40

Patch generated by mkpatch.sh This monkey code need to be tested, because some differences in POSIX stavfs() and old style statfs()

Attachment: encfs-android.patch

neurodroid commented 10 years ago

From christoph.schmidthieber@gmail.com on September 15, 2012 12:20:23

Applied in r728d0e309fd6 . BuildInstructions have changed considerably:

neurodroid commented 10 years ago

From christoph.schmidthieber@gmail.com on September 15, 2012 12:20:52

Status: Started
Owner: christoph.schmidthieber@gmail.com

neurodroid commented 10 years ago

From betaf...@gmail.com on September 16, 2012 01:36:59

yes it works....

neurodroid commented 10 years ago

From christoph.schmidthieber@gmail.com on October 01, 2012 10:33:44

Status: FixVerified

neurodroid commented 10 years ago

From zydio....@gmail.com on December 29, 2012 04:26:05

I can confirm this problem being still present on Cryptonite 0.7.6 installed from Google Play. I have some folders in a ENCFS mountpoint, one of those folder is the DCIM that is bound to /sdcard/DCIM like this:

busybox mount -o bind /sdcard/descrypted_folder/DICM /sdcard/DCIM

With Cryptonite 0.7.6 I still get "Can't access SD Card" (in another language) as soon as I open the stock Camera APP (CyanogenMod 9.1 with GApps). The Camera App succeeds in creating the "/sdcard/DCIM/Camera" folder, but it fails on statfs. The logcat reads: E/ ( 3417): statfs /mnt/sdcard/DCIM/Camera failed, errno: 5 (..) I/CameraStorage( 3417): Fail to access external storage I/CameraStorage( 3417): java.lang.IllegalArgumentException I/CameraStorage( 3417): at android.os.StatFs.native_setup(Native Method) I/CameraStorage( 3417): at android.os.StatFs.(StatFs.java:32) I/CameraStorage( 3417): at com.android.camera.Storage.getAvailableSpace(Storage.java:127) I/CameraStorage( 3417): at com.android.camera.Camera.checkStorage(Camera.java:1496) I/CameraStorage( 3417): at com.android.camera.Camera.initializeFirstTime(Camera.java:476) I/CameraStorage( 3417): at com.android.camera.Camera.access$700(Camera.java:86) I/CameraStorage( 3417): at com.android.camera.Camera$MainHandler.handleMessage(Camera.java:313) I/CameraStorage( 3417): at android.os.Handler.dispatchMessage(Handler.java:99) I/CameraStorage( 3417): at android.os.Looper.loop(Looper.java:137) I/CameraStorage( 3417): at android.app.ActivityThread.main(ActivityThread.java:4575) I/CameraStorage( 3417): at java.lang.reflect.Method.invokeNative(Native Method) I/CameraStorage( 3417): at java.lang.reflect.Method.invoke(Method.java:511) I/CameraStorage( 3417): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:789) I/CameraStorage( 3417): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:556) I/CameraStorage( 3417): at dalvik.system.NativeStart.main(Native Method)

I downloaded and replaced 0.7.6 encfs with the "encfs binary with df support" ( https://code.google.com/p/cryptonite/downloads/detail?name=encfs&can=1&q= ) you published on September, and the Camera app now works just fine! The problem is: shouldn't this fix be included in any late release Cryptonite release?! Is this a regression?

Thank you.

neurodroid commented 10 years ago

From christoph.schmidthieber@gmail.com on January 01, 2013 03:21:09

This issue was closed by revision 6f2779f41a5b .

Status: Fixed

neurodroid commented 10 years ago

From christoph.schmidthieber@gmail.com on January 01, 2013 03:23:24

Thanks for reporting. The patch had only been applied to the development version of encfs. I've backported it to encfs 1.7.4 so that this should be fixed in the next release.

neurodroid commented 10 years ago

From christoph.schmidthieber@gmail.com on January 01, 2013 11:46:57

Please test the latest alpha (0.7.7): https://code.google.com/p/cryptonite/downloads/list

neurodroid commented 10 years ago

From zydio....@gmail.com on January 02, 2013 02:28:26

The 0.7.7 alpha works just fine, "df" reports the free space, and the Camera app works just fine. Thank you!

neurodroid commented 10 years ago

From robert.c...@gmail.com on April 10, 2013 11:14:53

Tested df with aplha 0.7.7 and it still appears to be broken.

neurodroid commented 10 years ago

From betaf...@gmail.com on May 09, 2013 01:40:31

on my new galaxy s4 the problem reappears with the original samsung firmware :(

neurodroid commented 10 years ago

From betaf...@gmail.com on May 09, 2013 05:07:27

ok https://code.google.com/p/cryptonite/downloads/detail?name=encfs&can=1&q= works..why is this patch not in the latest alpha..but anyways..thanx that we have encfs on android robert :D