Could Not Open File /var/lib/dpkg/status

In this article, will show you how to fix Cydia Error “Could Not Open File /var/lib/dpkg/status” after jailbreaking iOS 10.

The latest Yalu jailbreak for iOS 10.1 – iOS 10.1.1 is currently in beta and contains a number of issues that may create problems on your device. We highly recommend that users wait until a more stable version of this jailbreak is released to the public.

One of the major issues of this jailbreak is that Cydia doesn’t fully support it as of now. Users have been reporting various issues with Cydia ranging from crash problems to being unable to respring after installing a tweak.

Another issue that some users have been facing is that they get the following message after opening Cydia:

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.

This error prevents any package from getting loaded in Cydia, thereby preventing you from downloading and installing tweaks. If you’re facing this error, then you’ve come to the right place as we will show you how to fix this issue in a matter of a few minutes.

How to Fix “Could Not Open File /var/lib/dpkg/status” Cydia Error

Step 1: The first step is to download all the necessary files and tools for fixing this issue.

  • Download iFunBox for Windows or Mac – allows you to navigate and edit the iOS file system.
  • Next, download the necessary “Cydia Fix” files from here and unzip it.
  • Finally, you need the Cydia Impactor tool which can be downloaded from cydiaimpactor.com.

Step 2: Once you have all the necessary files and tools, you are ready to get started. Connect your jailbroken device to your computer via USB and then launch iFunBox.

Step 3: From the sidebar of iFunBox, open iBooks as shown below.

ifunbox ibooks

Step 4: From the “Cydia Fix” folder which you downloaded earlier, drag the entire “lib” folder to the iBooks directory in iFunBox and drop it there.

ifunbox ibooks

Step 5: Next, launch Cydia Impactor and make sure that it has detected your device as shown below.

cydia impactor

Step 6: Now drag the MobileTerminal.ipa file from the “Cydia Fix” folder and drop it onto Cydia Impactor.

cydia impactor

Step 7: Cydia Impactor will ask for your Apple ID and password. This information is only sent to Apple to generate the certificates required to sign and install the MobileTerminal IPA file onto your jailbroken device. Enter the required information and Cydia Impactor will start to install the IPA file.

Step 8: After the installation completes, you should see the Mobile Terminal app on your device’s Home screen. Go to Settings -> General -> Profiles & Device Management (for some users, it may be called “Profiles” or “Device Management”).

Step 9: Open the profile labelled with your Apple ID and then press the Trust button.

Step 10: Now go back to the Home screen and launch the Mobile Terminal app (make sure that your device is in jailbroken state).

Step 11: The command line interface will be displayed with a black background. Type in the following commands, pressing Enter/Return after each line:

su
alpine
cp -R /var/mobile/Media/Books/lib /var
mkdir /var/log/apt

Step 12: Once you’ve entered all the commands, reboot your device.

Put your device back into jailbreak state and then launch Cydia. The error “Could Not Open File /var/lib/dpkg/status” should no longer appear and you can successfully proceed with installing new tweaks on your device.

If you get the “Not allowed to fork from inside Sandbox” error when using Mobile Terminal, then try the solution below.

How to fix “Not allowed to fork from inside Sandbox” error

Method 1:

Step 1: Open Terminal on Mac (I’m not sure about Windows, but try using Command Prompt on that).

Step 2: Now you connect to your iPhone by entering the following command (make sure that your iPhone is connected to the same WiFi network as your computer):

ssh [email protected] iPhone IP address

You can find your iPhone’s IP Address from Settings -> Wifi, tap on ‘i’ button next to the WiFi you’re connected to and the IP address is shown there.

Note: if you get “connection refused” error, read this tutorial for connecting over SSH and then come back here to continue the steps.

Step 3: Enter command: yes

Step 4: Enter command: alpine

Step 5: Enter command: cp -R /var/mobile/Media/Books/lib /var

Step 6: Enter command: mkdir /var/log/apt

Step 7: Reboot your device.

If this method doesn’t work, there’s an alternative one below (thanks to Deybely Barreto).

Method 2:

Step 1: Download Putty and iFunBox.

Step 2: Connect your iPhone to your computer using a USB cable and then open iFunBox.

Step 3: Click on “Quick Toolbox” tab at the top. Under Advanced section, click on “USB Tunnel”.

Step 4: Copy the “PC Address” that is provided.

Step 5: Open Putty and in the “Host Name (or IP Address)” field, paste the PC address which you copied in the previous step.

Step 6: Click on the “Open” button.

Step 7: Type the following command: su

If “su” doesn’t work, then type “root”.

Step 8: Enter the password to get root access. The default password is: alpine (you won’t see the characters as you type)

Step 9: Enter the following command:

cp -R /var/mobile/Media/Books/lib /var (note the space and capital letters)

  • If you are getting the error ‘missing var/log/apt’, then do this:
    • Type the command ‘su‘ and then enter your password if required
    • Next, type this command: mkdir /var/log/apt
  • If you are getting the error ‘trying to overwrite /Library/MobileSubstrate/DynamicLibraries’, then do this:
    • Type the command ‘su‘ and then enter your password if required
    • Type: cd /Library/MobileSubstrate/DynamicLibraries (if folder doesn’t seem to exist then do step 8 first)
    • Type: ls -1 (fyi, you should see 2 files now: one of them should be ‘DynamicLibraries’)
    • Type: rm DynamicLibraries

Step 10: Open Cydia and install any tweak. It doesn’t matter which tweak you install. An example is iCleaner. This will create the directory: /var/stash

  • Alternatively, you can also use Terminal to do it:
    • Type: su
    • Enter the default password: alpine
    • Type: mkdir /var/stash

 

This solution should hopefully fix the error and allow you to launch Cydia without any issues. If you face any other problem, let us know in the comments below.

Tags: , , , , ,

  • Manmeet Ahuja
    • Ali

      Are you sure your device is in a jailbroken state? When it restarts, the jailbreak is disabled. So you have to run the mach_portal app (iOS 10) or Pangu (iOS 9) again to jailbreak it. The error could be because of this.

      • Bekircan Enes Sagnak

        I have the same problem I am sure mach_portal is running

        • Jonathan Huang

          I have the same problem! Jailbreak mode on but Terminal ERROR WITH NO FORKING

          • Ali Hassan

            @manmeetahuja:disqus @bekircanenessagnak:disqus @disqus_jtPXvnaV3g:disqus

            Can you try this:

            1. Open Terminal on Mac (I’m not sure about Windows, but try using Command Prompt on that)
            2. Now you connect to your iPhone by entering:

            ssh [email protected] iPhone IP address

            You can find your iPhone’s IP Address from Settings -> Wifi -> Tap on ‘i’ button next to the WiFi you’re connected to and the IP address is shown there.

            3. command: yes
            4. command: alpine
            5. command: cp -R /var/mobile/Media/Books/lib /var
            6. command: mkdir /var/log/apt

          • Shady M. Shahin

            please how to root into iphone through pc

          • edwin esperanza

            With iFunBox for PC

          • edwin esperanza

            conection refused.. error message

          • trickskicks

            Receiving same error message in Terminal:

            port 22: Connection refused

          • edwin esperanza

            If you have iFile I can tell you how to fix it… But u must have iFile…Let me know…

          • trickskicks

            I will check when I get home from office. Thank you for the help!

          • Deybely Barreto

            1.-Download Putty and iFun-box
            2.- Go into iFun-box and go to tools then in USB tunnel
            3.- Copy the address of pc
            4.- Enter Putty put the address
            Type: su
            Type in your password, in order to get root access, default is: alpine (fyi, you won’t see the characters you are typing)
            Type: cp -R /var/mobile/Media/Books/lib /var (fyi, be sure to note the space, mind Capitals!)
            [7b.] ONLY if you are getting: ‘missing var/log/apt’ error:

            Type: su and password (if you closed Terminal before)
            Type: mkdir /var/log/apt
            [7c.] ONLY if you are getting: ‘trying to overwrite /Library/MobileSubstrate/DynamicLibraries’ error:

            Type: su and password (if you closed Terminal before)
            Type: cd /Library/MobileSubstrate/DynamicLibraries (fyi, if folder doesn’t seem to exist: do step 8 first!)
            Type: ls -1 (fyi, you should see 2 files now: one of them should be ‘DynamicLibraries’)
            Type: rm DynamicLibraries
            [ 8. ] Open Cydia now. Install a simple tweak (it doesn’t matter which one, but iCleaner is a good choice), in order to create the directory: /var/stash

            Alternatively, you can also use Terminal to do it:
            Type: su and password (if you closed Terminal before)
            Type: mkdir /var/stash

          • Grazy

            Thank you your a legend dude.

          • Ali

            Thank you! I’ve added this to the article.

          • Mo

            Hello my friend
            Can u explain pls
            1.-Download Putty and iFun-box
            2.- Go into iFun-box and go to tools then in USB tunnel
            3.- Copy the address of pc
            4.- Enter Putty put the address
            /// ok go into ifunbox into USB tunnel?? I must write something there, but what
            It’s show me this
            New usb tunnel at port:
            detect and create
            What i must put there? My device ip address??
            Then copy the address of pc??

            If u can take few minutes to explain me that pls sir

            Thx

          • Ali

            Read method 2 in the article. It’s the same thing.

          • Mo

            Doesn’t work
            When i start putty it’s say
            Connection refused

          • Ali

            Read this: https://www.reddit.com/r/jailbreak/comments/5r2mwr/tutorial_how_to_use_dropbear_ssh_via_usb_on/

            Although it’s very lengthy process, it will work definitely. Once you can connect, come back here to continue the steps.

          • Mo

            I didn’t try it yet but i must say thank you very much just because u give answer!!

            I will try it when i go back home but sir i use ios 10.1.1 and as i know it’s possible to ssh only with yslu 102 or i am wrong?

          • Ali

            No problem, I’m here to help 🙂

            As for SSH, it works with iOS 10.1 – iOS 10.1.1 as well. You just have to avoid installing OpenSSH from Cydia.

          • Deybely Barreto

            Mo, You have to have the cell phone connected to your pc to get the ip address of usb tunel in iFun-box

          • Mo

            its connected but when i put my ip addres its say specified port is not Detected on Ideivice
            my ip addres Setting-wiffi-connected wiffi then the I button there is my addres right?

          • Ali

            @disqus_ylDhgNQwlO:disqus Read method 2 again. I have updated it to show how to find the IP address on iFunBox and connect.

          • Mo

            thank u very much Ali, but i tried so many time to give my ip address like u said up there, but it says the same: Specified port is not detected on IDevice.

          • Deybely Barreto
          • Deybely Barreto

            They are not in order but it is what you have to do

          • Deybely Barreto

            Hello Alí, Edit the article and change “su” by “root” which is the one that works on putty

          • Deybely Barreto

            Hello, you have to put the usb tunnel ip that gives you in iFun-box. When logged in as root and the password is alpine and then put all the commands that are marked in the steps

          • Ali

            Where exactly is this? I can’t find it.

          • Deybely Barreto

            Pass me your email to send you photos of these steps

          • Ali

            Ah found it. I was using iFunBox on Mac. So I tried and it says “Acesss Denied”

          • Deybely Barreto
          • Mo

            what ip?
            u mean my iphone ip?
            Setting- Wifi- then on conected wifi the I button there is a ip Addres ?
            u mean this ?

          • Ali

            Check method 2 again, I have updated it as Deybely said.

          • Mo

            Ali my Freind, about what IP Address we are speaking

          • Ali

            In iFunBox, when you go to “Quick ToolBox” tab, click on USB Tunnel. Over there, you’ll find “PC Address”. Copy that and put in PuTTY. I have clearly mentioned it in the updated steps.

          • Mo
          • Deybely Barreto
          • Mo
          • Deybely Barreto

            Press ok, and wait for him to detect the cell phone. Do you have the cell phone connected to your pc?

          • Mo

            of curse is connected
            its show nothing till now

          • Deybely Barreto

            Close iFun-box and open it again and try again and give it to detect and then wait for the ip

          • Mo

            i dont know maybe i use yalu 10.1.1 and not yalu 102???

          • Deybely Barreto

            Which do you have iOS? 10.1.1?

          • Mo

            ios 10.1.1 Iphone 7

          • Deybely Barreto

            Write me by whatsapp to help you +584126598501

          • Mo

            did u got my whats.. massage

          • Mo

            You tried this with IMAC or Windows??

      • Tipsy Lawal

        please Ali , am having this same problem on iphone 5s ios 10.2 . i have been trying all i have seen on the internet but no luck yet. please help

  • Rogério Scuira

    me ajudou muito! Lembrando que para ter acesso ao root do iphone é preciso abrir o mach_portal antes de fazer os comandos no terminal. Funcionou 100% comigo!!!

  • Mo

    10.1.1 after ears from iCloud nothing want to work
    Only can open cydia then nothing
    Mterminal not working
    I fun box also if i ckick on ssh terminal ifunbox tell me ” please jailbreak your device” but cydia is on my device and that with putty also don’t work

    There is one user here he said that we can try with USB tunnel (ifunbox) but i just don’t understand anything

    My question now, it’s did someone fix that if yes, how?
    Don’t want Los my jailbreak

  • Vibhor Sharma (Vib0516)

    I was getting same error! Did with method 2 for terminal! It worked fine:)

  • Mo

    Hello everyone
    I m back but now everything is fixed
    if anyone have this problem on iPhone 7 ios 10.1.1 i know someone who have the fix without ssh without terminal i swear to u!
    U can search for him at twitter his name @Cydia20 he will helps u like your friends
    Ali thank u very much
    Another friend here from Venezuela he also tried to help thx very much

    • Ali

      No problem 🙂 Glad you were able to fix it. It would be great if you could share it here for others. I would add it to the article as well.

      • Mo

        hello Ali
        It’s an Ipa portal
        I deleted the original one from luca then installed the remake one from @Cydia20 then with magic cydia started without any error and of course u can delete it then use the original one
        If someone want to have it just say
        I asked him already if i can give it

        • Ali

          Oh okay. I highly recommend that you use the original one. If you take it from somewhere else, it may contain malware and isn’t safe.

          • Mo

            It’s not from someone or somewhere i know this developer from long time from Twitter he told me that he will help after he finish some stuff he head but i just couldn’t wait
            And he sends me today that ipa he is not trying to destroy any idevice from nobody belive me
            I can send u that ipa and u can check it with many malwere finder or with any anti-virus program

          • Enzo Llongueras

            Hi, please can you give me it ?

          • Mo

            Do you have iPhone 7 , ios 10.1.1?
            Because its only for it??

          • Sami

            Hello Mo, thank you for sharing the ipa. I think this worked for me but when cydia resprings, the phone goes to black screen and nothing happens. @Enzo: do you recommend putting back the original one after using Mo’s ipa or try to apply your yalu fix?

          • Mo

            http://www.mediafire.com/?mbg8j57sj14ss7b
            It’s only for iPhone 7 ios 10.1.1
            Don’t use it on other idevice

  • Romanista

    I fixed it using iFunBox and PuTTY, using method 2, which step are you getting stuck on?

  • Hasan

    hello, i have the same problem with iphone 6s ios 10.0.1 i do all the steps but terminal can’t open (fork exception) is there any solution with this ios version or not ? thanks.

    • Mo

      U still have this problem?

      • Hasan

        I tried the steps many times but i still have this problem. Unfortunately, I think I am unlucky.

    • Mo

      Delete the original yalu ipa
      Reboot
      Install this one :
      http://www.mediafire.com/file/c0hxg7xgdgkp4n7/yalufix.ipa
      Later u can install the original one
      Tel me if this one not working

      • Hasan

        Thanks Mo i will try it

      • Dustin Butterworth

        this worked for me thx

      • محمد نجيب محمد تووي

        thanks Mo!!!! it worked!!!!!!!!!

  • Dustin Butterworth

    i have iphone 6 10.2 yalu jailbreak. after restore i noticed that cydia was still on the springboard. i reinstalled the yalu jailbreak with the impactor and noticed all these errors hile trying to use cydia. after other fixes i still had the MobileSubstrate error and i noticed the user Mo below me had a diff version of yalu so i used it instead and i think that its what fixed cydia. i alsop had a few other apps downloaded through cydia that were still on my springboard after restore and one of them was the substrate fix app that i downloaded through cydia b4 and i pressed it after i used the yalu from Mo so im not sure which fixed or combo of both idk. hope this helps

    • محمد نجيب محمد تووي

      Dustin & MO ! you guys awesome!!!!

  • Dustin Butterworth

    also this helped with the dpkg error
    https://www.reddit.com/r/jailbreak/comments/506ysd/tutorial_how_to_fix_erase_all_content_settings/
    step 7 fixed this.
    if you cant use mobileterminal use putty from pc to ssh to iphone
    if su login doesnt work use root login
    the 7c step didnt work for me it kept saying that it doesnt exist so i tryed to make the pathway and it said it already existed. lol i was frustrated.
    this is when i tryed what i posted below

  • Ernie Isima

    Thanks a lot.. Method 2 worked for me.

    • Ali

      Great 🙂

  • HerosHyper

    I am getting a error on Terminal : login: PAM Error (line 400) : Module is unknown [Process completed] Press any key to restart. I am pressing a key but nothing happens HALLPPP!!!11!