[SOLVED] Can't get notifications to work for backup

thusband

Member
Jun 30, 2022
129
6
23
I've setup notification to my Gmail account and can get test messages but when I set up notifications for my backups I get Syslog errors. Obviously I missed something. Here's my Syslog and screenshots of my backup and notifications setup. What did I miss and how do I clean up all the Syslog errors that continue to be posted? Many thanks for any help.

Jan 02 12:41:48 pve kernel: EXT4-fs (dm-10): unmounting filesystem 97a57686-ea40-4d37-b1e8-4e48abedfb37. Jan 02 12:41:48 pve pvedaemon[1886869]: INFO: Finished Backup of VM 102 (00:00:19) Jan 02 12:41:48 pve pvedaemon[1886869]: INFO: Backup job finished successfully Jan 02 12:41:48 pve postfix/pickup[1867845]: 86B9D4C0C7E: uid=0 from=<root> Jan 02 12:41:48 pve pvedaemon[1884136]: <root@pam> end task UPID:pve:001CCA95:0A618955:6594044E:vzdump::root@pam: OK Jan 02 12:41:48 pve postfix/cleanup[1887320]: 86B9D4C0C7E: message-id=<20240102124148.86B9D4C0C7E@pve.home> Jan 02 12:41:48 pve postfix/qmgr[925293]: 86B9D4C0C7E: from=<root@pve.home>, size=11279, nrcpt=1 (queue active) Jan 02 12:41:48 pve postfix/smtp[1887322]: connect to gmail-smtp-in.l.google.com[142.251.5.27]:25: No route to host Jan 02 12:41:48 pve postfix/smtp[1887322]: connect to gmail-smtp-in.l.google.com[2a00:1450:400c:c1d::1a]:25: Network is unreachable Jan 02 12:41:48 pve postfix/smtp[1887322]: connect to alt1.gmail-smtp-in.l.google.com[2a00:1450:4013:c16::1b]:25: Network is unreachable Jan 02 12:41:48 pve postfix/smtp[1887322]: connect to alt1.gmail-smtp-in.l.google.com[142.250.153.27]:25: No route to host Jan 02 12:41:48 pve postfix/smtp[1887322]: connect to alt2.gmail-smtp-in.l.google.com[142.251.9.27]:25: No route to host Jan 02 12:41:48 pve postfix/smtp[1887322]: 86B9D4C0C7E: to=<tom.husband@gmail.com>, relay=none, delay=0.07, delays=0.01/0/0.05/0, dsn=4.4.1, status=deferred (connect to alt2.gmail-smtp-in.l.google.com[142.251.9.27]:25: No route to host) Jan 02 12:43:23 pve postfix/qmgr[925293]: 205E14C0C63: from=<root@pve.home>, size=11206, nrcpt=1 (queue active) Jan 02 12:43:23 pve postfix/qmgr[925293]: 4714E4C0C20: from=<root@pve.home>, size=11142, nrcpt=1 (queue active) Jan 02 12:43:23 pve postfix/smtp[1887322]: connect to gmail-smtp-in.l.google.com[2a00:1450:400c:c1d::1a]:25: Network is unreachable Jan 02 12:43:23 pve postfix/smtp[1887322]: connect to gmail-smtp-in.l.google.com[142.251.5.27]:25: No route to host Jan 02 12:43:23 pve postfix/smtp[1887322]: connect to alt1.gmail-smtp-in.l.google.com[2a00:1450:4013:c16::1b]:25: Network is unreachable Jan 02 12:43:23 pve postfix/smtp[1887322]: connect to alt1.gmail-smtp-in.l.google.com[142.250.153.27]:25: No route to host Jan 02 12:43:23 pve postfix/smtp[1887322]: connect to alt2.gmail-smtp-in.l.google.com[2a00:1450:4025:c03::1a]:25: Network is unreachable Jan 02 12:43:23 pve postfix/smtp[1887322]: 205E14C0C63: to=<my.email@gmail.com>, relay=none, delay=335, delays=335/0/0.04/0, dsn=4.4.1, status=deferred (connect to alt2.gmail-smtp-in.l.google.com[2a00:1450:4025:c03::1a]:25: Network is unreachable) Jan 02 12:43:28 pve postfix/smtp[1887738]: connect to gmail-smtp-in.l.google.com[142.251.5.27]:25: No route to host Jan 02 12:43:28 pve postfix/smtp[1887738]: connect to gmail-smtp-in.l.google.com[2a00:1450:400c:c1d::1a]:25: Network is unreachable Jan 02 12:43:28 pve postfix/smtp[1887738]: connect to alt1.gmail-smtp-in.l.google.com[142.250.153.27]:25: No route to host Jan 02 12:43:28 pve postfix/smtp[1887738]: connect to alt1.gmail-smtp-in.l.google.com[2a00:1450:4013:c16::1b]:25: Network is unreachable Jan 02 12:43:28 pve postfix/smtp[1887738]: connect to alt2.gmail-smtp-in.l.google.com[142.251.9.27]:25: No route to host Jan 02 12:43:28 pve postfix/smtp[1887738]: 4714E4C0C20: to=<my.email@gmail.com>, relay=none, delay=565, delays=560/0/5.1/0, dsn=4.4.1, status=deferred (connect to alt2.gmail-smtp-in.l.google.com[142.251.9.27]:25: No route to host) Jan 02 12:48:23 pve postfix/qmgr[925293]: 86B9D4C0C7E: from=<root@pve.home>, size=11279, nrcpt=1 (queue active) Jan 02 12:48:23 pve postfix/smtp[1889076]: connect to gmail-smtp-in.l.google.com[142.251.5.27]:25: No route to host Jan 02 12:48:23 pve postfix/smtp[1889076]: connect to gmail-smtp-in.l.google.com[2a00:1450:400c:c1d::1a]:25: Network is unreachable Jan 02 12:48:23 pve postfix/smtp[1889076]: connect to alt1.gmail-smtp-in.l.google.com[142.250.153.27]:25: No route to host Jan 02 12:48:23 pve postfix/smtp[1889076]: connect to alt1.gmail-smtp-in.l.google.com[2a00:1450:4013:c16::1b]:25: Network is unreachable Jan 02 12:48:23 pve postfix/smtp[1889076]: connect to alt2.gmail-smtp-in.l.google.com[142.251.9.27]:25: No route to host Jan 02 12:48:23 pve postfix/smtp[1889076]: 86B9D4C0C7E: to=<my.email@gmail.com>, relay=none, delay=395, delays=395/0.01/0.06/0, dsn=4.4.1, status=deferred (connect to alt2.gmail-smtp-in.l.google.com[142.251.9.27]:25: No route to host) Jan 02 12:51:19 pve pveproxy[1730156]: worker exit

