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