This morning, the web site was down, certainly due to a ram issue. However, it is now back online.
After the reboot, postgrey, an anti-spam daemon using an automagically filled whitelist database refused to start with the following error in syslog:
ERROR: can’t create DB environment: No such file or directory
I found that the greylisting database in /var/lib/postgrey was corrupted. When I strace postgrey start script with strace -f /etc/init.d/postgrey start I saw misc error messages such as “__db.001: no such file or directory”.
After searching the Internet, I found a guy who had the same error and simply destroyed its greylisting berkeley database (sniff, my db ? dead ?). But I didn’t want to loose mine, so I do the following :
# check that db4.3 tools are installed
# (use your version and package manager for this step)
apt-get install db4.3-util
# dump the current databases :
cd /var/lib/postgrey
db4.3_dump -p postgrey.db >/var/tmp/postgrey.db
db4.3_dump -p postgrey_clients.db >/var/tmp/postgrey_clients.db
# Kill everybody
killall -15 postgrey
# (this killall said logically "no process killed")
# destroy the pid file and all the database files
# to start with fresh entries
rm /var/run/postgrey.pid
rm /var/lib/postgrey/* -f
# start postgrey :
/etc/init.d/postgrey start
# here postgrey is up and running, (with an emtpy db of course)
# So we stop it :
/etc/init.d/postgrey stop
# and restore the db from the dump :
db4.3_load -f /var/tmp/postgrey_clients.db postgrey_clients.db
db4.3_load -f /var/tmp/postgrey.db postgrey.db
# that's all, just restart postgrey :
/etc/init.d/postgrey start
Here it is. I hope you’ll find this tip useful. See you soon.