[T-Mobile Galaxy Note 4 Android Development] c0ns0le:
SDCards corruption issue is due to the fsck.exfat binary segfaulting:

❯ adb shell
root@trltetmo:/ # type fsck.exfat
fsck.exfat is /system/bin/fsck.exfat
root@trltetmo:/ # fsck.exfat -h
Segmentation fault
139|root@trltetmo:/ # fsck.exfat
Segmentation fault
139|root@trltetmo:/ #

logcat output:

01-15 15:47:03.109: A/DEBUG(404): *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** ***
01-15 15:47:03.109: A/DEBUG(404): Build fingerprint: 'samsung/trltetmo/trltetmo:6.0/MRA58K/N910TUVU1ANIH:user/release-keys'
01-15 15:47:03.109: A/DEBUG(404): Revision: '0'
01-15 15:47:03.109: A/DEBUG(404): ABI: 'arm'
01-15 15:47:03.109: A/DEBUG(404): pid: 28062, tid: 28062, name: fsck.exfat >>> fsck.exfat <<<
01-15 15:47:03.109: A/DEBUG(404): signal 11 (SIGSEGV), code 1 (SEGV_MAPERR), fault addr 0x6
01-15 15:47:03.111: A/DEBUG(404): r0 b6d78d0c r1 00000006 r2 b6b0f010 r3 00000001
01-15 15:47:03.111: E/DEBUG(404): AM write failed: Broken pipe
01-15 15:47:03.111: A/DEBUG(404): r4 b6d78d0c r5 00000006 r6 00000006 r7 b6f93a08
01-15 15:47:03.111: A/DEBUG(404): r8 b6f419c4 r9 b6f93970 sl b6f93720 fp be9439ac
01-15 15:47:03.112: A/DEBUG(404): ip b6d07d10 sp be9436b8 lr 00000000 pc b6f2a798 cpsr 800f0010
01-15 15:47:03.124: A/DEBUG(404): backtrace:
01-15 15:47:03.124: A/DEBUG(404): #00 pc 00008798 /system/lib/libexfat.so (utf8_to_utf16+84)
01-15 15:47:03.124: A/DEBUG(404): #01 pc 00013fa0 /system/lib/libutils.so
01-15 15:47:03.124: A/DEBUG(404): #02 pc 000142a4 /system/lib/libutils.so (android::String16::String16(char const*)+36)
01-15 15:47:03.124: A/DEBUG(404): #03 pc 00017310 /system/lib/libbinder.so
01-15 15:47:03.124: A/DEBUG(404): #04 pc 00003f58 /system/bin/linker (__dl__ZN6soinfo13call_functionEPKcPFvvE.constprop.111+96)
01-15 15:47:03.124: A/DEBUG(404): #05 pc 00004098 /system/bin/linker (__dl__ZN6soinfo10call_arrayEPKcPPFvvEjb.constprop.110+200)
01-15 15:47:03.124: A/DEBUG(404): #06 pc 000041e4 /system/bin/linker (__dl__ZN6soinfo17call_constructorsEv.part.75+176)
01-15 15:47:03.124: A/DEBUG(404): #07 pc 000041e4 /system/bin/linker (__dl__ZN6soinfo17call_constructorsEv.part.75+176)
01-15 15:47:03.124: A/DEBUG(404): #08 pc 0000df94 /system/bin/linker (__dl___linker_init+3536)
01-15 15:47:03.124: A/DEBUG(404): #09 pc 00001a2c /system/bin/linker (_start+4)
01-15 15:47:03.203: A/DEBUG(404): Tombstone written to: /data/tombstones/tombstone_01

adb shell'd into the phone, mounted the mmc manually and works fine.

the fsck.exfat segfaulting is whats causing the issue.

just replaced the fsck.exfat w/ a dummy file that will return a 0 exit code hoping that will let it get past the sdcard part. we'll see.

welll ..... didn't think that one through. forgot about the permissions on /system/bin/sh and access was denied. however........(grins)

Found a working copy of fsck.exfat and the required libs, unzip/mount -orw,remount /system, cp files to new dir, viola.

1|root@trltetmo:/storage/3837-3839/_roms/stock # unzip N910TUVU2DOK2_Stock_Deodex_301115.zip system/lib/libexfat_utils.so
Archive: N910TUVU2DOK2_Stock_Deodex_301115.zip
inflating: system/lib/libexfat_utils.so
root@trltetmo:/storage/3837-3839/_roms/stock # fsck.exfat
CANNOT LINK EXECUTABLE: library "libexfat_utils.so" not found
page record for 0xb6f5d01c was not found (block_size=16)
1|root@trltetmo:/storage/3837-3839/_roms/stock # cp system/lib/libexfat_utils.so /system/lib/
root@trltetmo:/storage/3837-3839/_roms/stock # fsck.exfat
fsck.exfat v1.2.4 (lib v1.2.4)
Usage: fsck.exfat [-cfR] /dev/name
-c file name is case sensitive
-f file system check is forced
-R file system is automatically recovered
Device not specified.
23|root@trltetmo:/storage/3837-3839/_roms/stock # %

WORKED....... i'll throw together a quick zip to flash when it happens again ;).

just know i'm not a developer or a savy coder lol (smirks).

odd. upon reboot the fsck comes back clean, however, there is still the 'corrupt' icon in the notification bar.

root@trltetmo:/ # date +%d-%h-%Y_%H.%M.%S; fsck.exfat /dev/block/mmcblk1p1
15-Jan-2016_16.33.58
fsck.exfat v1.2.4 (lib v1.2.4)
No errors

ran fsck again, this time with the -f option

root@trltetmo:/storage # fsck.exfat -f /dev/block/mmcblk1p1 |tail -n1
file system corruption found.

#NOW TO CLEAN IT UP
fsck.exfat -f -R /dev/block/mmcblk1p1 |tail -n1
Filesystem was modified.

rebooting to see if this fixed the issue. will report back.

Still not fixed, can manually mount sdcard in term. but can't during boot.

logcat of interesting entry:

01-15 17:00:39.098: E/vold(315): public:179_65 failed to mount /dev/block/vold/public:179_65: No such file or directory

[MENTION=4712992]ZION959[/MENTION], timing issue? not clear here. i've not dug into the initrd to see whats going on there. fsck is clean, device public:179_65 exists and has pems:

~
❯ adb shell
root@trltetmo:/ # ls -ld /dev/block/vold/*
brw------- 1 root root 179, 64 2014-03-17 00:26 /dev/block/vold/disk:179_64
brw------- 1 root root 179, 65 2016-01-15 17:00 /dev/block/vold/public:179_65

root@trltetmo:/ # ls -ld /dev/block/mmcblk1p1
brw------- 1 root root 179, 65 2014-03-17 00:26 /dev/block/mmcblk1p1