How to fix DPKG_LOCKED error in Cydia / Sileo / Zebra on iOS Jailbreaks

Ever since the beginning of Cydia, iOS Jailbreaks always relied on DPKG (Debian Package Manager) in order to install tweaks. To this day, iOS jailbreak tweaks come in the .DEB format which is handled by DPKG in the background.

In fact, you don’t even need Cydia to download and install tweaks on a jailbroken iOS device. If you have the .DEB file containing the tweak, and access to a terminal or SSH, a simple dpkg -i file.deb would install the tweak without any issues.




Cydia itself doesn’t do much other than download the DEB file from the appropriate repo and call DPKG in the background. Cydia is a GUI application for APT and DPKG, and nothing more. In this case, whenever an error occurs while installing a package, it’s usually DPKG that complains rather than Cydia, Sileo, or Zebra.

What does DPKG_LOCKED mean?

The DPKG_LOCKED usually means DPKG failed to install a package but was abruptly stopped or it crashed. When installing a package, DPKG puts a lock file somewhere in the file system (either /var/lib/dpkg, or /Library/lib/dpkg). This way if another process tries to spawn DPKG and install another DEB file while DPKG is busy, that process will just get an error message because DPKG is currently locked doing something else.

Unfortunately, if for some reason your device crashes, reboots, or simply kills DPKG right in the middle of installing a tweak, DPKG doesn’t get to finish the installation and clear the lock file from the file system. This results in DPKG remaining permanently locked and thus not allowing any tweak to be installed again.

The fix is rather simple if you have any of the following three options:

  • Can SSH into the device (Dropbear or OpenSSH already installed).
  • Have Filza File Manager installed.
  • Have NewTerm or any other mobile terminal tweak installed.

How to fix DPKG_LOCKED error in Cydia / Sileo / Zebra on iOS Jailbreaks

Method 1: Via PC SSH or Mobile Terminal / NewTerm 2

In order to fix DPKG_LOCKED via SSH, all you have to do is to follow the steps below, one by one:

  1. SSH into your device as root. The default password is alpine if you never changed it. Make sure your PC and your phone are on the same WiFi.
  2. Run the following command: cd /var/lib/dpkg OR cd /Library/lib/dpkg if the other one says No such file or directory.
  3. Run the following command: rm lock
  4. Go in Cydia and refresh all packages / repos.
  5. Your issue should be fixed.




Method 2: Via Filza File Manager

If you already have Filza installed, you can fix this issue much easier because it’s all visual, with no commands and SSH involved.

  1. Open Filza.
  2. Navigate to either /var/lib/dpkg OR /Library/lib/dpkg folder (whichever exists for you).
  3. Inside the DPKG folder, find the “lock” file and simply delete it.
  4. Open Cydia and refresh all packages and repos.
  5. The error should be fixed.

That’s all, it’s that simple to fix the DPKG_LOCKED issue on any jailbreak. We’ve also put together a video tutorial if you want to check it out. Even though it was made on iOS 11, it applies to ANY jailbreak.

Credits:

Warning icons created by amonrat rungreangfangsai – Flaticon

Click to rate this post!
1

By GeoSn0w

An iOS and Jailbreak enthusiast who has been around for quite some time in the community. I've developed my own jailbreaks before and I am currently maintaining iSecureOS, one of the first iOS Anti-Malware tools for jailbroken devices. I also run iDevice Central on YouTube with over 142.000 Subscribers! Thank you for being part of this awesome community.

Leave a Reply

Your email address will not be published. Required fields are marked *