# Mail-receiver log errors after letsencrypt update

**URL:** https://meta.discourse.org/t/mail-receiver-log-errors-after-letsencrypt-update/204938
**Category:** Support
**Created:** [October 1, 2021, 6:50am UTC](https://meta.discourse.org/t/mail-receiver-log-errors-after-letsencrypt-update/204938 "2021-10-01T06:50:27Z")
**Posts on this page:** 14
**Page:** 1

<div class="post-metadata">

### Author: ![md-misko](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/md-misko/32/126315_2.png) [@md-misko](https://meta.discourse.org/u/md-misko)
#### Post date: [October 1, 2021, 6:50am UTC](https://meta.discourse.org/t/mail-receiver-log-errors-after-letsencrypt-update/204938/1 "2021-10-01T06:50:27Z")

</div>

Continuing the discussion from [Self-hosted mail-receiver update following Let's Encrypt root certificate change](https://meta.discourse.org/t/self-hosted-mail-receiver-update-following-lets-encrypt-root-certificate-change/204924):

After updating mail-receiver to latest `./launcher logs mail-receiver` errors out after

```plaintext
postfix/postfix-script: warning: symlink leaves directory: /etc/postfix/./makedefs.out
<20>Oct 1 06:10:33 postfix/postfix-script[86]: warning: symlink leaves directory: /etc/postfix/./makedefs.outStarting Postfix

```

and doesn’t show any other events (incoming emails, rejected emails, …).

I’ve encountered some issues with custom postfix settings (which worked flawlessly prior to recent update) and need to debug, which is difficult without logs.

---

<div class="post-metadata">

### Author: ![IAmGav](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/iamgav/32/235598_2.png) [@IAmGav](https://meta.discourse.org/u/IAmGav)
#### Post date: [October 1, 2021, 6:53am UTC](https://meta.discourse.org/t/mail-receiver-log-errors-after-letsencrypt-update/204938/2 "2021-10-01T06:53:32Z")

</div>

have you tried these steps

> [@Let's Encrypt X3 nightmare](https://meta.discourse.org/t/lets-encrypt-x3-nightmare/204918/8):
>
> Can you try docker pull discourse/mail-receiver:release cd /var/discourse ./launcher rebuild mail-receiver

---

<div class="post-metadata">

### Author: ![RGJ](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/rgj/32/523185_2.png) [@RGJ](https://meta.discourse.org/u/RGJ)
#### Post date: [October 1, 2021, 7:10am UTC](https://meta.discourse.org/t/mail-receiver-log-errors-after-letsencrypt-update/204938/3 "2021-10-01T07:10:24Z")

</div>

I do see the same ~~errors~~ warnings but Postfix is happily running and accepting mails after that.

Sometimes the logs don’t seem to flush immediately so you might need to wait for a while before you get some output. But that’s unrelated to the warnings.

So is it actually crashing for you?

---

<div class="post-metadata">

### Author: ![md-misko](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/md-misko/32/126315_2.png) [@md-misko](https://meta.discourse.org/u/md-misko)
#### Post date: [October 1, 2021, 7:34am UTC](https://meta.discourse.org/t/mail-receiver-log-errors-after-letsencrypt-update/204938/4 "2021-10-01T07:34:57Z")

</div>

> [@RGJ](#):
>
> Postfix is happily running and accepting mails after that

Ditto, with vanilla settings. But I had to temporarily disable additional postfix rule

```plaintext
  POSTCONF_smtpd_client_restrictions: 'regexp:/etc/postfix/shared/client_access_regex'

```

which worked perfectly before the upgrade (uses regex rules to reject spammers). The real issue is that with this setting enabled, postfix starts rejecting _all_ incoming email, but I can’t see why from the logs!

> [@RGJ](#):
>
> Sometimes the logs don’t seem to flush immediately so you might need to wait for a while before you get some output.

A while maybe, but it’s been hours and still nothing in logs (neither accepted nor rejected emails are shown, and there _is_ inbound traffic).

---

<div class="post-metadata">

### Author: ![md-misko](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/md-misko/32/126315_2.png) [@md-misko](https://meta.discourse.org/u/md-misko)
#### Post date: [October 1, 2021, 7:54pm UTC](https://meta.discourse.org/t/mail-receiver-log-errors-after-letsencrypt-update/204938/5 "2021-10-01T19:54:39Z")

</div>

You were right, there are other log entries in the output, but the output itself is garbled:

`./launcher logs mail-receiver` output begins with a `<HEAD>`:

```plaintext
/bin/bash: warning: setlocale: LC_ALL: cannot change locale (en_US.UTF-8)
Operating environment:
HOSTNAME=discourse-mail-receiver
LANGUAGE=en_US.UTF-8
MAIL_DOMAIN=...
...
...
Setting smtpd_tls_security_level to 'may'
postfix/postfix-script: warning: symlink leaves directory: /etc/postfix/./makedefs.out

```

followed by a single line of log entries, and ending with the `<HEAD>` repeated _six more times_:

```plaintext
<HEAD>
Single line of log entries without line breaks..............................................................................................................................................................................................
<HEAD>
<HEAD>
<HEAD>
<HEAD>
<HEAD>
<HEAD>

```

I was only looking at the end of the output, and there was always seemingly just the `<HEAD>` without any other entries.

Definitely something wrong with the rendering of the log via `./launcher logs mail-receiver`.

---

<div class="post-metadata">

### Author: ![md-misko](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/md-misko/32/126315_2.png) [@md-misko](https://meta.discourse.org/u/md-misko)
#### Post date: [October 11, 2021, 1:24pm UTC](https://meta.discourse.org/t/mail-receiver-log-errors-after-letsencrypt-update/204938/6 "2021-10-11T13:24:07Z")

</div>

I believe I figured this one out, there is a `maillog_file` line missing in the Dockerfile. Temp fix: added

```plaintext
  POSTCONF_maillog_file: '/dev/stdout'

```

to mail-receiver.yml and rebuilt, but this should probably be fixed in the docker image

> <https://github.com/discourse/mail-receiver/blob/main/Dockerfile>

```diff
RUN >/etc/postfix/main.cf \
+	&& postconf -e maillog_file=/dev/stdout \
	&& postconf -e smtputf8_enable=no \
...

```

---

<div class="post-metadata">

### Author: ![david](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/david/32/157490_2.png) [@david](https://meta.discourse.org/u/david)
#### Post date: [October 11, 2021, 4:06pm UTC](https://meta.discourse.org/t/mail-receiver-log-errors-after-letsencrypt-update/204938/7 "2021-10-11T16:06:41Z")

</div>

> [@md-misko](#):
>
> I believe I figured this one out, there is a `maillog_file` line missing in the Dockerfile

So after adding this, the error is gone, and the logs are working? If so, would you mind submitting a PR to make that change?

---

<div class="post-metadata">

### Author: ![md-misko](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/md-misko/32/126315_2.png) [@md-misko](https://meta.discourse.org/u/md-misko)
#### Post date: [October 11, 2021, 5:36pm UTC](https://meta.discourse.org/t/mail-receiver-log-errors-after-letsencrypt-update/204938/8 "2021-10-11T17:36:48Z")

</div>

[https://github.com/discourse/mail-receiver/pull/11](https://github.com/discourse/mail-receiver/pull/11)

---

<div class="post-metadata">

### Author: ![md-misko](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/md-misko/32/126315_2.png) [@md-misko](https://meta.discourse.org/u/md-misko)
#### Post date: [December 7, 2021, 2:43pm UTC](https://meta.discourse.org/t/mail-receiver-log-errors-after-letsencrypt-update/204938/9 "2021-12-07T14:43:33Z")

</div>

[https://github.com/discourse/mail-receiver/pull/12](https://github.com/discourse/mail-receiver/pull/12)

> [@Mail-receiver loses IP to hostname resolution after recent upgrade and prevents anti-spam measures from working](https://meta.discourse.org/t/mail-receiver-loses-ip-to-hostname-resolution-after-recent-upgrade-and-prevents-anti-spam-measures-from-working/205003/3):
>
> [https://github.com/discourse/mail-receiver/pull/12](https://github.com/discourse/mail-receiver/pull/12)@david This should fix both issues mentioned in [Self-hosted mail-receiver update following Let's Encrypt root certificate change - #6 by md-misko](https://meta.discourse.org/t/self-hosted-mail-receiver-update-following-lets-encrypt-root-certificate-change/204924/6) Please evaluate whether removing postfix from the chroot jail introduces any security issues (IMO it shouldn’t, as postfix is already isolated inside a dedicated docker image).

---

<div class="post-metadata">

### Author: ![david](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/david/32/157490_2.png) [@david](https://meta.discourse.org/u/david)
#### Post date: [December 8, 2021, 12:24am UTC](https://meta.discourse.org/t/mail-receiver-log-errors-after-letsencrypt-update/204938/10 "2021-12-08T00:24:38Z")

</div>

Thanks @md-misko - I’ve merged the PR and bumped the `discourse/mail-reciever:release` tag on Dockerhub.

I’m sure you’re already aware, but in case anyone else comes across this topic, you can update your mail receiver version by running:

```plaintext
docker pull discourse/mail-receiver:release
cd /var/discourse
./launcher rebuild mail-receiver

```

---

<div class="post-metadata">

### Author: ![pfaffman](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/pfaffman/32/120154_2.png) [@pfaffman](https://meta.discourse.org/u/pfaffman)
#### Post date: [December 8, 2021, 3:25pm UTC](https://meta.discourse.org/t/mail-receiver-log-errors-after-letsencrypt-update/204938/11 "2021-12-08T15:25:47Z")

</div>

Have you got any ideas of how to test that the current running image is running the latest version?

---

<div class="post-metadata">

### Author: ![david](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/david/32/157490_2.png) [@david](https://meta.discourse.org/u/david)
#### Post date: [December 8, 2021, 4:07pm UTC](https://meta.discourse.org/t/mail-receiver-log-errors-after-letsencrypt-update/204938/12 "2021-12-08T16:07:39Z")

</div>

A little convoluted… but I think this should work:

```bash
# First, make sure you've got the latest base image locally
docker pull discourse/mail-receiver:release

# Get the top layer of the base image
BASE_IMAGE_HASH=$(docker history discourse/mail-receiver:release -q | head -n 1)

# Get the layers of the **running** version
RUNNING_IMAGE_HASH=$(docker container inspect mail-receiver -f "{{.Image}}")
RUNNING_IMAGE_LAYERS=$(docker history $RUNNING_IMAGE_HASH -q)

# Check if the running image layers include the current base image:
[["$RUNNING_IMAGE_LAYERS" == *"$BASE_IMAGE_HASH"*]] && echo "Up to date"

```

That will print “Up to date” if you’re up to date. Otherwise, the final line will print nothing, and exit with a non-zero status.

---

<div class="post-metadata">

### Author: ![pfaffman](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/pfaffman/32/120154_2.png) [@pfaffman](https://meta.discourse.org/u/pfaffman)
#### Post date: [December 8, 2021, 4:14pm UTC](https://meta.discourse.org/t/mail-receiver-log-errors-after-letsencrypt-update/204938/13 "2021-12-08T16:14:14Z")

</div>

Oh. That’s brilliant. And looks like it’s a general solution that I have previously found only one-off solutions for. It would have taken me a while to figure that out. The `RUNNING_IMAGE_LAYERS` is what I didn’t know to look for.

I tested it on an instance that had been upgrade and one that hadn’t and it appears to behave as expected.

Thanks so very much!

---

<div class="post-metadata">

### Author: ![system](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/system/32/443519_2.png) [@system](https://meta.discourse.org/u/system)
#### Post date: [January 7, 2022, 4:14pm UTC](https://meta.discourse.org/t/mail-receiver-log-errors-after-letsencrypt-update/204938/14 "2022-01-07T16:14:14Z")

</div>

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.
