Cette semaine, a plusieurs reprise, un processus bloquait mes tentatives de mise à jour.

$ sudo aptitude update
E: Could not get lock /var/lib/dpkg/lock - open (11: Resource temporarily unavailable)
E: Unable to lock the administration directory (/var/lib/dpkg/), is another process using it?
W: Could not lock the cache file; this usually means that dpkg or another apt tool is already installing packages.  Opening in read-only mode; any changes you make to the states of packages will NOT be preserved!
[...]
99% [Working]               
Current status: 0 (-323) upgradable, 0 (-80296) new.
E: Could not get lock /var/lib/dpkg/lock - open (11: Resource temporarily unavailable)
E: Unable to lock the administration directory (/var/lib/dpkg/), is another process using it?
E: Couldn't rebuild package cache

Je me suis demandé comment savoir qui bloquait dpkg et j'ai trouvé deux approches différentes.

# lsof /var/lib/dpkg/lock
# ps -ax | grep dpkg

Au moins, de cette manière, plus besoin de supprimer le fichier lock à l'aveugle ;)