I had a problem with my Ubuntu 14.04 servers daily cron job sending an error mail every day which basically says just this:
DB Update failed, database locked
It seems that I am not alone. There are many posts on several forums about this problem. None of the suggested fixes worked in my case though the symptoms are basically the same. When the /etc/cron.daily/apt is run manually, it seems to work but when cron runs the the daily cron job, I always get the error email.
This error message email is quite useless and useless error emails can actually be dangerous as I had the habit of automatically deleting those cron.daily mails without even looking at them. “Yeah, it’s just the same old thing”. You shouldn’t do that, as you might one day miss some real problems.
Finally I got too frustrated with this and decided to take a deeper look at this and found a solution which fixed this in my case.
Uninstalling apt-xapian-index package fixed the problem:
sudo apt-get remove apt-xapian-index
I turned on verbose logging for the apt cron job. That way I was able to figure out that the problem occurs when the /etc/cron.daily/apt script tries to run update-apt-xapian-index.
... # now run apt-xapian-index if it is installed to ensure the index # is up-to-date if [ -x /usr/sbin/update-apt-xapian-index ]; then nice ionice -c3 update-apt-xapian-index -q -u fi ...
I had no idea what update-apt-xapian-index is and what it does. The man page didn’t really help. “update-apt-xapian-index – rebuild the Apt Xapian Index”. Oh really.
Googling didn’t help too at first. Wikipedia has some info about Xapian. But it seems that Synaptic, the Ubuntu graphical package manager probably uses Xapian. On my Ubuntu server I don’t use Synaptic so I don’t care if the Apt Xapian index is not updated. The usual apt-tools should still work perfectly. So I just removed the apt-xapian-index package and get no more daily reports about this “problem” 🙂
Disclaimer: Works for me. YMMV.
Thanks! This helped me a lot.
Thanks for this
This helped me too. Thank you for persisting.