View Single Post
Old 11-08-2020, 05:10 PM   #25
yorikk
Member
yorikk began at the beginning.
 
Posts: 16
Karma: 10
Join Date: Nov 2020
Device: amazon kindle
SOLVED

Linux, Kindle, Calibre: I/O error vfat filesystem disconnect problem.

Any fresh Linux system without udisks2 may be affected by this bug.

Solutions (any of 5 is ok):

1. Disable fsync for Kindle block device (sdb, etc):

echo "write through" > /sys/block/DEVICE/queue/write_cache

2. Remount Kindle with "flush" option:

mount -o remount,flush DEVICE MOUNTPOINT

3. Use udisks2 as automatic external device mount service (it use "flush" option by default)

4. Patch Calibre source files, comment 2 calls to os.fsync:

/usr/lib/calibre/calibre/__init__.py
/usr/lib/calibre/calibre/utils/filenames.py

5. Patch Calibre source files, add os.system("sync &") :

/usr/lib/calibre/calibre/__init__.py:

after:
os.utime(fileobj.name, None)

add:
os.system("sync &")

/usr/lib/calibre/calibre/utils/filenames.py:

after:
os.fsync(ans.fileno())

add:
os.utime(os.path.join(cpath, fname), None)
os.system("sync &")

PS:

Links to other topics related:

https://bugzilla.kernel.org/show_bug.cgi?id=203973

https://bugs.launchpad.net/calibre/+bug/1834641
yorikk is offline   Reply With Quote