notification.png

backup.png
 
Last edited:
Hi,

see e.g. this thread / answer.
Your ISPs (or some other firewall in front of the server) blocks access to port 25.

A possible solution is also linked in the thread: https://technotim.live/posts/proxmox-alerts/

Hope this helps!
Yes, thanks. I used this setup in a previous Proxmox installation on a previous NUC and it worked well but the process to set it up is really involved. When I got a new NUC and installed Proxmox I was looking forward to the new notification system because it just seemed pretty simple.

How come I can send test emails successfully but not backup email notifications?
 
I think you have not configured the notification matcher ('default-matcher') to use the 'gmail' target - so it will continue to use the default 'mail-to-root' target. That one uses 'sendmail' via the Postfix MTA under the hood, which will attempt to talk to the Gmail servers on Port 25.
 
After changing 'default-matcher' it looks like I'm still seeing the same error messages in Syslog. How can I remove the continuous attempts to send emails?
 
Have you tried running a backup job to see if it works now?
 
  • Like
Reactions: thusband
Dears,

I think I have a similar problem as @thusband: Gmail notifications per se work (the "test" function works), and even backups notifications work, BUT some other system notifications won't never leave my PVE server (for example related to my Proxmox ZFS drive) or are delayed by days. Errors in the logs are comparable with the ones above:

Code:
postfix/smtp[704616]: connect to alt4.gmail-smtp-in.l.google.com[142.250.115.26]:25: Connection timed out
Sep 04 10:15:41 PVE postfix/smtp[704616]: 1EECE2800DE: to=<MYMAIL@gmail.com>, relay=none, delay=1996, delays=1846/0.02/151/0, dsn=4.4.1, status=deferred (connect to alt4.gmail-smtp-in.l.google.com[142.250.115.26]:25: Connection timed out)

What IMHO I believe happens is that for 'some' kind of notifications PVE routes them to another emailing/notifications path which, yet acknowledging the "gmail route", ignores the 'advanced' settings required by Gmail to receive email to send requests (port, pwd, security protocol) and attempts to connect Gmail post server at the legacy port 25 which, naturally, won't be listening.

