Results 1 to 4 of 4

Thread: Mistakenly delete /var/lib/dpkg contents ?

  1. #1
    Join Date
    2015-Oct
    Posts
    11

    Unhappy Mistakenly delete /var/lib/dpkg contents ?

    I have mistakenly delete all contents from /var/lib/dpkg folder, now when i use ap-get update i got following issue,
    apt-get update
    Err:1 http://http.kali.org/kali kali-rolling InRelease
    Could not resolve 'http.kali.org'
    Traceback (most recent call last):
    File "/usr/bin/debtags", line 694, in <module>
    main()
    File "/usr/bin/debtags", line 688, in main
    sys.exit(action.main(args))
    File "/usr/bin/debtags", line 632, in main
    for pkg, tags in self.tags_from_apt():
    File "/usr/bin/debtags", line 256, in tags_from_apt
    cache = self.apt_cache
    File "/usr/bin/debtags", line 241, in apt_cache
    res = self._apt_cache = apt.Cache()
    File "/usr/lib/python3/dist-packages/apt/cache.py", line 113, in __init__
    self.open(progress)
    File "/usr/lib/python3/dist-packages/apt/cache.py", line 164, in open
    self._cache = apt_pkg.Cache(progress)
    apt_pkg.Error: E:flAbsPath on /var/lib/dpkg/status failed - realpath (2: No such file or directory), E:Could not open file - open (2: No such file or directory), E:Problem opening , E:The package lists or status file could not be parsed or opened.
    Reading package lists... Error!
    W: Failed to fetch http://http.kali.org/kali/dists/kali-rolling/InRelease Could not resolve 'http.kali.org'
    W: Some index files failed to download. They have been ignored, or old ones used instead.
    E: flAbsPath on /var/lib/dpkg/status failed - realpath (2: No such file or directory)
    W: Target Packages (main/binary-i386/Packages) is configured multiple times in /etc/apt/sources.list:1 and /etc/apt/sources.list.d/sources.list:1
    W: Target Packages (main/binary-all/Packages) is configured multiple times in /etc/apt/sources.list:1 and /etc/apt/sources.list.d/sources.list:1
    W: Target Translations (main/i18n/Translation-en_IN) is configured multiple times in /etc/apt/sources.list:1 and /etc/apt/sources.list.d/sources.list:1
    W: Target Translations (main/i18n/Translation-en) is configured multiple times in /etc/apt/sources.list:1 and /etc/apt/sources.list.d/sources.list:1
    W: Target DEP-11 (main/dep11/Components-i386.yml) is configured multiple times in /etc/apt/sources.list:1 and /etc/apt/sources.list.d/sources.list:1
    W: Target DEP-11 (main/dep11/Components-all.yml) is configured multiple times in /etc/apt/sources.list:1 and /etc/apt/sources.list.d/sources.list:1
    W: Target DEP-11-icons (main/dep11/icons-64x64.tar) is configured multiple times in /etc/apt/sources.list:1 and /etc/apt/sources.list.d/sources.list:1
    W: Target Packages (non-free/binary-i386/Packages) is configured multiple times in /etc/apt/sources.list:1 and /etc/apt/sources.list.d/sources.list:1
    W: Target Packages (non-free/binary-all/Packages) is configured multiple times in /etc/apt/sources.list:1 and /etc/apt/sources.list.d/sources.list:1
    W: Target Translations (non-free/i18n/Translation-en_IN) is configured multiple times in /etc/apt/sources.list:1 and /etc/apt/sources.list.d/sources.list:1
    W: Target Translations (non-free/i18n/Translation-en) is configured multiple times in /etc/apt/sources.list:1 and /etc/apt/sources.list.d/sources.list:1
    W: Target DEP-11 (non-free/dep11/Components-i386.yml) is configured multiple times in /etc/apt/sources.list:1 and /etc/apt/sources.list.d/sources.list:1
    W: Target DEP-11 (non-free/dep11/Components-all.yml) is configured multiple times in /etc/apt/sources.list:1 and /etc/apt/sources.list.d/sources.list:1
    W: Target DEP-11-icons (non-free/dep11/icons-64x64.tar) is configured multiple times in /etc/apt/sources.list:1 and /etc/apt/sources.list.d/sources.list:1
    W: Target Packages (contrib/binary-i386/Packages) is configured multiple times in /etc/apt/sources.list:1 and /etc/apt/sources.list.d/sources.list:1
    W: Target Packages (contrib/binary-all/Packages) is configured multiple times in /etc/apt/sources.list:1 and /etc/apt/sources.list.d/sources.list:1
    W: Target Translations (contrib/i18n/Translation-en_IN) is configured multiple times in /etc/apt/sources.list:1 and /etc/apt/sources.list.d/sources.list:1
    W: Target Translations (contrib/i18n/Translation-en) is configured multiple times in /etc/apt/sources.list:1 and /etc/apt/sources.list.d/sources.list:1
    W: Target DEP-11 (contrib/dep11/Components-i386.yml) is configured multiple times in /etc/apt/sources.list:1 and /etc/apt/sources.list.d/sources.list:1
    W: Target DEP-11 (contrib/dep11/Components-all.yml) is configured multiple times in /etc/apt/sources.list:1 and /etc/apt/sources.list.d/sources.list:1
    W: Target DEP-11-icons (contrib/dep11/icons-64x64.tar) is configured multiple times in /etc/apt/sources.list:1 and /etc/apt/sources.list.d/sources.list:1
    E: Could not open file - open (2: No such file or directory)
    E: Problem opening
    E: The package lists or status file could not be parsed or opened.

    and when i re-configure dpkg like dpkg --configure -a
    i got the following error


    dpkg: error: failed to open package info file '/var/lib/dpkg/status' for reading: No such file or directory

    After each command i gotlock file in dpkg folder . *** !! is that
    Is there any anyone who can get me out of this problem, all suggestion all appreciated

  2. #2
    Join Date
    2014-Mar
    Posts
    163

  3. #3
    Join Date
    2015-Oct
    Posts
    11
    nothing happen?

  4. #4
    Join Date
    2014-Mar
    Posts
    163
    It is complicated to know what to do in your situation by the fact that is not normal someone delete an important directory in linux that contains all information about all packages installed in the system .
    A person to respond to you in what you should do in that case , 1st it must have been in your situation before and somehow solved the issue .

    Your Linux issue is not a normal issue that happens many times .

    there are multiple ways to solve it or try to solve it :

    1st : try to recover the files using test disk (I have no idea if it will work after the command rm was made)
    http://www.cgsecurity.org/wiki/TestDisk

    2nd : Search google for that error message from dpkg and watch the responses on the links to see if it worked , then test it .

    3rd : create a new partition on your hard disk ext4 and put all your important data there , and then reinstall the OS again by removing the swap partition and the ext4 partition where user and system files are .

    4th : if on installation of linux you setup 2 different partitions ; 1 for user data and other for the system then you only need to wipe out the system partition and install OS again .

    Note : one of the biggest features of any linux distribution is the ability for user to separate System and User partitions on linux installation , but many people choose 1 single partition to store everything , system and user data .
    When this last option is selected on installation , what happens is when you have a big problem on OS that will make you format everything , you will loose all your personal data unless you transfer it to other partition before formatting . But if on install the OS , the user create an independent partition for user data , then there will be no problem , all needed is to wipe out system partition and install OS again .

Similar Threads

  1. Replies: 2
    Last Post: 2019-02-18, 22:18
  2. help a nooooob. compare contents of file to correct dictionary list
    By Thehellfiresarehottt in forum TroubleShooting Archive
    Replies: 3
    Last Post: 2016-10-08, 13:03
  3. Replies: 0
    Last Post: 2015-12-05, 18:03
  4. hd contents 140 TB ...?
    By hcorsted in forum TroubleShooting Archive
    Replies: 2
    Last Post: 2014-03-17, 14:35

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •