Cara Memperbaiki Error Ubuntu: “E: Could not get lock /var/lib/dpkg/lock”

Jika kalian menggunakan Ubuntu 18.04 LTS dan mendapati error seperti ini:

E: Could not get lock /var/lib/dpkg/lock-frontend - open (11: Resource temporarily unavailable)
E: Unable to acquire the dpkg frontend lock (/var/lib/dpkg/lock-frontend), is another process using it?

atau

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?

atau juga

E: Could not get lock /var/lib/apt/lists/lock – open (11: Resource temporarily unavailable)
E: Unable to lock directory /var/lib/apt/lists/

Untuk memperbaikinya, silakan:

sudo lsof /var/lib/dpkg/lock

atau:

sudo lsof /var/lib/dpkg/lock-frontend

jika ada, silakan jalankan:

sudo lsof /var/lib/apt/lists/lock

contoh hasilnya:

COMMAND PID USER FD TYPE DEVICE SIZE/OFF NODE NAME
unattende 1123 root 6uW REG 8,2 0 1181062 /var/lib/dpkg/lock

kemudian kill aplikasi dengan ID 1123. dan hapus file itu dengan sudo rm /var/lib/dpkg/lock atau hapus file sudo rm /var/lib/dpkg/lock-frontend atau sudo rm /var/lib/apt/lists/lock.

terakhir, jalankan DPKG Reconfigure:

sudo dpkg --configure -a

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.

%d bloggers like this: