Loading ...
Sorry, an error occurred while loading the content.

Re: issue connecting to mysql after upgrade

Expand Messages
  • Jeff Weinberger
    ... All chroot flags are set to n ... Tried this...no change :( ... I checked looking at permissions and trying it as the postfix user and all works (I
    Message 1 of 9 , Jan 1, 2009
    • 0 Attachment
      On Jan 1, 2009, at 1:55 PM, mouss wrote:

      > Jeff Weinberger a écrit :
      >> Hello again:
      >>
      >> One more issue on which I would appreciate any help anyone can offer:
      >>
      >> Yesterday I upgraded my postfix installation from 2.5.2 to 2.5.5
      >> and my
      >> MySQL installation from 5.0.51b to 5.0.75. Immediately after
      >> restarting
      >> everything (the whole computer), I started seeing these messages in
      >> my
      >> mail log:
      >>
      >> Jan 1 09:48:35 s postfix/smtpd[13199]: warning: connect to mysql
      >> server localhost: Can't connect to local MySQL server through socket
      >> '/tmp' (38)
      >> Jan 1 09:48:35 s postfix/cleanup[13201]: warning: connect to
      >> mysql
      >> server localhost: Can't connect to local MySQL server through socket
      >> '/tmp' (38)
      >> Jan 1 09:48:42 s postfix/trivial-rewrite[13205]: warning:
      >> connect
      >> to mysql server localhost: Can't connect to local MySQL server
      >> through
      >> socket '/tmp' (38)
      >>
      >> As far as I can tell this has been consistent with smtpd, cleanup and
      >> trivial-rewrite, but nothing else. (there have been pre-existing
      >> issues,
      >> per my prior conversation with mouss, with dspam, but these have not
      >> changed at all - they existed before the upgrade and still exist)
      >>
      >> I use mysql for nearly all my tables in postfix. All of my aliases
      >> are
      >> working and forwarding fine, which means that postfix can access my
      >> mysql database (and yes, postconf -m shows mysql). virtual is finding
      >> the maildirs correctly for my virtual mailboxes.
      >>
      >> However, my sender_canonical_maps are no longer working after the
      >> upgrade (outbound addresses are not being rewritten at all as they
      >> were
      >> before the upgrade)
      >>
      >> As an example, my main.cf contains:
      >> sender_canonical_maps=mysql:/etc/postfix/mysql_canonical_maps.cf
      >>
      >> and mysql_canonical_maps.cf contains:
      >>
      >> user = postfixuser
      >> password = postfixpassword
      >> hosts = localhost, 127.0.0.1
      >> dbname = postfixdatabase
      >> query = SELECT result FROM canonical WHERE address='%s' AND
      >> active='Y'
      >>
      >> (obvious information changed). This is unchanged before and after the
      >> upgrade.
      >>
      >> The query works on all the addresses (I tested it at the mysql
      >> command
      >> prompt).
      >>
      >> I also tested a local telnet to 127.0.0.1 on port 3306 which worked
      >> as
      >> expected and mysql responds perfectly. I also tested connection
      >> through
      >> the localhost socket with works as expected. Also several other
      >> parts of
      >> my mail system (e.g. courier_auth) connect through the socket and
      >> report
      >> success. And as noted, postfix is able to connect most of the time
      >> (aliases, virtual maildirs, etc.). Other software on my system, e.g.
      >> PHP, is also able to connect to mysql successfully.
      >>
      >> I tried all the steps in the MySQL documentation on dev.mysql.com
      >> suggested to diagnose this error, and all confirmed that the MySQL
      >> server is working correctly.
      >>
      >> So I find myself not knowing where to look next, and I hope someone
      >> here
      >> knows what might be happening or at least be able to point me in the
      >> right direction.
      >>
      >> One additional piece of information: I am running on Mac OS/X and as
      >> part of this upgrade, I installed the 10.5.5 to 10.5.6 upgrade (thus
      >> needing to restart my computer). This upgrade is known to break
      >> postfix.
      >> So I reinstalled postfix and my main.cf and master.cf files after the
      >> upgrade and stopped and restarted postfix to be sure. (and mysql)
      >>
      >> What other information might be helpful in diagnosing this?
      >>
      >
      >
      > - check whether any services are chrooted in master.cf (the 5th field
      > must be set to 'n' and not to 'y' or '-')?

      All chroot flags are set to "n"
      >
      >
      > - try using proxymap (foo_maps=proxy:mysql:/etc/....).

      Tried this...no change :(

      >
      >
      > - make sure the mysql socket is accessible by postfix (and not just by
      > root).

      I checked looking at permissions and trying it as the postfix user and
      all works (I suspected it would, as many accesses work fine (aliases,
      etc. as I noted earlier)

      >
      >
      > - try with "hosts = 127.0.0.1" (without "localhost")

      Tried this - no change. :(

      I tried each of the suggestions you made with alias, virtual and local
      addresses

      I noticed that when local complained about mysql access, it still did
      fine looking up the local alias and forwarding it correctly.

      I'm starting to wonder whether this is a "can't connect" or a delay in
      connecting - is it possible that it's taking too long to connect so a
      warning is reported, but the connection happens eventually? or that it
      works on a retry?

      The only thing I've found that doesn't work as expected is
      sender_canonical_maps which would invalidate this theory, but the
      local behavior makes me think it's a possibility?

      Alternatively, is it possible that something in the mysql capabilities
      of postfix compiled wrong? I am not that familiar with gcc and the
      build process (I use what I know works) - is there something I can
      look at in the ./configure or make output that would tell me?

      I did try rebuilding (./configure,. make, make install) three times...

      >
      >
      > why do use sender_canonical instead of canonical? rewrite should be
      > consistent, and "your sender is the recipient's recipient"...
      >
      >
      >

      This is mostly because I use maildrop as the virtual delivery agent
      for many of the virtual mailboxes. I'm really just testing this, and
      may end up using canonical instead. But here's my thinking:

      I have one user who wants a minor change - sounds silly, but gives me
      a good chance to experiment/learn. I'm rewriting the one address to a
      specific capitalization. I know I'll be doing more with more users soon.

      I want to rewrite when mail goes to someone outside my postfix
      install. canonical_maps would also rewrite inbound mail to that
      address, which is not bad, but not the desired behavior.

      So I am trying sender_canonical_maps to get the behavior I want.

      I'm open to suggestions and learning better ways to do this, so any
      thoughts you have are welcome.

      >

      Thank you!
    • mouss
      ... ahem. if you do this, you should not hear about a socket. it should use a TCP connection. can you show the errors? ... Then you may want to use
      Message 2 of 9 , Jan 1, 2009
      • 0 Attachment
        Jeff Weinberger a écrit :
        >> [snip]
        >>
        >> - try with "hosts = 127.0.0.1" (without "localhost")
        >
        > Tried this - no change. :(
        >

        ahem. if you do this, you should not hear about a socket. it should use
        a TCP connection. can you show the errors?

        > [snip]
        >>
        >> why do use sender_canonical instead of canonical? rewrite should be
        >> consistent, and "your sender is the recipient's recipient"...
        >>
        >>
        >>
        >
        > This is mostly because I use maildrop as the virtual delivery agent for
        > many of the virtual mailboxes. I'm really just testing this, and may end
        > up using canonical instead. But here's my thinking:
        >
        > I have one user who wants a minor change - sounds silly, but gives me a
        > good chance to experiment/learn. I'm rewriting the one address to a
        > specific capitalization. I know I'll be doing more with more users soon.
        >
        > I want to rewrite when mail goes to someone outside my postfix install.
        > canonical_maps would also rewrite inbound mail to that address, which is
        > not bad, but not the desired behavior.
        >
        > So I am trying sender_canonical_maps to get the behavior I want.
        >

        Then you may want to use smtp_generic_maps instead of canonical.
      • Jeff Weinberger
        ... I would think so also. I m at a loss here, but I think this is no longer a problem. i was able to turn on very verbose logging in mysql, and it turns out
        Message 3 of 9 , Jan 1, 2009
        • 0 Attachment
          On Jan 1, 2009, at 4:53 PM, mouss wrote:

          > Jeff Weinberger a écrit :
          >>> [snip]
          >>>
          >>> - try with "hosts = 127.0.0.1" (without "localhost")
          >>
          >> Tried this - no change. :(
          >>
          >
          > ahem. if you do this, you should not hear about a socket. it should
          > use
          > a TCP connection. can you show the errors?

          I would think so also.

          I'm at a loss here, but I think this is no longer a problem. i was
          able to turn on very verbose logging in mysql, and it turns out that
          all the queries are in fact being made.

          I also have to confess to a bit of stupidity about my own ability to
          hold enough configuration information in my head (making postfix much
          smarter than I am!). I have dspam set to filter all mail both inbound
          and outbound (this has to change, but served the purpose when I
          initially set it up. And to stop multiply always_bcc results,
          specified "-o receive_override_options=no_address_mappings" in the
          master.cf entry for re-injection. the pipe to dspam is case-folding
          and then the sender_canonical_maps are being ignored. I didn't event
          think to look at this as a reason canonical was failing.

          I apologize sincerely for taking so much time and effort to get here
          and for leading you down this path. But still I appreciate the help.
          This will help me clean up this set of configuration issues.

          As to the warnings, I still don't know. Everything seems to be
          working, but issuing warnings.

          Here are a bunch of the errors - from more reading I think the key is
          in the (38) which I think(??) is a postfix error code...is it? do you
          know what it means?:

          Jan 1 17:00:33 s postfix/smtpd[21502]: warning: connect to mysql
          server localhost: Can't connect to local MySQL server through socket '/
          tmp' (38)
          Jan 1 17:00:33 s postfix/cleanup[21517]: warning: connect to mysql
          server localhost: Can't connect to local MySQL server through socket '/
          tmp' (38)
          Jan 1 17:06:33 s postfix/trivial-rewrite[21546]: warning: connect to
          mysql server localhost: Can't connect to local MySQL server through
          socket '/tmp' (38)
          Jan 1 17:06:34 s postfix/smtpd[21544]: warning: connect to mysql
          server localhost: Can't connect to local MySQL server through socket '/
          tmp' (38)
          Jan 1 17:06:34 s postfix/cleanup[21547]: warning: connect to mysql
          server localhost: Can't connect to local MySQL server through socket '/
          tmp' (38)
          Jan 1 17:09:42 s postfix/trivial-rewrite[21582]: warning: connect to
          mysql server localhost: Can't connect to local MySQL server through
          socket '/tmp' (38)
          Jan 1 17:09:42 s postfix/smtpd[21581]: warning: connect to mysql
          server localhost: Can't connect to local MySQL server through socket '/
          tmp' (38)
          Jan 1 17:09:42 s postfix/cleanup[21583]: warning: connect to mysql
          server localhost: Can't connect to local MySQL server through socket '/
          tmp' (38)
          Jan 1 17:09:45 s postfix/local[21587]: warning: connect to mysql
          server localhost: Can't connect to local MySQL server through socket '/
          tmp' (38)
          Jan 1 17:09:58 s postfix/trivial-rewrite[21592]: warning: connect to
          mysql server localhost: Can't connect to local MySQL server through
          socket '/tmp' (38)
          Jan 1 17:11:50 s postfix/trivial-rewrite[21624]: warning: connect to
          mysql server localhost: Can't connect to local MySQL server through
          socket '/tmp' (38)
          Jan 1 17:11:50 s postfix/smtpd[21623]: warning: connect to mysql
          server localhost: Can't connect to local MySQL server through socket '/
          tmp' (38)
          Jan 1 17:11:50 s postfix/cleanup[21625]: warning: connect to mysql
          server localhost: Can't connect to local MySQL server through socket '/
          tmp' (38)
          Jan 1 17:15:46 s postfix/trivial-rewrite[21648]: warning: connect to
          mysql server localhost: Can't connect to local MySQL server through
          socket '/tmp' (38)
          Jan 1 17:15:49 s postfix/smtpd[21646]: warning: connect to mysql
          server localhost: Can't connect to local MySQL server through socket '/
          tmp' (38)
          Jan 1 17:15:49 s postfix/cleanup[21649]: warning: connect to mysql
          server localhost: Can't connect to local MySQL server through socket '/
          tmp' (38)
          Jan 1 17:19:10 s postfix/trivial-rewrite[21675]: warning: connect to
          mysql server localhost: Can't connect to local MySQL server through
          socket '/tmp' (38)

          >
          >
          >> [snip]
          >>>
          >>> why do use sender_canonical instead of canonical? rewrite should be
          >>> consistent, and "your sender is the recipient's recipient"...
          >>>
          >>>
          >>>
          >>
          >> This is mostly because I use maildrop as the virtual delivery agent
          >> for
          >> many of the virtual mailboxes. I'm really just testing this, and
          >> may end
          >> up using canonical instead. But here's my thinking:
          >>
          >> I have one user who wants a minor change - sounds silly, but gives
          >> me a
          >> good chance to experiment/learn. I'm rewriting the one address to a
          >> specific capitalization. I know I'll be doing more with more users
          >> soon.
          >>
          >> I want to rewrite when mail goes to someone outside my postfix
          >> install.
          >> canonical_maps would also rewrite inbound mail to that address,
          >> which is
          >> not bad, but not the desired behavior.
          >>
          >> So I am trying sender_canonical_maps to get the behavior I want.
          >>
          >
          > Then you may want to use smtp_generic_maps instead of canonical.
          >
          >

          Thank you - I will try that!! that helps! :)
        • Terry Carmen
          ... Sorry about the --xml. Although it doesn t hurt anything, you don t really need it. In any event, if you re getting the error messages, I don t see how
          Message 4 of 9 , Jan 1, 2009
          • 0 Attachment
            Terry Carmen wrote:
            >
            >
            > Jeff Weinberger wrote:
            >> Hello again:
            >>
            >> One more issue on which I would appreciate any help anyone can offer:
            >>
            >> Yesterday I upgraded my postfix installation from 2.5.2 to 2.5.5 and
            >> my MySQL installation from 5.0.51b to 5.0.75. Immediately after
            >> restarting everything (the whole computer), I started seeing these
            >> messages in my mail log:
            >>
            >> Jan 1 09:48:35 s postfix/smtpd[13199]: warning: connect to
            >> mysql server localhost: Can't connect to local MySQL server through
            >> socket '/tmp' (38)
            >> Jan 1 09:48:35 s postfix/cleanup[13201]: warning: connect to
            >> mysql server localhost: Can't connect to local MySQL server through
            >> socket '/tmp' (38)
            >> Jan 1 09:48:42 s postfix/trivial-rewrite[13205]: warning:
            >> connect to mysql server localhost: Can't connect to local MySQL
            >> server through socket '/tmp'
            >
            >> (38)Can't connect to local MySQL server through socket '/tmp'
            > /tmp isn't a socket, it's a directory.
            >
            > Run:
            >
            > mysql --xml -uroot -p -e "SHOW VARIABLES WHERE Variable_name = 'socket';"
            >
            > to see where mysql has it's socket, then make sure that postfix is
            > looking for it there, or move the socket, or switch postfix and MySQL
            > to use a TCP socket.
            >
            > If you're running chroot'ed the socket needs to be where postfix can
            > find it.
            >
            > Terry

            Sorry about the --xml. Although it doesn't hurt anything, you don't
            really need it.

            In any event, if you're getting the error messages, I don't see how
            postfix can be using mysql.

            Terry
          • Jeff Weinberger
            ... OK, now I ve taken out the localhost again and there s no more complaining. (not sure why It continued complaining last time...) This is not a postfix
            Message 5 of 9 , Jan 2, 2009
            • 0 Attachment
              On Jan 1, 2009, at 4:53 PM, mouss wrote:

              > Jeff Weinberger a écrit :
              >>> [snip]
              >>>
              >>> - try with "hosts = 127.0.0.1" (without "localhost")
              >>
              >> Tried this - no change. :(
              >>
              >
              > ahem. if you do this, you should not hear about a socket. it should
              > use
              > a TCP connection. can you show the errors?

              OK, now I've taken out the localhost again and there's no more
              complaining. (not sure why It continued complaining last time...)

              This is not a postfix issue. This is clearly a MySQL socket issue. I'm
              pursuing this on the MySQL lists.

              Thank you!

              >
              >
              >> [snip]
              >>>
              >>> why do use sender_canonical instead of canonical? rewrite should be
              >>> consistent, and "your sender is the recipient's recipient"...
              >>>
              >>>
              >>>
              >>
              >> This is mostly because I use maildrop as the virtual delivery agent
              >> for
              >> many of the virtual mailboxes. I'm really just testing this, and
              >> may end
              >> up using canonical instead. But here's my thinking:
              >>
              >> I have one user who wants a minor change - sounds silly, but gives
              >> me a
              >> good chance to experiment/learn. I'm rewriting the one address to a
              >> specific capitalization. I know I'll be doing more with more users
              >> soon.
              >>
              >> I want to rewrite when mail goes to someone outside my postfix
              >> install.
              >> canonical_maps would also rewrite inbound mail to that address,
              >> which is
              >> not bad, but not the desired behavior.
              >>
              >> So I am trying sender_canonical_maps to get the behavior I want.
              >>
              >
              > Then you may want to use smtp_generic_maps instead of canonical.
              >
              >
            Your message has been successfully submitted and would be delivered to recipients shortly.