In conclusion, I'm able to receive backup notifications, but still I'm missing some other notifications (and you don't want to miss ZFS notifications!).

Could some Proxmox expert chime in?

Thanks in adance
fabbio
 
What IMHO I believe happens is that for 'some' kind of notifications PVE routes them to another emailing/notifications path which, yet acknowledging the "gmail route", ignores the 'advanced' settings required by Gmail to receive email to send requests (port, pwd, security protocol) and attempts to connect Gmail post server at the legacy port 25 which, naturally, won't be listening.

In conclusion, I'm able to receive backup notifications, but still I'm missing some other notifications (and you don't want to miss ZFS notifications!).

Could some Proxmox expert chime in?

Could you share your /etc/pve/notifications.cfg?
 
Thanks Lukas for your swift reply.
Here it comes my file:

Code:
more /etc/pve/notifications.cfg
matcher: default-matcher
    comment Route all notifications to gmail
    mode all
    target P-Gmail

sendmail: mail-to-root
    comment Send mails to root@pam's email address
    disable true
    mailto MYMAIL@gmail.com
    mailto-user root@pam

smtp: P-Gmail
    author Proxmox Cluster
    comment Via gmail
    from-address root@$hostname
    mailto MYMAIL@gmail.com
    mailto-user root@pam
    mode starttls
    port 587
    server smtp.gmail.com
    username MYUSERNAME@gmail.com
 
In the meantime ... AI tools suggest to amend /etc/postfix/main.cf with:
Code:
relayhost = [smtp.gmail.com]:587
smtp_sasl_auth_enable = yes
smtp_sasl_password_maps = hash:/etc/postfix/sasl_passwd
smtp_sasl_security_options = noanonymous
smtp_tls_security_level = encrypt
smtp_tls_CAfile = /etc/ssl/certs/ca-certificates.crt
smtp_use_tls = yes

Plus having a proper /etc/postfix/sasl_passwd for Gmail....
 
In the meantime ... AI tools suggest to amend /etc/postfix/main.cf with:
Yeah, no. This has nothing to do with Postfix :)

Code:
smtp: P-Gmail
    author Proxmox Cluster
    comment Via gmail
    from-address root@$hostname
    mailto MYMAIL@gmail.com
    mailto-user root@pam
    mode starttls
    port 587
    server smtp.gmail.com
    username MYUSERNAME@gmail.com

Try setting `from-address` to the actual email address from this gmail account - otherwise the config looks about right at first glance.
 
Yeah, no. This has nothing to do with Postfix :)

Code:
smtp: P-Gmail
    author Proxmox Cluster
    comment Via gmail
    from-address root@$hostname
    mailto MYMAIL@gmail.com
    mailto-user root@pam
    mode starttls
    port 587
    server smtp.gmail.com
    username MYUSERNAME@gmail.com

Try setting `from-address` to the actual email address from this gmail account - otherwise the config looks about right at first glance.

Thanks again Lukas, yes I've tried changing 'from address' field before but with no joy.
FYI if I do postqueue -p I have several messages pending, including a fresh one generated today by manually scrubbing my ZFS pool :(
 
Last edited:
SOLVED! :)

Dear Lukas, editing /etc/postfix/main.cf file did the trick. Now everything should work as expected.
I've flushed my postfix queue (6 messages!) with sudo postfix flush and ALL new/old queued messages were finally sent to my Gmail address!


For anyone ending here with the same problem, this is what I did to solve the problem:

-- STEP 1 --
Review the /etc/pve/notifications.cfg file: it should look as the one above

-- STEP 2 --

Edit /etc/postfix/main.cf as follows: [DO NOTE: don't put inline comments in the file as they won't be seen as comments by Postfix]

Code:
# See /usr/share/postfix/main.cf.dist for a commented, more complete version

myhostname = ***YOUR_HOSTNAME***

smtpd_banner = $myhostname ESMTP $mail_name (Debian/GNU)
biff = no

# appending .domain is the MUA's job.
append_dot_mydomain = no

# Uncomment the next line to generate "delayed mail" warnings
#delay_warning_time = 4h

alias_maps = hash:/etc/aliases
alias_database = hash:/etc/aliases
mydestination = $myhostname, localhost.$mydomain, localhost

# Relayhost configuration for Gmail
relayhost = [smtp.gmail.com]:587

# My network range (ensure local only)
mynetworks = 127.0.0.0/8

# Interface settings for Postfix
inet_interfaces = loopback-only
recipient_delimiter = +

# Postfix compatibility level
compatibility_level = 2

# Only use IPv4
inet_protocols = ipv4

# Security-related configurations for Gmail SMTP
smtp_use_tls = yes                       
smtp_tls_security_level = encrypt       
smtp_tls_CAfile = /etc/ssl/certs/ca-certificates.crt

# Gmail SMTP authentication settings
smtp_sasl_auth_enable = yes             
smtp_sasl_password_maps = hash:/etc/postfix/sasl_passwd 
smtp_sasl_security_options = noanonymous 
smtp_sasl_mechanism_filter = plain



-- STEP 3 --

Create /etc/postfix/sasl_passwd file and edit it as follows (the password is, naturally, the "App Password for Gmail" generated by Gmail)
Code:
[smtp.gmail.com]:587 your-email@gmail.com:your-app-password


-- STEP 4 --
Restart Postfix (highly suggested to have an eye on the logs): systemctl restart postfix


ps: for Forums moderators, please let me know if those lines above are worth to be published as 'tutorial' new post
 
Last edited:

About

The Proxmox community has been around for many years and offers help and support for Proxmox VE, Proxmox Backup Server, and Proxmox Mail Gateway.
We think our community is one of the best thanks to people like you!

Get your subscription!

The Proxmox team works very hard to make sure you are running the best software and getting stable updates and security enhancements, as well as quick enterprise support. Tens of thousands of happy customers have a Proxmox subscription. Get yours easily in our online shop.

Buy now!