[GH-ISSUE #1239] dovecot seems to not be able to execute psql #1007

Closed
opened 2026-02-27 11:14:42 +03:00 by kerem · 6 comments
Owner

Originally created by @TonyBostonTB on GitHub (Sep 20, 2017).
Original GitHub issue: https://github.com/modoboa/modoboa/issues/1239

Impacted versions

  • Modoboa: 1.9.0
  • installer used: Yes
  • Webserver: Nginx

Steps to reproduce

if one selects any folder in thunderbird or changes to another folder, the following error pops up in the logs - dovecot: postlogin: Error: could not find a "psql" to execute-

Current behavior

not sure if something doesnt work but as the error says, there is something not working

Expected behavior

no errors in the log

Originally created by @TonyBostonTB on GitHub (Sep 20, 2017). Original GitHub issue: https://github.com/modoboa/modoboa/issues/1239 # Impacted versions * Modoboa: 1.9.0 * installer used: Yes * Webserver: Nginx # Steps to reproduce if one selects any folder in thunderbird or changes to another folder, the following error pops up in the logs - dovecot: postlogin: Error: could not find a "psql" to execute- # Current behavior not sure if something doesnt work but as the error says, there is something not working # Expected behavior no errors in the log
kerem 2026-02-27 11:14:42 +03:00
Author
Owner

@tonioo commented on GitHub (Sep 22, 2017):

On which distribution did you install Modoboa? Do you have a more verbose log to show?

<!-- gh-comment-id:331374889 --> @tonioo commented on GitHub (Sep 22, 2017): On which distribution did you install Modoboa? Do you have a more verbose log to show?
Author
Owner

@smindorf commented on GitHub (Sep 28, 2017):

Hi,

I've the same message in my maillog.
OS: CentOS 7

Maillog:

Sep 28 08:05:50 mail dovecot: imap-login: Login: user=<soeren@####>, method=PLAIN, rip=81.7.5.14, lip=88.99.42.74, mpid=3447, TLS, session=<07M5szlaDgBRBwUO>
Sep 28 08:05:50 mail dovecot: postlogin: Error: could not find a "psql" to execute
Sep 28 08:05:51 mail dovecot: imap(soeren@####): Connection closed in=595420 out=2190

dovecot-debug.log:

Sep 28 08:05:49 auth: Debug: auth client connected (pid=3446)
Sep 28 08:05:50 auth: Debug: client in: AUTH    1       PLAIN   service=imap    secured session=07M5szlaDgBRBwUO        lip=88.99.42.74 rip=81.7.5.14   lport=993       rport=39950     resp=<hidden>
Sep 28 08:05:50 auth: Debug: sql(soeren@####,81.7.5.14,<07M5szlaDgBRBwUO>): query: SELECT email AS user, password, '/srv/vmail/####/soeren' AS userdb_home, 1003 AS userdb_uid, 1003 AS userdb_gid, CONCAT('*:bytes=', mb.quota, 'M') AS userdb_quota_rule FROM core_user u INNER JOIN admin_mailbox mb ON u.id=mb.user_id INNER JOIN admin_domain dom ON mb.domain_id=dom.id WHERE email='soeren@####' AND is_active AND dom.enabled
Sep 28 08:05:50 auth: Debug: client passdb out: OK      1       user=soeren@####
Sep 28 08:05:50 auth: Debug: master in: REQUEST 3406561281      3446    1       814b3f8020ff878a661bfcaa1db12ba3        session_pid=3447        request_auth_token
Sep 28 08:05:50 auth: Debug: prefetch(soeren@####,81.7.5.14,<07M5szlaDgBRBwUO>): success
Sep 28 08:05:50 auth: Debug: master userdb out: USER    3406561281      soeren@####    home=/srv/vmail/####/soeren    uid=1003        gid=1003        quota_rule=*:bytes=0M   auth_token=4b7b4522ed363b0d1e79e9166e57b0c922339ce4
Sep 28 08:05:50 imap: Debug: Loading modules from directory: /usr/lib64/dovecot
Sep 28 08:05:50 imap: Debug: Module loaded: /usr/lib64/dovecot/lib10_quota_plugin.so
Sep 28 08:05:50 imap: Debug: Module loaded: /usr/lib64/dovecot/lib11_imap_quota_plugin.so
Sep 28 08:05:50 imap: Debug: Added userdb setting: plugin/quota_rule=*:bytes=0M
Sep 28 08:05:50 imap(soeren@####): Debug: Effective uid=1003, gid=1003, home=/srv/vmail/####/soeren
Sep 28 08:05:50 imap(soeren@####): Debug: Quota root: name=User quota backend=dict args=:proxy::quota
Sep 28 08:05:50 imap(soeren@####): Debug: Quota rule: root=User quota mailbox=* bytes=0 messages=0
Sep 28 08:05:50 imap(soeren@####): Debug: Quota grace: root=User quota bytes=0 (10%)
Sep 28 08:05:50 imap(soeren@####): Debug: dict quota: user=soeren@####, uri=proxy::quota, noenforcing=0
Sep 28 08:05:50 imap(soeren@####): Debug: Namespace inbox: type=private, prefix=, sep=, inbox=yes, hidden=no, list=yes, subscriptions=yes location=maildir:~/Maildir
Sep 28 08:05:50 imap(soeren@####): Debug: maildir++: root=/srv/vmail/####/soeren/Maildir, index=, indexpvt=, control=, inbox=/srv/vmail/####/soeren/Maildir, alt=

Regards
Sören

<!-- gh-comment-id:332737756 --> @smindorf commented on GitHub (Sep 28, 2017): Hi, I've the same message in my maillog. OS: CentOS 7 Maillog: ``` Sep 28 08:05:50 mail dovecot: imap-login: Login: user=<soeren@####>, method=PLAIN, rip=81.7.5.14, lip=88.99.42.74, mpid=3447, TLS, session=<07M5szlaDgBRBwUO> Sep 28 08:05:50 mail dovecot: postlogin: Error: could not find a "psql" to execute Sep 28 08:05:51 mail dovecot: imap(soeren@####): Connection closed in=595420 out=2190 ``` dovecot-debug.log: ``` Sep 28 08:05:49 auth: Debug: auth client connected (pid=3446) Sep 28 08:05:50 auth: Debug: client in: AUTH 1 PLAIN service=imap secured session=07M5szlaDgBRBwUO lip=88.99.42.74 rip=81.7.5.14 lport=993 rport=39950 resp=<hidden> Sep 28 08:05:50 auth: Debug: sql(soeren@####,81.7.5.14,<07M5szlaDgBRBwUO>): query: SELECT email AS user, password, '/srv/vmail/####/soeren' AS userdb_home, 1003 AS userdb_uid, 1003 AS userdb_gid, CONCAT('*:bytes=', mb.quota, 'M') AS userdb_quota_rule FROM core_user u INNER JOIN admin_mailbox mb ON u.id=mb.user_id INNER JOIN admin_domain dom ON mb.domain_id=dom.id WHERE email='soeren@####' AND is_active AND dom.enabled Sep 28 08:05:50 auth: Debug: client passdb out: OK 1 user=soeren@#### Sep 28 08:05:50 auth: Debug: master in: REQUEST 3406561281 3446 1 814b3f8020ff878a661bfcaa1db12ba3 session_pid=3447 request_auth_token Sep 28 08:05:50 auth: Debug: prefetch(soeren@####,81.7.5.14,<07M5szlaDgBRBwUO>): success Sep 28 08:05:50 auth: Debug: master userdb out: USER 3406561281 soeren@#### home=/srv/vmail/####/soeren uid=1003 gid=1003 quota_rule=*:bytes=0M auth_token=4b7b4522ed363b0d1e79e9166e57b0c922339ce4 Sep 28 08:05:50 imap: Debug: Loading modules from directory: /usr/lib64/dovecot Sep 28 08:05:50 imap: Debug: Module loaded: /usr/lib64/dovecot/lib10_quota_plugin.so Sep 28 08:05:50 imap: Debug: Module loaded: /usr/lib64/dovecot/lib11_imap_quota_plugin.so Sep 28 08:05:50 imap: Debug: Added userdb setting: plugin/quota_rule=*:bytes=0M Sep 28 08:05:50 imap(soeren@####): Debug: Effective uid=1003, gid=1003, home=/srv/vmail/####/soeren Sep 28 08:05:50 imap(soeren@####): Debug: Quota root: name=User quota backend=dict args=:proxy::quota Sep 28 08:05:50 imap(soeren@####): Debug: Quota rule: root=User quota mailbox=* bytes=0 messages=0 Sep 28 08:05:50 imap(soeren@####): Debug: Quota grace: root=User quota bytes=0 (10%) Sep 28 08:05:50 imap(soeren@####): Debug: dict quota: user=soeren@####, uri=proxy::quota, noenforcing=0 Sep 28 08:05:50 imap(soeren@####): Debug: Namespace inbox: type=private, prefix=, sep=, inbox=yes, hidden=no, list=yes, subscriptions=yes location=maildir:~/Maildir Sep 28 08:05:50 imap(soeren@####): Debug: maildir++: root=/srv/vmail/####/soeren/Maildir, index=, indexpvt=, control=, inbox=/srv/vmail/####/soeren/Maildir, alt= ``` Regards Sören
Author
Owner

@tonioo commented on GitHub (Oct 3, 2017):

@smindorf Looks like the psql binary is not available on the standard path. Could you check where it is please? Once done, update the /usr/local/bin/postlogin.sh script and use the absolute path to psql.

<!-- gh-comment-id:333884279 --> @tonioo commented on GitHub (Oct 3, 2017): @smindorf Looks like the psql binary is not available on the standard path. Could you check where it is please? Once done, update the /usr/local/bin/postlogin.sh script and use the absolute path to psql.
Author
Owner

@smindorf commented on GitHub (Oct 6, 2017):

@tonioo Ok, here ist is:

# which psql
/bin/psql

I've edited the /usr/local/bin/postlogin.sh file and added the path.

# diff -u postlogin.sh_ori postlogin.sh
--- postlogin.sh_ori    2017-10-06 11:21:18.968028758 +0200
+++ postlogin.sh        2017-10-06 11:18:09.418046534 +0200
@@ -1,6 +1,6 @@
 # This file was automatically installed on 2017-09-22T09:12:59.784109
 #!/bin/sh
 
-psql -c "UPDATE core_user SET last_login=now() WHERE username='$USER'" > /dev/null
+/bin/psql -c "UPDATE core_user SET last_login=now() WHERE username='$USER'" > /dev/null
 
 exec "$@"

I've restarted the dovecot and the log is clean.

Thank you!
Sören

<!-- gh-comment-id:334704260 --> @smindorf commented on GitHub (Oct 6, 2017): @tonioo Ok, here ist is: ``` # which psql /bin/psql ``` I've edited the `/usr/local/bin/postlogin.sh` file and added the path. ``` # diff -u postlogin.sh_ori postlogin.sh --- postlogin.sh_ori 2017-10-06 11:21:18.968028758 +0200 +++ postlogin.sh 2017-10-06 11:18:09.418046534 +0200 @@ -1,6 +1,6 @@ # This file was automatically installed on 2017-09-22T09:12:59.784109 #!/bin/sh -psql -c "UPDATE core_user SET last_login=now() WHERE username='$USER'" > /dev/null +/bin/psql -c "UPDATE core_user SET last_login=now() WHERE username='$USER'" > /dev/null exec "$@" ``` I've restarted the dovecot and the log is clean. Thank you! Sören
Author
Owner

@tonioo commented on GitHub (Oct 6, 2017):

This issue was moved to modoboa/modoboa-installer#159

<!-- gh-comment-id:334805892 --> @tonioo commented on GitHub (Oct 6, 2017): This issue was moved to modoboa/modoboa-installer#159
Author
Owner

@jellium commented on GitHub (Mar 2, 2024):

Dear,
I encounter a similar issue with Modoboa and postlogin.sh script for Dovecot.
The error is:

2024-03-02T16:19:05.745936+01:00 MODOBOA dovecot: imap-login: Login: user=<***>, method=PLAIN, rip=***, lip=***, mpid=422643, TLS, session=<v5BiA68Sb+hSQbRc>
2024-03-02T16:19:05.795065+01:00 MODOBOA dovecot: postlogin: Error: Password for user modoboa:
2024-03-02T16:19:05.796863+01:00 MODOBOA dovecot: postlogin: Error: psql: error: connection to server on socket "/var/run/postgresql/.s.PGSQL.5432" failed: fe_sendauth: no password supplied

I have set .pgpass in /srv/modoboa (user modoboa's home directory), explicitly set PGPASSWORD in the script. The script works when calling it through sudo -u modoboa -- /usr/local/bin/postlogin.sh but the error arises in mail.log when actually login with IMAP.

<!-- gh-comment-id:1974828465 --> @jellium commented on GitHub (Mar 2, 2024): Dear, I encounter a similar issue with Modoboa and postlogin.sh script for Dovecot. The error is: ``` 2024-03-02T16:19:05.745936+01:00 MODOBOA dovecot: imap-login: Login: user=<***>, method=PLAIN, rip=***, lip=***, mpid=422643, TLS, session=<v5BiA68Sb+hSQbRc> 2024-03-02T16:19:05.795065+01:00 MODOBOA dovecot: postlogin: Error: Password for user modoboa: 2024-03-02T16:19:05.796863+01:00 MODOBOA dovecot: postlogin: Error: psql: error: connection to server on socket "/var/run/postgresql/.s.PGSQL.5432" failed: fe_sendauth: no password supplied ``` I have set `.pgpass` in /srv/modoboa (user `modoboa`'s home directory), explicitly set `PGPASSWORD` in the script. The script works when calling it through `sudo -u modoboa -- /usr/local/bin/postlogin.sh` but the error arises in `mail.log` when actually login with IMAP.
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
starred/modoboa-modoboa#1007
No description provided.