+10 votes
1.7k views
in Android by
How to fix "E: Could not open the lock file" / var / lib / dpkg / lock "- open (13: Permission denied)"

1 Answer

+11 votes
by (201k points)
Edited 1: added warning parcel
Edited 2: added reason for the problem
Hello again everyone. In incomunables efforts to shorter posts I'll try to get to the point. Today I get an error terminal and we all had. Dpkg is blocked and not let us do updates or install packages from Ubuntu terminal.
 
Is relatively common that every so Ubuntu package and when we do an update we pull the message in question E: Could not open the lock file "/ var / lib / dpkg / lock" - open (13: Permission denied). This message blocks all types of installation and upgrade the system, making it really annoying. The reasons are cosa'e mandinga for me, but I share the solution below.
 
Solution. Pim pam pum (or 2 kicks)
 
In short, open a terminal and paste:
 
sudo rm -Rf var/lib/dpkg/lock ; sudo apt-get dist-upgrade -y
A jiffy ... that páaaaare music !: If they added a new PPA or installed a paquetón does not work well, then the top line forces the package is installed. If that's the case, take out the "-y" final and monitor the installation go correctly. Thank guglplás + Javi in ​​the signaling.
Ready!
The reason for the error, as I said, I is completely alien is simple (thanks + Hector!): It is because manually cancel the process apt-get update. After cancellation, dpkg is packed and locked the folder preventing access to system packages. So if you want to prevent this error, no ctrl + co killall apt-get during `sudo apt-get update`.
 
This solution is derived directmente I presented the message which returns apt-get. When he says that "/ var / lib / dpkg / lock" is locked, then we know that the problem is there. Far from trying to "unlock" the easy way is to delete because dpkg should I regenarlo for every package installed and, indeed, is what happens. Once we force the removal of the directory everything returns to normal. To finish curing system must restart.
 
Wow, that was short. I feel weird. : P
Hope they serve and the next! : D
Ask a Question
Welcome to WikiTechSolutions where you can ask questions and receive answers from other members of the community.

You can ask a question without registration.

Categories

...