1

After upgrading my system last week the S hits the Fan. Looked al over the forun but did'nt got the answer to solve my problem. Within DPKG the "status" file was corrupt, back-ups where empty so tried to recover with:

(for d in /usr/share/doc/* ; do printf 'Package: %s\nStatus: install ok installed\n' $(basename $d) ; done ) > ~/status
cp ~/status /var/lib/dpkg/

My installation:

Virtual server, OS template ubuntu-12.04-x86_64 + Plesk Client server with mail and sites

As told after recovery te status file i run:

root@justme:~# sudo apt-get dist-upgrade
Reading package lists... Done
Building dependency tree
Reading state information... Done
Calculating upgrade... Done
The following NEW packages will be installed:
  adduser apt-utils base-files base-passwd bash bash-completion bsdmainutils bsdutils busybox-initramfs coreutils cpio cryptsetup cryptsetup-bin dash dbus debconf-i18n debianutils diffutils
  dmsetup dpkg e2fslibs e2fsprogs ecryptfs-utils file findutils gcc-4.6-base gettext-base grep gzip hostname ifupdown initramfs-tools initramfs-tools-bin initscripts insserv iproute keyutils
  klibc-utils libacl1 libapt-inst1.4 libapt-pkg4.12 libatm1 libattr1 libblkid1 libbz2-1.0 libc-bin libc6 libcomerr2 libcryptsetup4 libdb5.1 libdbus-1-3 libdevmapper1.02.1 libdrm-intel1
  libdrm-nouveau1a libdrm-radeon1 libdrm2 libecryptfs0 libexpat1 libffi6 libgcc1 libgcrypt11 libglib2.0-0 libglib2.0-data libgpg-error0 libgpm2 libkeyutils1 libklibc liblocale-gettext-perl
  liblzma5 libmagic1 libmount1 libncurses5 libncursesw5 libnih-dbus1 libnih1 libnspr4 libnss3 libnss3-1d libpam-modules libpam-modules-bin libpam-runtime libpam0g libpciaccess0 libpcre3
  libplymouth2 libpng12-0 libpopt0 libreadline6 libselinux1 libslang2 libsqlite3-0 libss2 libssl1.0.0 libstdc++6 libtext-charwidth-perl libtext-iconv-perl libtext-wrapi18n-perl libtinfo5 libudev0
  libuuid1 libxml2 login lsb-base lsof makedev mime-support module-init-tools mount mountall multiarch-support ncurses-base ncurses-bin netbase original-awk passwd perl-base plymouth
  plymouth-theme-ubuntu-text procps psmisc python python-minimal python2.7 python2.7-minimal readline-common rsync sed sensible-utils sgml-base shared-mime-info sysv-rc sysvinit-utils tar tzdata
  udev upstart util-linux uuid-runtime xml-core xz-utils zlib1g
The following packages will be upgraded:
  debconf
1 upgraded, 141 newly installed, 0 to remove and 0 not upgraded.
Need to get 0 B/38.3 MB of archives.
After this operation, 118 MB of additional disk space will be used.
Do you want to continue [Y/n]? y
Extracting templates from packages: 100%
Preconfiguring packages ...
dpkg-query: error: parsing file '/var/lib/dpkg/status' near line 15 package 'acl:i386':
 blank line in value of field 'Original-Maintainer'
' not allowed (only letters, digits and characters `-+._')install-info
E: Sub-process /usr/bin/dpkg returned an error code (2)
W: Encountered status field in a non-version description

Can someone help..?? Looked almost everywhere.

3

3 Answers 3

0

It is a bug for sure.

Try the following, in order, until your problem is fixed.

sudo dpkg --configure -a
sudo apt-get dist-upgrade

If that fails try

sudo rm /var/lib/dpkg/available
sudo dselect update
sudo apt-get dist-upgrade

Or if all else fails

sudo rm /var/lib/dpkg/{status,available}
sudo apt-get update
sudo apt-get dist-upgrade

If that fails, you will need to edit the file and remove the offending line or file a bug report.

9
  • Thanks a lot for the suggestions. i'll try and comeback with results:
    – rhs1972
    Sep 22, 2014 at 17:06
  • output of: sudo dpkg --configure -a -> ' not allowed (only letters, digits and characters `-+._')install-info
    – rhs1972
    Sep 22, 2014 at 17:08
  • keep going to the next set(s)
    – Panther
    Sep 22, 2014 at 17:25
  • Next: sudo apt-get dist-upgrade Reading package lists... Done Building dependency tree Reading state information... Done You might want to run 'apt-get -f install' to correct these. The following packages have unmet dependencies: (lot of packages)
    – rhs1972
    Sep 23, 2014 at 6:39
  • 1
    Lets start off with the ever so slightly, error, error error from removing main dpkg files like status, one its removed i hope you know what you're doing, cause sudo apt-get update no longer works, so if you did delete it then you'll need to run: sudo cp /var/lib/dpkg/status-old /var/lib/dpkg/status then sudo apt-get update will work again
    – user610658
    Aug 29, 2018 at 4:03
0

I run into kind of the same problem E: Sub-process /usr/bin/dpkg returned an error code (2) W: Encountered status field in a non-version description

I replaced the dpkg status file with the status_old file. It fixed my problem. /var/lib/dpkg/status

0

My /var/lib/dpkg/status file got deleted and according to apt I had no packages installed, as it determines them from the status file. I used the following method to regenerate the /var/lib/dpkg/status file. The method worked very fine for me in Kali GNU/Linux, which is Debian-based.

NOTE:

  • This method assumes that all installed packages have created entries in the /usr/share/doc directory.

  • This method starts from an empty /var/lib/dpkg/status file.

  • This method may not work if you have more than 1 repository providing the same package. If you do have more than 1 repository providing the same package, temporarily disable the subsidiary repo, then delete the package cache lists for the repo in /var/lib/apt/lists/.

  1. Delete the current status and status-old files. Make a backup of the files before deletion incase you get errors.

    mkdir ~/dpkg-status-backup
    cp /var/lib/dpkg/{status,status-old} ~/dpkg-status-backup
    rm /var/lib/dpkg/{status,status-old}
    
  2. Get list of all packages installed, one package per line.  Note: it's 1 (one) not l (lower-case L).

    ls -1 /usr/share/doc > installed-packages.list
    
  3. Rewrite the packages list into one line.

    tr '\n' ' ' < installed-packages.list > installed-packages-one-line.list
    
  4. Create an empty status file to enable apt-cache to run.

    touch /var/lib/dpkg/status
    
  5. Generate package records using apt-cache.

    cat installed-packages-one-line.list | xargs apt-cache show > raw-status-file
    
  6. The raw-status-file may contain Status: fields for some packages. Delete them to avoid duplication.

    sed -i '/^Status:/d' raw-status-file
    
  7. Add the Status: field for every package to indicate to apt & dpkg that they're installed.

    sed -i 's/^Package:.*/&\nStatus: install ok installed/' raw-status-file
    
  8. Remove fields unwanted by dpkg in status file: SHA1:, SHA256:, MD5sum:, Description-md5:, Size: & Filename: .

    sed -i '/^MD5sum:/d' raw-status-file
    sed -i '/^SHA1:/d' raw-status-file
    sed -i '/^SHA256:/d' raw-status-file
    sed -i '/^Size:/d' raw-status-file
    sed -i '/^Filename:/d' raw-status-file
    sed -i '/^Description-md5:/d' raw-status-file
    
  9. The resultant raw-status-file after running the above commands is now the actual dpkg status file.

    mv raw-status-file status
    
  10. Copy the status file to /var/lib/dpkg/ as status and status-old.

    cp status /var/lib/dpkg/status
    cp status /var/lib/dpkg/status-old
    
  11. Now run dpkg to validate your new status file. If you get errors, take hints from dpkg's error report, & solve accordingly. If you get no errors, then the status file has the correct syntax.

    dpkg --get-selections
    
  12. Re-enable the disabled repos then run apt to update package cache lists to prevent the error packages have unmet dependencies.

    apt update
    
  13. If you run into packages have unmet dependencies error in apt, then make sure you've enabled the subsidiary repos that provide the dependencies, then run aptitude. I prefer aptitude because it's better at solving package installation errors.

    aptitude full-upgrade
    

If you get no errors/your errors have been resolved from apt or dpkg, and get "PACKAGE is already the newest version..." when you try to install a program you're sure is already installed, such as coreutils, then you've successfully regenerated the dpkg status file.

Clean-up the temp files created and the backup.

rm installed-packages.list installed-packages-one-line.list status
rm -r ~/dpkg-status-backup
1
  • While this link may answer the question, it is better to include the essential parts of the answer here and provide the link for reference. Link-only answers can become invalid if the linked page changes. - From Review
    – Pilot6
    Jul 16 at 14:26

Not the answer you're looking for? Browse other questions tagged or ask your own question.