what can be causing /etc/cron.daily/apt to hang?

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

Subject

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

Body

/etc/cron.daily/apt:
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


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.


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

ref: https://lists.ubuntu.com/archives/ubuntu-users/2009-February/175474.html & http://ubuntuforums.org/showthread.php?t=1071892#post_6747612