I met this weird problem, and I tried a whole afternoon to solve this, with all the methods I found from google, but till now, nothing seems to be worked.
My ubuntu server's (10.04 LTS) timezone is Europe/Helsinki, it's correct (when I run "date" command, the result shows the right time). But my postfix seems still using UTC timezone, because all the time in /var/log/mail.log is 3 hours earlier than my current time.
I've also copied the /etc/localtime to /var/spool/postfix/etc/localtime, but nothing helps. (cp /usr/share/zoneinfo/Europe/Helsinki /var/spool/postfix/etc/localtim also not work).
I also tried to run dpkg-reconfigure tzdata, also not work, system time always correct, but only mail.log got wrong.
Could anyone give me some suggestion ?
*I have restarted postfix everytime I tried to make some change.
To do so, open Terminal or your command-line interface (CLI) and run the tzselect command. Then, specify the desired timezone and press Enter. One of the best methods to permanently change the timezone on Ubuntu is using the timedatectl command.
Copying the timezone (/etc/localtime) into Postfix's chroot should do the trick, but there are a couple assumptions:
Is your /etc/timezone file set correctly as well? It should probably only contain the line Europe/Helsink
. (Note that you can probably set all the timezone stuff correctly with the command sudo dpkg-reconfigure tzdata
.)
If Postfix is using syslogd for logging, then that may be what is recording logs in UTC. You might consider changing to syslogd-ng (or similar) which supports multiple timezones.
Are you sure that /var/spool/postfix is the chroot that Postfix is using? If that isn't the root of your Postfix jail, there probably won't be all the other config files there.; you can look for the chroot option in the master.cf file, or here's another way to check. In any case, you want the /etc/localtime file in the etc folder that Postfix is using.
Just in case, be sure that it is a "real" timezone file you're copying in, not a symbolic link (from ln -s targetfilename linkfilename
). You can use the command file /etc/localtime
to test; if it tells you it's timezone data, go ahead and copy it to Postfix's chroot; if it tells you it's a symlink, then you want to copy the original /usr/share/zoneinfo/Europe/Helsinki
.
After you changing your timezone, you should restart your syslogd with:
sudo service rsyslog restart
Because postfix usually use syslogd for logging.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With