How To Fix “E: Could not get lock /var/lib/apt/lists/lock – open (11: Resource temporarily unavailable)” in Ubuntu

Question: Hello, I tried running the command below and had this error.

Error_apt

$ sudo apt-get install vlc
[sudo] password for enock:
E: Could not get lock /var/lib/apt/lists/lock - open (11: Resource temporarily unavailable)
E: Unable to lock directory /var/lib/apt/lists/

This is some thing most people encounter. This occurs

Why?

Because,

There is a process in progress that is making use of ‘apt-get’. It might be that you are using the Ubuntu Software Center  to install an application and the same time trying to use the Terminal. Or using two terminals at the same time while one is already using ‘apt-get’. So you only have to wait for this process to be completed. But sometimes it doesn’t seem to work so. May be a background application is updating automatically. Even after restart, you still can’t pass this error.

Solution:

Open terminal and run this command:

$ sudo fuser -vki /var/lib/apt/lists/lock

And now re-run your command, everything should work as expected. You can also share any other method that works.