As an example, the following screenshots show the “apt-get install” command throwing similar looking errors.However, if you take a closer look, you’ll observe that the text within brackets in the first line and the text after the comma in the second line are different in both scenarios making it clear that the error in the first scenario has something to do with user permissions, while in the second scenario it is related to the lock file being temporarily unavailable.
Whenever you use these tools to install or remove software, they lock the package database (by creating a “lock” file) before performing the actual operation, something which is actually done by getting the lock for the “/var/lib/dpkg/” directory.
Whenever you encounter this error, the first step should be to read the error description carefully.
It usually contains some crucial and time-saving hints.
If you’re facing a permission-related error (as shown in the first image above), it’s most likely because the user running the “apt-get” or “apt” command doesn’t have sufficient privileges and the command was run without .
Once the command is run with root privileges, the error will go away.