If running apt-get (or aptitude) and you get the following error:
$ apt-get update E: Could not get lock /var/lib/apt/lists/lock - open (11: Resource temporarily unavailable) E: Unable to lock the list directory
Then (most likely) explenation is that one of the sources have gotten a timeout and that a (cron) sheduled update task have gotten locked.
A simple solution for this is to find the cron process is locked, and kill it.
$ ps -a |grep apt Warning: bad ps syntax, perhaps a bogus '-'? See http://procps.sf.net/faq.html 3737 ? SN 0:00 /bin/sh /etc/cron.daily/apt 3833 ? SN 0:00 apt-get -qq -y update -o APT::Update::Auth-Failure::=cp /usr/share/apt/apt-auth-failure.note /var/lib/update-notifier/user.d/ 3835 ? SN 0:00 /usr/lib/apt/methods/http 3838 ? SN 0:00 /usr/lib/apt/methods/http 3842 ? SN 0:00 /usr/lib/apt/methods/http 3869 ? SN 0:00 /usr/lib/apt/methods/http 4223 pts/0 R+ 0:00 grep apt $ kill -9 3833
If this happens often, then perhaps you should try to debug the sources and remove (or exchange) the source that is causing the problems.