Exim4 panic log: "Failed to get user name for uid 1001"

I have a router which delivers mail to certain domains into a MailDir for the domain, and uses a domain:user map to give file ownership to the right user.

The problem is that since updating the uid of the users (needed to bring in sync with other servers), exim is throwing errors into the panic log saying

Failed to get user name for uid 1001

Where 1001 is the old uid for one of the users concerned (the new one is 1008). It also generates these errors for 1002, the other user that I changed.

Here's the router

domain_catch_all_transport:
        debug_print = "T: domain_catch_all_transport for $local_part@$domain"
        driver = appendfile
        delivery_date_add
        envelope_to_add
        return_path_add
        maildir_format
        user = ${lookup{$domain}lsearch{/etc/exim4/civicrm-catchalls}}
        group = ${lookup{$domain}lsearch{/etc/exim4/civicrm-catchalls}}

And here's the lookup file format:

example.com:usernameone
example.org.uk:usernametwo

You'll note that no uids are specified. Running id usernameone shows the new user and group.

What I have tried

  • I have scanned the entire file system for anything user or group owned by the old uids and updated them.
  • I have run update-exim4.conf and service restart exim4
  • I have recursively grepped the /etc/exim4 for the offending uid, 1001 and found nothing.
  • I have checked that exim is able to deliver (and correctly set user, group) to the domains in question - all good there.

I'm still getting these warnings/errors. Looking at mainlog I see that the errors come at random times, not while processing mail(!) e.g.

2014-03-03 09:00:01 Failed to get user name for uid 1001
2014-03-03 09:00:01 Failed to get user name for uid 1003
2014-03-03 09:10:01 Failed to get user name for uid 1001
2014-03-03 09:11:38 Start queue run: pid=3457
2014-03-03 09:11:38 End queue run: pid=3457
2014-03-03 09:15:01 Failed to get user name for uid 1003
2014-03-03 09:20:01 Failed to get user name for uid 1001
2014-03-03 09:30:01 Failed to get user name for uid 1003
2014-03-03 09:30:01 Failed to get user name for uid 1001

Context

I'm running Debian 7 (stable/Wheezy) with Exim4 4.80.7.


When exim queues a message, it stores lots of extra information with the message in the queue. One of the things that is stored with the message is the uid and gid that the process should run as. I'll bet if you grep your mail queue headers (probably in /var/spool/exim4/input/*-H) you will find those lingering 1001 and 1003 entries in the second line of some *-H files. I suggest your options are:

  1. Delete those entries from the queue, or...
  2. Stop exim. Manually edit those files changing the "uid gid" to match your new uid and gid. Start exim and see if it delivers properly.

It's also possible that there are some hard coded uid/gid's in the transport configurations? The actual exim configuration file in Debian is auto-generated from configuration settings, and its location can be displayed with exim -bV. The last line will be the location of the configuration file. Do some grepping and looking through that file to see if there is anything hard-coded.