Apparently while I was not seeing, the apt/dpkg tag became a mess. There are a bunch of posts that are duplicated one of the other, a long list of concatenated duplicates of duplicates, duplicates that leads to nowhere, and the overuse of a post that won't help anybody.
Now, I'm building a list of the most common problems about dpkg/apt:
1. are you root?
The error itself is very clear. OP isn't root and hence it can't use dpkg/apt-get. The canonical question is:
Unable to lock the administration directory (/var/lib/dpkg/), are you root?
2. is another process using it?
Again another clear message, there's another apt/dpkg instance running? The way to identify which process is detailed here and ways to fix it here.
3. The following packages have unmet dependencies: E: Unable to correct problems, you have held broken packages.
This one is very tricky! As detailed by Vangel Ajanovski answer there are 1 and thousand ways to fix the problem depending of the circumstances and the action that triggered the problem. As he said, There is NO single right answer for this question and there is NO simple answer. Hence if you are thinking to flag it as duplicated of How do I resolve unmet dependencies after adding a PPA?, think again, is not.
Now, what's the problem with this? Normally people uses several PPA which maintainers seems that doesn't understand the beautifulness of the Debian Package System causing serious dependencies issues when people tries to install their packages. Depending the final goal (install a package, remove it, upgrade) and the packages involved (rhythmbox, wine, amarok, mono, etc.) there solution is suit tailored, unless the PPA is popular.
So please, do not abuse this question. If you see sudo apt-get install package
or sudo apt-get (dist-)upgrade
as the trigger of the problem, ask OP to include the output of sudo apt-get check
, cat /etc/apt/sources.list{,.d/*.list}
and apt-cache policy packages-involved
to their questions. You can also ask me or AvinashRaj (he's getting a knot of dpkg/apt) in chat or ask the UL guys.
There are other common problems with dpkg/apt (overriding a file provided by another package, for example) that sometimes will need a fix from the package maintainer or another advanced method.
4. The use of --force
This is backwards, if you see an answer that use --force
without explaining why or using it as first solution (ie. there are another answers trying to fix the issue but OP failed) be free of downvote them. You shouldn't abuse of the force or the dark side will swallow you... err... since it's possible that your system will have issues later when you try to upgrade/remove the package.