Bug 253849 - mount.exfat does not work
Summary: mount.exfat does not work
Status: Closed Not A Bug
Alias: None
Product: Ports & Packages
Classification: Unclassified
Component: Individual Port(s) (show other bugs)
Version: Latest
Hardware: Any Any
: --- Affects Many People
Assignee: Oleksii Samorukov
Depends on:
Reported: 2021-02-25 17:02 UTC by vermaden
Modified: 2021-02-27 10:38 UTC (History)
2 users (show)

See Also:
linimon: maintainer-feedback? (samm)

fsck.exfat.out (6.72 KB, text/plain)
2021-02-26 10:46 UTC, vermaden
no flags Details
mount.exfat.out (9.93 KB, text/plain)
2021-02-26 10:47 UTC, vermaden
no flags Details

Note You need to log in before you can comment on or make changes to this bug.
Description vermaden 2021-02-25 17:02:25 UTC
Worked like a charm on 12.2-RELEASE.

Does not work on 13.0-BETA*

# mount.exfat -o uid=1000 -o gid=0 -o umask=002 -o noatime /dev/mmcsd0s1 /media/mmcsd0s1
FUSE exfat 1.3.0
ERROR: ublio fsync failed.
ERROR: failed to close ublio.

# mount.exfat /dev/mmcsd0s1 /media/mmcsd0s1 
FUSE exfat 1.3.0
ERROR: ublio fsync failed.
ERROR: failed to close ublio.

This exact test was from 13.0-BETA3 ...

Comment 1 Li-Wen Hsu freebsd_committer 2021-02-26 02:02:19 UTC
BTW I have tried `mount.exfat -o uid=1000 -o gid=0 -o umask=002 -o noatime /dev/da0s1 /media`

on 14.0-CURRENT main-n244798-95138d09d20a

and has no problem. I suspect there is something special on that media or device. Can you help to locate which change breaks this?
Comment 2 vermaden 2021-02-26 09:05:47 UTC
I have tried two separate 'drives'.

One was 'regular' USB 2.0 drive that Windows can read/write without any problem.

Second was SD card taken out of powered off camera that always worked like a charm on my W520 SD reader.

Both have the same problem.
Comment 3 Li-Wen Hsu freebsd_committer 2021-02-26 09:23:03 UTC
This is hard to help to debug if cannot reproduce, and it might have multiple things related to this.  If possible, if you can locate which commit caused this will be a great help.  Note that mount.exfat is from ports so it might need to be rebuild during the tests.
Comment 4 vermaden 2021-02-26 10:46:31 UTC
Maybe the truss(8) output will help.

I just (re)added all thrse exFAT related packages along with their deps.

# pkg delete  exfat-utils fusefs-exfat libublio
# pkg install exfat-utils fusefs-exfat libublio

Mine 13.0-BETA3 is from freebsd-update(8) so I dod not built it myself.


# truss -o fsck.exfat.out fsck.exfat /dev/mmcsd0s1
exfatfsck 1.3.0
Checking file system on /dev/mmcsd0s1.
ERROR: ublio fsync failed.
ERROR: failed to close ublio.
File system checking stopped. ERRORS FOUND: 2, FIXED: 0.

# truss -o mount.exfat.out mount.exfat /dev/mmcsd0s1 /mnt
FUSE exfat 1.3.0
ERROR: ublio fsync failed.
ERROR: failed to close ublio.

Hope that helps.
Comment 5 vermaden 2021-02-26 10:46:55 UTC
Created attachment 222844 [details]
Comment 6 vermaden 2021-02-26 10:47:10 UTC
Created attachment 222845 [details]
Comment 7 vermaden 2021-02-26 13:50:38 UTC
I just tested this in 12.2-RELEASE and its broken in the same way.

So the port is broken no the FreeBSD itself.
Comment 8 Mark Linimon freebsd_committer freebsd_triage 2021-02-26 16:12:40 UTC
^Triage: assign to maintainer of both sysutils/exfat-utils and sysutils/fusefs-exfat .
Comment 9 Li-Wen Hsu freebsd_committer 2021-02-27 02:16:39 UTC
(In reply to vermaden from comment #7)
So 12.2-R is working or not working? Or it is working in the previous tests but not in the later?

Note this part:

openat(AT_FDCWD,"/dev/mmcsd0s1",O_RDWR,00)	 = 3 (0x3)
fstat(3,{ mode=crw-r----- ,inode=510,size=0,blksize=4096 }) = 0 (0x0)
lseek(3,0x0,SEEK_END)				 = 63847792640 (0xedda00000)
lseek(3,0x0,SEEK_SET)				 = 0 (0x0)
mmap(0x0,2621440,PROT_READ|PROT_WRITE,MAP_PRIVATE|MAP_ANON|MAP_ALIGNED(12),-1,0x0) = 34376515584 (0x801000000)
mmap(0x0,3145728,PROT_READ|PROT_WRITE,MAP_PRIVATE|MAP_ANON|MAP_ALIGNED(12),-1,0x0) = 34379137024 (0x801280000)
mmap(0x0,3670016,PROT_READ|PROT_WRITE,MAP_PRIVATE|MAP_ANON|MAP_ALIGNED(12),-1,0x0) = 34382282752 (0x801580000)
mmap(0x0,4194304,PROT_READ|PROT_WRITE,MAP_PRIVATE|MAP_ANON|MAP_ALIGNED(12),-1,0x0) = 34385952768 (0x801900000)
mmap(0x0,5242880,PROT_READ|PROT_WRITE,MAP_PRIVATE|MAP_ANON|MAP_ALIGNED(12),-1,0x0) = 34390147072 (0x801d00000)
preadv(0x3,0x800a3a000,0x1,0x0)			 = 262144 (0x40000)
preadv(0x3,0x800a3a000,0x1,0x800000)		 = 262144 (0x40000)
preadv(0x3,0x800a3a000,0x1,0x1040000)		 = 262144 (0x40000)
preadv(0x3,0x800a3a000,0x1,0x1000000)		 = 262144 (0x40000)
pwrite(3,"\M-kv\M^PEXFAT   \0\0\0\0\0\0\0"...,262144,0x0) ERR#30 'Read-only file system'
write(2,"ERROR: ",7)				 = 7 (0x7)
write(2,"ublio fsync failed",18)		 = 18 (0x12)

Why /dev/mmcsd0s1 is readonly?
Comment 10 Oleksii Samorukov freebsd_committer 2021-02-27 06:54:46 UTC
works for me (maintainer). Broken card?
Comment 11 vermaden 2021-02-27 10:38:20 UTC
Pity that these 'fsck.exfat' and 'mount.exfat' commands do not print that info 'Read-only file system' ...

As I double checked the SD card indeed had the read only switch turned on ... my bad sorry. But the pendrive that I also checked for exFAT do not have such physical switch and it had the same problem. Unfortunately I do not have the logs from pendrive as I needed to do something else with it and created FAT32 filesystem there ...

As it works for others lets treat it as its not a bug and if I face it again I will re-create the PR.

Its not the first time since exFAT tools got broken in FreeBSD.

Thanks and regards.