APT Could Not Get Lock on Ubuntu or Debian: Identify the Active Package Task
Another process is using the package database or package-manager lock. Understand the context and follow diagnostic checks and verification, with an original diagram and official references.