This post explains why you may sometimes not be able to run apt commands and how to find out what is causing the issue.