How to Fix Cydia Could not open file /var/lib/dpkg/status

The problem: I jailbroke my iOS device using Yalu Jailbreak. Upon opening Cydia, it’s showing “Could not open file /var/lib/dpkg/status — open (2: No such file or directory). This package lists or status file could not be parsed or opened.”

Is there a solution? Yes!

database-error-cydia

Fix Cydia Could Not Open File /Var/lib/dpkg/status

Some users have tried to use the “Erase All Content and Settings” option in their Settings app, but that didn’t resolve this problem.

Here are the steps:

  1. Download the NewTerm .deb from here
  2. Mac users can use iOS App Signer to turn it from .deb to .iPA. Windows users can follow this video or this.
  3. Download Cydia Impactor from here and sideload the MobileTerminal.ipa to your iOS device
  4. Go to the official site of i-Funbox and download it.
  5. Download the “lib.zip” file from Mediafire.
  6. Open iFunbox and navigate to /var/mobile/Media/Books then import the ‘lib’ folder to that directory

Last but not least, open MobileTerminal on your iPhone or iPad and type in the following commands.

type su

type in your password. default is alpine

type: cp -R /var/mobile/Media/Books/lib /var

Cydia should start working again. For those who have either iFile or Filza and Mobile Terminal installed already, you can start from Step 4 and forward.

How to Fix com.teiron.pphelper error in Cydia

When I finished troubleshooting the “Could Not Open File…” error there is another one that pop out and this one says something like this:

trying to overwrite ‘/Library/MobileSubstrate/DynamicLibraries’, which is also in package com.teiron.pphelperns

This problem is a bit easier to resolve since it doesn’t require a computer or installing another app. Switch over to the Installed tab and look for an app called PP Helper. Go ahead and uninstall that tweak. Respring your iOS device, and you can start installing Cydia tweaks as usual again.

ForkException Error

I received several messages today from readers asking about a new error in Mobile Terminal that says: “Not allowed to fork from inside Sandbox.” This error message usually appears when your iOS device is not in a jailbroken state. If your iPhone or iPad is running 9.x.x, then use the Pangu app to re-jailbreak it.

Cydia is Showing DPKG_LOCKED

This problem appears when a user is trying to install a package from Cydia, and during the installation, it shows the DPKG_locked error.

If you want to fix this problem, try the following steps:

  1. Just like the tutorial above, we’re going to need some sort of SSH client to login into our device. I recommend using PuTTY regardless of your computer OS (Windows or Mac).
  2. Connect your iPhone to the computer
  3. Open PuTTY and enter the following info t it: Host IP: 127.0.0.1 and Port 22
  4. Your login credentials will be root / alpine (default password)
  5. Now type in the following command: dpkg –configure -a
  6. Press enter and then logout of the screen

After you disconnect your iOS device, try to open the Cydia and install a tweak from the Changes tab. See if the error continues to show up. If it does, comment down below the error code, and we’ll try to help.

Leave a Comment

  1. realy you are awesome dude it works for me thank you soooo much man, you can drag the lib file on file systeme RAW and then on Books directly it’s the same

    Reply
  2. Hey quick question, when I open up ifunbox, i can not find the navigation listed above. There is no var/mobile options, looked through all the folders and everything. What am i missing? i dowloaded the terminal and it is installed on my device, downloaded iphonebox, but can find the proper navigation to drop the lib file into

    Reply
  3. Hey I have the exact problem and I followed your steps until using iFunbox moving file step.
    I couldn’t do it because according to ifunbox im not jail-broken yet. But according to pangu app, it says your phone is jail-broken.
    What happened to me before was I jail broken it and rebooted my phone and tried to reactivate the jailbreak, but it always led me to a dark screen. So I erased all my data and reset my phone from settings thinking I could do the whole thing from zero. But the Cydia app is still there no matter how I reset it.
    I didn’t back up because I didn’t have any valuable data in my phone, so I couldn’t restore to back up to remove cydia, but I don’t want to restore my phone from itunes which will update the ios to unjailbreakable new ios version.
    What should I do?
    I successfully installed terminal though. Just can’t move that file to the path in iphone.

    Reply
  4. I just come up with an idea of putting that file into the ipa and then after installation I’ll copy that file to the var location. Wish me luck

    Reply
  5. it worked, but when i go ahead and install something from cydia, like activator for example. it falls short because there’s an error telling me that it’s trying to overwrite something.. bla bla mobilesubstrate/dynamic bla bla. something like that. any idea?

    Reply
  6. When i drab the deb into IOS APP SIGNER it does not let me create IPA. It says i was unable to resolve the issue with codesigning?
    any ideas
    thank you!

    Reply
  7. Hey I’ve been trying to do these steps but when I type Su into mobile terminal it’s asks for the password , the password I put in is incorrect , which password are we supposed to be putting in ? Also tried alpine. Still saying wrong password

    Reply
  8. wont work on last part cp: missing destination file operand after /var/mobile/Media/Books/lib/var

    i put the folder lib on ibooks because i cant see the var/mobile 🙁

    Reply
  9. FOR ALL PEOPLE WHO HAVE “missing destination file operand after /var/mobile/Media/Books/lib/var”

    Just unzip the lib.zip to have a lib folder and then, copy this folder to var/mobile/Media/Books

    Just worked for me, awesome 😀

    Reply
  10. I have problem with signing ipa with cydia impactor. Problem with certificate. How can i solve that. And also i dont see place to put lib file in ifunbox
    I have ifile and other but couldnot open just blink and nothing. Plz help me

    Reply
  11. Thank you so much for this. It worked perfectly. The only thing that messed me up was that I screwed up the spacing in the terminal command line on my first attempt–very important!!–second attempt went without any problems whatsoever. This is an easy fix just takes a little figuring out.

    Reply
  12. i got the terminal but i cant type alpine in for some reason i typed “su” then return then password comes up and i cant type a single thing for some reason plz help!!

    Reply
    • Just type the password and enter , for me it was the same issue you can’t see nothing and it seems your not typing but you are good luck

      Reply
  13. in terminal i typed after i type “su” password comes up and i cant type anything ito the space someone help am i typing it wrong?

    Reply
  14. thank you for your great support 🙂 finally in cydia i can get source and repo. but i could not install any of them. there is problem with
    Directory ‘/var/log/apt/’ missing
    and
    sub-process /usr/libexec/cydia/cydo returned an error code (2)
    plz help
    i google it find solution to fixed but need apple file conduit “2” which is impossible with cydia. so i couldnt find var folder in ifunbox. it show my iphone is jailed.

    Reply
    • you need a directory to copy it into, make sure you’re using a space for /var.
      Ex: (cp -R /var/mobile/Media/books/lib) /var
      Whats in the parentheses has to be copied to the /var destination.

      And when seeing returned error codes (1) or (2) its just stating that the script trying to be processed ran into an error. Which can be fixed with Terminal.

      Reply
  15. Ok, I have a solution for all of you having problems;

    When you open cydia and you get the error about the missing lib file, LOOK and take NOTE of where cydia is looking for the lib file.

    Cydia was not looking in /var/mobile/Media/Books for me, it was only looking in /var/”lib”.
    So I just copied lib into var and it worked without using terminal.

    Hope this helps.

    Reply
  16. You sir, are a GOD, thank you for your intelligence i don’t know where i’d be without it in this situation. This is MUCH appreciated 🙂

    Reply
  17. It worked for me! Thanks!!! You saved my jailbreak because people now can´t restore to 9.3.3 so i followed your method and it worked!! Thank you so much!

    Reply
  18. Hi, Worked for my iPhone 6 iOS 9.3..
    I pasted lib folder direcytcly to Books with iFunbox.
    To finish i wrote the command exactly as i’ve been asked to write it (with a space each time there is a space)

    Many thanks TEEAYEAND

    Reply
  19. Your method works.. but now:

    ” ‘trying to overwrite /Library/MobileSubstrate/DynamicLibraries’ which is also in package com.teiron.pphelprns ”

    is the constant error i get whenever i try to install anything in Cydia now… please help

    Reply
  20. Is there anyplace else to get the lib.zip file needed to execute this fix? The link in the tutorial is broken.

    “Error (429)
    This account’s links are generating too much traffic and have been temporarily disabled!”

    🙁

    Reply
  21. Not really good at stuff like this can anyone recommend a video tutorial or step by step as I’m new to this much appreciated if possible

    Reply
  22. if you have ifile do this

    1- delete this file first DynamicLibraries

    /Library/MobileSubstrate/DynamicLibraries

    2- creat new folder and rename to apt on here var/log/apt

    restart your mobile and okkkkkkkkkkkkkkkkkkkk

    Reply
  23. is there supposed to be a space after “cp”? and a space after “/lib” i get these two error messages if i put the space after “cp” i get cp: invalid option — ‘ / ‘
    if i put no space there i get No such file or directory ive tried copying straight to the iBooks ive tried straight to Books ive even read every single comment to see if i can find a solution but nothing is working.

    Reply
  24. I can’t find var on ifunbox, if I drag and drop Lib to iBooks instead what do I have to type into MobileTerminal to fix the database error?

    Reply
  25. Deleted cydia application through the ifile (I spotted all had cydia the name and blacked out) and now I can not install through the jailbreak cydia again what to do? I have remade the jailbreak process in ios 9.3.3 I get the msg saying that the phone is jailbreakon but cydia not appear. Some applications are still functional as Filza Gamegen Flex but nothing cydia.

    Reply
  26. Most are getting stuck in the MobileTerminal portion. if you have everything right up to this point, the main issue is going to be typing the command correctly…. there is a “space” after “cp”, “-R”, and “lib”
    cp -R /var/mobile/Media/Books/lib /var

    if you have the correct space inserted, this should work.
    THANKS for the original post! helped me, and it WORKS!

    Reply
  27. Thank you sooo much<3 You saved my life !!! FOR EVERYONE GETTING STUCK AT THE LAST STEP:
    There is a space after the cp, the -R, and the lib portion.
    This helped me! Hope it helps!

    Reply
  28. is the var/media/books in the general storage system or is it in the raw file system. my iphone is jailbroken but it wont let me access raw system because it keeps saying its not jailbroken. ifun wont let me put mobile terminal in the cydia impactor either. any help would be awesome. thanks 🙂

    Reply
  29. well i got the books to work now the only issue im having is the info.plst folder. wont install mobile terminal on it. is it becaue my device isnt jailbroken? it is but it say its not

    Reply
  30. thank you! worked for me.. i kept messing up in the mobile terminal entering.. remember there is a space before you start to type in anything

    Reply
  31. cp -R /var/mobile/Media/Books/lib /var

    here is the actual working code, make sure you follow it right to a to including spaces and the – between cp and r , there is one space then a ” – ” .

    Reply
  32. My phone is jailbroken on 9.3.3 using the Pangu jailbreak. I was able to load the mobile terminal by pasting the zip file into the “Books” folder. I signed in using su and alpine and get the promt “iphone:/var/mobile root#”, but when I type in cp -R /var/mobile/Media/Books/lib /var I get an error
    “cp: cannot stat ‘/var/mobile/Media/Books/lib’ no such file or directory”
    I am using iFunbox and can’t get into the raw file system, only the user file system. Does anyone have a suggestion on a fix?

    Reply
        • I’ve been using that code and I still get the same error. I’ve re-entered it again several times and checked for errors but can’t get it to work. Would placing the zip file into the books folder be causing any issues? I wasn’t able to copy the whole folder to put into books, it kept opening the sub folders on me so I out in the zipped file. Any other ideas if that is ok?

          Thank you

          Reply
            • Thanks Paul, swear I tried that several times before but it worked this time.

              Now the code didn’t put up an error, but just went back to iphone: /var/mobile root#
              I closed terminal and tried cydia again but got the same errors. I went through the steps again and put in mkdir /var/log/apt as suggested but it said that the file already exists.

              I tried to then go to cydia/installed apps but couldn’t find it in iFunbox and can’t see any installed apps when I open cydia.

              Any suggestions? Thanks

              Reply
            • Since the cydia error is “could not open file /var/lib/dpkg/status” I just checked iFunbox for the lib/dpkg/status folder and it’s still not there after adding the lib folder in the fix.

              Reply
  33. Thanks for the help Paul and Nate, I got it to work! I went to the reddit tutorial and saw an answer to check to see if there was a second “lib” folder inside the first one. Mine had a main “lib” folder and then a second one inside that led to the 4 folders.

    OP:
    make sure the lib folder you drag in, doesn’t have another lib folder inside of it. It should just be lib, and when you double click in, should bring you straight to the other 4 folders.

    Reply
  34. Can i try this to recover the files in sauriks repo.. For me to use cydia eraser and erase all jb related files so that i can stay on 9.3.3 and rejailbreak?

    Reply
  35. Im sooo HAPPY! It worked!! My iPhone is currently running cydia eraser to have a clean ios 9.3.3!! It was a bit confusing at first because im not a tech guy too much but it did worked! Sauriks repo came back! Able to install cydia eraser! After this im gonna restore my files and apps and rejailbreak! Thank you so much man. You save my Phone from updating.. God bless.

    Reply
  36. IMPORTANT: Hey so everything worked, or so I thought. After I typed in the command, I pressed enter and and It didn’t display an error message at all, it just looked like i was ready to type another command. Before this, I typed in the right command and it said it wasn’t found, cause I origionally had the lib file zipped.. I unzipped it, and now it shows no error, but when I open cydia, I still get the stupid message error thing. Please help, I feel like i’m so close here

    Reply
  37. OMFG THANK YOU SO MUCH, everyone kept telling me to just restore and update, i was just about to, then I found this. THANKS SO MUCH

    Reply
  38. iFunbox also doesn’t recognize my phone as jailbroken tho yalu insists. FORK EXCEPTION… Bout to give up on this one for the day.

    Reply
    • Persistence prevails when all else fails…. SO i still couldn’t get mobile terminal to work…. BUT I got around this FORKEXCEPTION BS by using iFunbox to create a usb tunnel with my phone. Then by using Putty to ssh into my phone. From here follow the command lines above for mobile terminal. PSA for some reason Filezilla and WinSCP gave me errors but putty worked flawlessly.

      Reply
        • Hey can you do a step by step tutorial I’m kinda confused but I seriously need help. I’m getting the same error fork exception

          Reply
          • First you’ll need both iFunbox, and Putty, both free downloads with an easy Google Seach… I used the iFunbox v4.0 Preview.

            Open iFunbox and plug in your device into computer.. Under iPhone in iFunbox, open the Toolbox tab. Then Click on USB Tunnel… you should see your phone with iOS port 22 and PC Address as 127.0.0.1:22. This confirms the tunnel is active, if not add new USB Tunnel at Port 22.
            Now we have a USB Tunnel, Open Putty.exe and for host put “127.0.0.1” Keep port at 22 and make sure SSH is checked. When the terminal pops up Login as “root” password is “alpine”.
            Now you should see “iPhone:~ root#” at this point you have root level access of your phones file directory. You can proceed as if your MobileTerminal was working.

            type su

            type in your password. default is alpine

            type: cp -R /var/mobile/Media/Books/lib /var

            Now Cydia shouldn’t give your that horrendous error when you open and if you want a mobile terminal download MTerminal through Cydia after adding the repo source from my previous comment. MoblieTerminal still isn’t’ working for me ATM but MTerminal is comparable.

            Hope this helps those suck on FORKEXCEPTION.. Best Wishes

            Reply
            • HELP! I followed all the steps and i see “… root#”, after I typed in “su”, but it doesn’t ask for a password. Then i tried to type in “alpine”, but it just says “sh: alpine: command not found”. Please help!!!

              Reply
            • Help! I followed all the steps till I see the “root#”, but after typing in “su”, it doesn’t ask for the password or anything, then if I type in “alpine”, it just says “sh: alpine: command not found”. Please help!

              Reply
              • Not sure why, It won’t prompt you for a password, its trickily blank. Did you make sure Yalu confirmed your device is already jailbroken?

                Reply
              • Are you still using Mobile Terminal? I couldn’t get Mobile Terminal to work, You need MTerminal from Cydia(see above). If you followed the steps correctly even though mobile terminal gives you FORKEXCEPTION, Cydia won’t give you the “Could Not Open File /Var/lib/dpkg/status” error and you can update Cydia/Sources.

                Reply
  39. i found a fix, if you had ifile installed on your idevice then you are abble to copy the lib folder and past it into the var and it should work fine. i hope i helped people 🙂

    Reply
  40. Thank you mate, this actually worked for me. Those who are getting error ”no such file or directory” make sure to copy the lib folder present inside the main lib folder when you unzip the lib(.)zip file. When you unzip the lib(.)zip there is another lib folder inside the first one, so make sure you copy the inner lib folder via ifunbox.
    Second, the code has spaces, make sure to put them correctly
    cp(space)-R(space)/var/mobile/Media/Books/lib(space)/var
    I hope this will solve your problem.

    Reply
  41. i found a solution for the error …instaed of copying on /var/mobile/Media/Books …..just copy the lib folder on /var/lib …using ifile or ifunbox…..ifunbox is easy to use just drag and drop ……enjoy

    Reply
  42. OMG, i have problem with open (2: No such file or directory) and after fix with mobileterminale it appear ForkException Error
    Now Worked great, Many many thanks, i nearly restore to iOS 10.2.1,

    Reply
  43. done everything
    but when I open terminal it says forkexception but yalu
    so I tried connecting putty and open ssh
    but in putty I can type anything in command prompt
    can anyone help

    Reply
  44. Now, the Cydia Impactor will not change my deb. to an IPA. file and I have no way on doing this

    I am iOS 10 and this app will not delete off my phone at all. Its driving me crazy.

    Reply
  45. Hey guys, it didn’t work for me 🙁 I pasted the dib folder (not zip) in the books folder on ifunbox but still… the command on the terminal doesn’t work. Also I don’t have any var folder, what can I do ? Please help!
    This is the error cp: missing destination file operand after /var/mobile/Media/Books/lib/var… I tried to paste the dib folder anywhere but doesn’t work

    Reply
  46. CAN YOU PLEASE ANSWER MY MESSAGES, I’ve been messaging you guys non stop to make a video tutorial on the Cydia database error but still no replies. I’ve text on Facebook and tyform and still NO replies, so can you please make a video tutorial as I’m still on iso 9.3.3 On my IPhone 6 for about 4 months and I’ve been missing out on all the updates.

    Reply
  47. Thank you. Thank you. Thank you. Thank you. Thank you. Thank you. Thank you. Thank you. Thank you. Thank you. Thank you.

    Reply
  48. i got the cydia error dpkg_locked and don’t know how to fix it. Yes I still do need help none of the methods have helped me. I want my jailbreak back. I’m using an iPhone 5s on iOS 9.3.3 and it’s jail broken but got that error code.

    Reply
  49. Any solution for this problem? iOS 10.2 jailbreak , unfortunately I deleted lib folder then ifile and tweaks working and can’t install from cydia. Wants to reset my phone and stay on 10.2. I can’t install “Cydia Eraser” cause of this problem .

    Any suggestions? IFile and filza can’t work but only terminal works now . I can move delete any file by terminal. Tell me , what can I do now?

    Reply
    • Cydia eraser wouldn’t of worked for 10.2 anyway. Reset the device from Settings and hope is pulls through. From there you can use the yalufix IPA to fix the jailbreak file system.

      Reply
  50. Trying to fix dpkg blocked when im pressing open in PuTTY(already put in 127.0.0.1 and 22) the command open, but theres an error pop up it say “network error: Connection refused” and i cant type anything in the command

    Reply
  51. So it’s been a week since i’ve been having trouble with Jailbreak on iPhone 5s iOS 9.3.3. One of the problems ( which is the one that worries me the most ) is this, i can’t install or remove or anything… It loads like normal but then it gets stuck on “Loading” forever. If anyone can help me and or/ tell me what’s wrong with it please comment or Inbox me. Thanks

    Reply
  52. I’m late to this article, but I had coolbooter on my 4S, did an “erase all content and settings” so i could give it to someone and neglected to deleted the coolbooter install prior. not the phone has two partitions, cydia is on the home screen by default and does not pull any sources/packages. same error described at the beginning of the article. I followed your procedures here and got to terminal on the phone and I have the cannot fork inside sandbox error. no amount of rebooting and running my phoenix jailbreak is fixing this. Any ideas? Thanks.

    Reply
  53. error:Could not open file -open (2: No such file or directory)
    Iphone 6sPlus
    IOS:11.1.2

    Please help, i dont know what can i do.
    I try with “Cydia is Showing DPKG_LOCKED”but doesn´t help 🙁

    Reply
  54. if anyone who has the “ForkException Error” ,try ssh to your iphone via a PC or MAC in the same LAN ,just like below:

    type: ssh root@your-iphone-ip
    type: alpine
    type: cp -R /var/mobile/Media/Books/lib /var

    then cydia will work well.

    Reply

Leave a Comment

Cydia Geeks