How to fix "E: Could not get lock /var/cache/apt/archives/lock - open (11: Resource temporarily unavailable)"

Just got the error when upgrading my system (Ubuntu 12.04):

---
E: Could not get lock /var/cache/apt/archives/lock - open (11: Resource temporarily unavailable)
E: Unable to lock directory /var/cache/apt/archives/
---

And here're things I need to do to get rid of that annoying error:

$ sudo rm /var/lib/apt/lists/lock

$ sudo rm /var/cache/apt/archives/lock

Comments