Skip to content

[bug] fscrypt incorrectly assumes its configuration and metadata paths are ordinary files and directories #454

Description

@TheSast

I first noticed this with /etc/fscrypt.conf. It looks like fscrypt tries to update this file by creating a temporary file, removing the old file, and then replacing it with the new one, but this causes issues when /etc/fscrypt.conf is a bind mount (since removing the path fails¹), or a symlink (since replacing the symlink means the new file is no longer written to the intended location).

A similar issue exists with /.fscrypt. Some systems use automated mechanisms to recreate paths that are stored elsewhere² (for example, through the aforementioned bind mounts or similar approaches). These mechanisms may create the directory before fscrypt has initialized it, resulting in an empty /.fscrypt. fscrypt then fails to write to it's directory³ even though no fscrypt metadata is present.

If I understood correctly, this issue seems related to #327

¹ - with output [ERROR] fscrypt setup: remove /etc/fscrypt.conf: device or resource busy.
² - such as NixOS with impermanence/preservation setups.
³ - with output similar to [ERROR] fscrypt setup: rename /.tmp2978932384/.fscrypt /.fscrypt: file exists.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions