Closed protectivedad closed 1 year ago
What libc does this router use?
Could you strace
the mount command?
There's no strace or any tracing on the box. It is using uClibc. I can see about compiling something to trace it, if you can point me to the source download. Thanks.
strace source code is here: https://github.com/strace/strace
Here is the log: strace.img.log here is one for a drive usb: strace.sdb1.log
lseek(3, 20140648, SEEK_SET) = 20140648
read(3, "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"..., 512) = 512
This lseek looks weird. Could you give me a link to the source code of uClibc version used in your router? uClibc is LGPL, so the vendor should provide sources.
How did you compile fuse-exfat? Did you use autotools or some other build system? Looks like there's a problem with LFS (large file support) because lseek is called instead of lseek64.
I forked and am using https://github.com/andrew867/Actiontec-R3000-33.162L.16-BellAliant for the sources. I added a directory in the build with the attached Makefile I created to download and compile your sources. Makefile.txt
I'm not sure if this helps, but I also recompile the latest ntfs-3g drivers to use the external libfuse. Here is a strace of the command:
ntfs-3g /dev/sda2 /mnt/disk1_2 -o use_ino,direct_io,big_writes
strace.ntfs-3g.log
The abovementioned repo does not include libc source code.
I've checked upstream uClibc sources and to me it looks like a misconfiguration: fuse-exfat uses pread/pwrite and both uClibc and Linux kernel should support them, but for some reason uClibc on your router erroneously translates those calls to lseek+read/write (should be pread64/pwrite64 instead).
You are right. By substituting lseek64, pread64, and pwrite64 in io.c the tools work. When I get a chance I will look further into why ntfs-3g is able to handle this without a problem, but your fuse-exfat has issues. Or do you know why?
I can only guess that some defines are missing in the Makefile.
The configure for ntfs-3g defines _GNU_SOURCE which eventually defines, in the toolchain headers features.h, __USE_UNIX98 which creates:
#define pread pread64
#define pwrite pwrite64
etc. I'm not sure if this is something that you want to include or not, but that is the solution. Another way to do the same thing which is done in the mtd-utils is:
#define _XOPEN_SOURCE 500 /* For pread/pwrite */
You can correct me if I'm wrong, but from my reading of man pages I think the _XOPEN_SOURCE is supposed to be defined in order to use the pread/pwrite functions.
Hi, I am having the same issue while trying to mount a fuse-exfat formatted microsd card (created on the target machine)
The card mounts fine and is writable on other devices (both Linux and android arm devices)
I compiled fuse-exfat 1.3.0 on a Nokia N810 internet tablet (arm device) with autotools.
libc version:
(Nokia-N810-43-7) ~ $ ldd --version ldd (GNU libc) 2.5 Copyright (C) 2006 Free Software Foundation, Inc. This is free software; see the source for copying conditions. There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. Written by Roland McGrath and Ulrich Drepper.
Source: http://repository.maemo.org/pool/diablo/free/g/glibc/glibc_2.5.0-1osso10.tar.gz
strace log:
Looks like _llseek is broken:
_llseek(3, 0, [15929966592], SEEK_END) = 0
_llseek(3, 0, [0], SEEK_SET) = 0
pread(3, "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"..., 512, 766222165606400) = 512
write(2, "ERROR: "..., 7ERROR: ) = 7
write(2, "exFAT file system is not found"..., 30exFAT file system is not found) = 30
What version of autotools did you use and what version of kernel does your tablet run?
autoconf (GNU Autoconf) 2.69 automake (GNU automake) 1.15 libtool (GNU libtool) 2.4.6
Kernel is 2.6.21-omap1
@PhilT001, could you try the following patch?
diff --git a/libexfat/io.c b/libexfat/io.c
index bc92c7c..81ef727 100644
--- a/libexfat/io.c
+++ b/libexfat/io.c
@@ -226,9 +226,24 @@ struct exfat_dev* exfat_open(const char* spec, enum exfat_mode mode)
"you can fix this with fdisk(8)");
}
else
+#elif defined(__linux__)
+ if (!S_ISREG(stbuf.st_mode))
+ {
+ uint64_t size;
+
+ if (ioctl(dev->fd, BLKGETSIZE64, &size) == -1)
+ {
+ close(dev->fd);
+ free(dev);
+ exfat_error("failed to get block device size");
+ return NULL;
+ }
+ dev->size = size;
+ }
+ else
#endif
{
- /* works for Linux, FreeBSD, Solaris */
+ /* works for FreeBSD, Solaris */
dev->size = exfat_seek(dev, 0, SEEK_END);
if (dev->size <= 0)
{
Thanks for your help so far.
Can you advise me as to how to apply this patch? I have limited experience applying patch files and I just getting errors with this.
Sorry, I failed to copy-paste the patch properly. Here it is in compressed form.
Could you share libexfat/config.h
? Looks like something's wrong with Large File Support (pread is used instead of pread64).
OK, no problem.
config.h is OK.
I looked through glibc-2.5 code and it seems that missing _XOPEN_SOURCE can cause ABI issues with LFS. Please try this patch:
diff --git a/libexfat/exfat.h b/libexfat/exfat.h
index 2342be4..77ea5db 100644
--- a/libexfat/exfat.h
+++ b/libexfat/exfat.h
@@ -24,6 +24,7 @@
#ifndef EXFAT_H_INCLUDED
#define EXFAT_H_INCLUDED
+#define _XOPEN_SOURCE 500
#ifndef ANDROID
/* Android.bp is used instead of autotools when targeting Android */
#include "config.h"
Success!
Your latest patch produces the following:
(Nokia-N810-43-7) DEBIAN $ sudo mount.exfat /dev/sda1 ~/mnt/fuse-exfat FUSE exfat 1.3.0
Thank you for your time and help with this.
This did not work for me as well
This did not work for me as well
What exactly doesn't work for you?
Hello, i have the same question, strace log file is as below strace.sdb.log
Fixed in v1.4.0.
I compiled fuse-exfat and exfat-utils 1.3.0 for a ARM router. Mounting or using any exfat-utils on a known working exfat system by either image file, flash drive or harddrive gives: ERROR: exFAT file system is not found.
This interesting thing is if I take an NTFS drive and use the exfat-utils mkexfatfs it creates an exfat file system that can be read by my windows machine, but on the router it gives the error: ERROR: exFAT file system is not found.
So, mkexfatfs seems to work, but exfat programs that tries to read the file/or image fail. I created a 1G image file using:
The -d debug flag doesn't seem to do anything or at least there is no change in the output when I use it.