In Ubuntu, you may sometimes encounter an error when attempting to run an apt command:

Pre-requisites

  • Access to a terminal window/command line
  • A user account with sudo or root privileges

Fix

  • Verify apt and/or dpkg isn’t running. It’s still running; then, you should wait for the process to finish.
  • If the process is stuck using the following.
  • Remove the lock file.