The offending code is in `src/global/mail_queue.c`:

```C
    for (;;) {
        GETTIMEOFDAY(tp);
        vstring_sprintf(temp_path, "%s/%d.%d", queue_name,
                        (int) tp->tv_usec, pid);
        if ((fd = open(STR(temp_path), O_RDWR | O_CREAT | O_EXCL, mode)) >= 0)
            break;
        if (errno == EEXIST || errno == EISDIR)
            continue;
        msg_warn("%s: create file %s: %m", myname, STR(temp_path));
        sleep(10);
    }
```

It must be the case that `open` is returning `EROFS`, which causes `%m`
to generate that message. Others online (e.g.,
<https://unix.stackexchange.com/questions/670080/postfix-thinks-its-on-a-read-only-filesystem>)
seem to point to systemd as well---something about the system protection
level causes the postfix process to see a read-only filesystem.

Cheers,
Michael

On 2026-05-04 at 05:41:43 PM, [email protected] wrote:

> On Mon, May 04, 2026 at 05:02:05PM +0200, Jan Claeys wrote:
>> On Sun, 2026-05-03 at 20:20 +0000, Andy Smith wrote:
>> > Although I confess I don't really understand why a
>> > process launched by monit would be directly trying to write to the
>> > postfix directory as I would have thought it talks to postfix and
>> > then something from postfix delivers the mail. But since the same
>> > thing appears to have happened with netdata and other software then I
>> > think it's got a good chance.
>> 
>> Typically such applications use /usr/sbin/sendmail to send mail, which
>> is usually a binary supplied by the MTA you use (Postfix in this case).
>> 
>> Depending on the implementation & configuration of /usr/sbin/sendmail
>> it might try to do anything from dropping a file in a specific location
>> to connecting to an external mail server.
>> 
>> 
>> The problem might indeed be systemd or AppArmor or similar blocking
>> sendmail from doing its thing (possibly also because it’s being run
>> with restrictions set for Monit, which don’t take into account the
>> specifics of the /usr/sbin/sendmail you are using).
>
> This all doesn't rhyme with the error message given ("read-only file
> system"), unless the error message is lying, that is.
>
> Cheers
> -- 
> t

Reply via email to