1

Every time I try to run this command, this is what I get:

apt-get update

Result:

Reading package lists... Done

E: Could not open lock file /var/lib/apt/lists/lock - open (13: Permission denied)

E: Unable to lock directory /var/lib/apt/lists/

W: Problem unlinking the file /var/cache/apt/pkgcache.bin - RemoveCaches (13: Permission denied)

W: Problem unlinking the file /var/cache/apt/srcpkgcache.bin - RemoveCaches (13: Permission denied)
  • Something else is running apt. It's probably the apt-daily service. – Dougie Jan 26 at 17:54
3

The apt-get update command requires to write some system directories hence you have to run it as a root user. Or, you can run it by other users (such as pi) with sudo before the command.

So:

sudo apt-get update  

In addition, if you still get this E: Unable to lock directory /var/lib/apt/lists/ error, you can remove the apt lock file and see if that fixes the issue on your Raspbian/Debian/Ubuntu box:

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

Looks like you're not prefixing the command with sudo. Try sudo apt update instead. You could use sudo apt-get update but it seems that this is no longer the best practice for Raspbian.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.