Skip to content

macOS: volume stays writable and apps are told writes succeeded after writes to the container file fail (ETIMEDOUT) — silent corruption, hours of writes lost #2012

Open

Description

@robsonbsales

Summary

On macOS, when VeraCrypt's writes to the container file fail, the mounted volume keeps running read-write and applications are never told. Data written afterwards is corrupted or silently lost. The same container, used with VeraCrypt on Windows, never loses data.

Observed with VeraCrypt 1.26.31 (macFUSE build) and macFUSE 5.5.0 (kernel extension backend) on macOS 27.2.1:

  • files written and verified (correct checksum right after the write) show, minutes later, 4 KiB blocks of random-looking data or runs of zero bytes, with the file size unchanged;
  • after dismount/remount or a reboot the volume reverts to an earlier state: every write made after a certain moment is gone, although it was readable while mounted;
  • no application ever receives an I/O error, and VeraCrypt shows no warning.

VeraCrypt's own exceptions in the system log show what goes wrong below the volume: the writes to the container file fail with ETIMEDOUT, and every incident happened in a minute with such failures.

2026-11-21 07:48:45.927 VeraCrypt[17397] exception: VeraCrypt::File::WriteAt:501: Operation timed out:
    /Users/<user>/Library/CloudStorage/OneDrive-<org>/<folder>/container.raw

That day there were 953 such exceptions between 07:48 and 09:10 (log attached), all for this container.

Context (why the container file can fail at all): the container lives in a folder synced by OneDrive (~/Library/CloudStorage/…, set to "Always Keep on This Device"). This is only the environment that makes the backing file return errors; the same container, synced by the same OneDrive account to a Windows PC, works there with VeraCrypt without any data loss, and the same setup worked on macOS for years until macOS 26.1. Whatever makes pwrite() fail, a failed write to the container must not turn into silent corruption inside the volume. That is what this report is about.

This has already cost me a container with years of work (restored from a 6-month-old backup).

Correlation between the write failures and the damage (2026-11-21, UTC-3)

Time File::WriteAt ETIMEDOUT in the log What was observed in the volume
07:48–07:55 38 A 2.7 KB file written at 07:49 does not exist after the next remount
08:02–08:08 90 08:00: a 40 KB text file is written and verified. 08:02: 6 of its 11 blocks are random data, size unchanged. A copy made with cp -p and a 173 KB file not written in that interval are also damaged. ~08:05: remount; all writes of the day are gone
08:09–08:35 0 Test writes at 08:09–08:15 stay intact and survive the later reboot
08:36–08:55 121 New files from 08:36 are not visible; the 173 KB file again has 9 of 43 blocks damaged
08:56 507
09:00–09:10 197 09:01: the file is regenerated and verified. 09:02: it has 222 contiguous zero bytes (offsets 106274–106495), size unchanged
09:11 — Reboot. After remounting, writes up to 08:15 are present, everything after 08:15 is lost

The only clean interval (08:09–08:35, no write failures) is also the only interval whose writes survived.

Where VeraCrypt loses the error (source references, current master)

  1. File::WriteAt() (src/Platform/Unix/File.cpp) throws when pwrite() fails. There is no retry for transient errors such as ETIMEDOUT, EINTR or EAGAIN.
  2. fuse_service_write() (src/Driver/Fuse/FuseService.cpp) turns the exception into -ETIMEDOUT for macFUSE. From there the error has to travel up through the disk image that VeraCrypt attaches with hdiutil (volume.dmg) and the file system mounted on it (exFAT here). By then the writes have been buffered and applications have already been told they succeeded, so nobody sees the error.
  3. The volume is not switched to read-only and the user is not told, so applications keep writing into a volume whose backing file is rejecting writes. exFAT has no journal, so the result is inconsistent files and metadata.
  4. On macOS there is no fsync handler: fuse_service_oper.fsync is set only under #ifdef TC_LINUX. Flushes coming from the disk image / file system layer are therefore never turned into a flush of the container file, so VeraCrypt never confirms that earlier writes actually reached it. This may explain why the volume reverts to an older state after remount.

Requests

  • When a write to the container fails, stop pretending the volume is fine: show an error and switch the volume to read-only, so the user stops saving and can copy data out.
  • Retry pwrite() on transient errors (ETIMEDOUT, EINTR, EAGAIN) before giving up.
  • Implement fsync on macOS as on Linux, flushing the container file (ideally with F_FULLFSYNC), so that flushes from the file system really reach the container.
  • Optionally, warn when a container under ~/Library/CloudStorage/ is mounted read-write, since files there can return such errors.

Environment

  • Mac15,6 (Apple Silicon), internal SSD
  • macOS 27.2.1 (26B131); the problem started on macOS 26.1 and never happened on earlier versions
  • Windows PC with the same container and the same OneDrive account, VeraCrypt on Windows: no incident ever
  • VeraCrypt 1.26.31, macFUSE build; macFUSE 5.5.0 with its kernel extension (FUSE-T 1.2.9 is installed but not used for this mount)
  • Container: 8 GiB file in a OneDrive-synced folder, always kept on the device
  • File system inside the volume: exFAT, about 3.6 GB used, about 2,600 files; macOS mounts it through its FSKit exFAT driver (the mount shows fskit)
  • Mount stack: container file → macFUSE (VeraCrypt@macfuse0, volume.dmg) → disk image /dev/diskN → exFAT
  • The volume had been mounted for about 2 days; the Mac did not sleep during the incident (power log)
  • Damage also happened with only native macOS applications writing

Related

  • #1228: after macOS 14, FAT volumes started losing or zeroing files on macOS while Windows kept working. Same pattern of macOS-only data loss inside the volume after a macOS update.
  • Transient ETIMEDOUT on writes to files in macOS cloud-synced folders also affects other programs, for example iamjonjackson/video-renderer#19. Programs that check every write fail loudly there; VeraCrypt's volume instead keeps accepting writes.

What does not reproduce it

A scripted test with containers whose files never return write errors (stored outside the synced folder; one outer container, two containers inside it, one standalone; 20 MB random data each, dismount, remount, SHA-256 check) passed 5 cycles out of 5.

Steps to reproduce (expected)

  1. Put a container file in a OneDrive-synced folder on macOS 26.1 or later, with OneDrive running.
  2. Mount it read-write with the macFUSE build and keep writing files for a while.
  3. Watch log stream --predicate 'process CONTAINS "VeraCrypt"' for File::WriteAt … Operation timed out.
  4. Note that no application gets an error; check the files written around those messages, then dismount, remount and compare.

Attached: veracrypt-macos-writeat-timeouts-2026-11-21.log, with the mount stack, the count of WriteAt timeouts per minute and all 953 exceptions from the unified log (personal paths replaced by placeholders).

I have the full system log of the incident and can run any diagnostic build or test.

veracrypt-macos-writeat-timeouts-2026-11-21.log

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions