Sign up ×
Ask Ubuntu is a question and answer site for Ubuntu users and developers. It's 100% free.

Lately I've been getting a mail from the server every day,


Cron <root@host> test -x /usr/sbin/anacron || ( cd / && run-parts --report /etc/cron.daily )


DB Update failed, database locked

If i just run the /etc/cron.daily/apt part it just stays there with no output, i tried running tail -f /var/log/apt/*.log /var/log/syslog & and then running /etc/cron.daily/apt but no output either

Which database is locked and by what, i'm able to do apt-get update successfully.

Did some updates yesterday and had to restart, so the microsoft fix wont work here (this has been going on since before the updates so not related)

What else can I look into?

This is a amazon instance incase it matters

share|improve this question

3 Answers 3

Long story short, change RandomSleep=1800 to something more pleasent. I chose RandomSleep=5

ref: &

share|improve this answer
This did nothing to fix my problem, which is the same as the OP. If you look at the code, the RandomSleep time is used as a limit for the actual time, which is chosen nominally randomly. Hmm. Looking at the code, there seems to be a bug. RandomSleep is possibly reset to either 1 or 0, by the apt-config call. (If it's even set, mine wasn't.) The apt call either stomps the variable, or does nothing to it. It doesn't actually act on it's value in a useful way. – Hack Saw Jul 4 '13 at 12:37
It seemed to fix my problems for a few days which I think was coincidence more than anything else. – Bruce Aldridge Jul 4 '13 at 21:38

What really properly fixed this problem for me was uninstalling apt-xapian-index package. None of the other suggested fixes did anything in my situation.

You may read more details from my little blog post.

share|improve this answer

This happens when you have multiple APT/DPKG instances running at the same time. If you run something that blocks apt-get like aptitude in GUI mode, and type sudo /etc/cron.daily/apt eventually it will fail with the same message.

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.