Ubuntu – unattended-upgrades error: “/etc/cron.daily/apt: DB Update failed, database locked”

14.04aptcronunattended-upgradesupdates

Ubuntu 14.04.1 LTS

Since installing unattended-upgrades, the following error message is received daily:

From root@xxxxx  Thu Aug 28 06:36:06 2014
X-Original-To: root
From: root@xxxxx (Cron Daemon)
To: root@xxxxx
Subject: Cron <root@xxxxx> test -x /usr/sbin/anacron || ( cd / && run-parts --report /etc/cron.daily )
Content-Type: text/plain; charset=ANSI_X3.4-1968
X-Cron-Env: <SHELL=/bin/sh>
X-Cron-Env: <PATH=/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin>
X-Cron-Env: <HOME=/root>
X-Cron-Env: <LOGNAME=root>
Date: Thu, 28 Aug 2014 06:36:06 -0400 (EDT)

/etc/cron.daily/apt:
DB Update failed, database locked

The error message is NOT received on days where security updates are actually installed and an automatic reboot occurs.

What I would like to know please:

  1. Is this error message a "real problem" since security updates appear to be auto-installing as expected.
  2. Manually running the following commands occurs without error, so why is the (APT?) DB locked when run as a cron job? : unattended-upgrades -d or apt-get update

The same/similar issue is asked here but unfortunately with no solution:
what can be causing /etc/cron.daily/apt to hang?

Best Answer

My answer to this question was deleted. I'll try again:

This problem is actually not caused by APT DB being locked but the apt cron job tries to update xapian index. If you want to get rid of this error message just remove the apt-xapian-index package.

Meta: I guess some admin didn't like earlier answer to this problem as it contained link link to my blog with more details on this issue. It would be very useful to have some feedback on the deletion, especially for new users. The link to help center didn't really help. If this gets deleted, I will get the message, and not comment on this issue anymore. Good luck finding the answer ;-D