Ubuntu: E: Sub-process /usr/bin/dpkg returned an error code (2)



Question:

When trying to run sudo apt-get upgrade my computer returns an error that I am not sure how to fix. I tried to uninstall Wine a short while back, but clearly things did not go as intended. I had previously installed PlayOnLinux, but I never got anything to work on it. Can anyone make heads or tails of this problem?

$ sudo apt-get upgrade  Reading package lists... Done  Building dependency tree         Reading state information... Done  The following packages have been kept back:    intel-linux-graphics-installer libopenscenegraph80  The following packages will be upgraded:    activity-log-manager-common activity-log-manager-control-center apport apport-gtk  bamfdaemon command-not-found command-not-found-data    gir1.2-dbusmenu-glib-0.4 gir1.2-dbusmenu-gtk-0.4 gnome-control-center-unity gnome-screenshot google-chrome-stable libbamf3-1    libdbusmenu-glib4 libdbusmenu-gtk3-4 libdbusmenu-gtk4 libdvdnav4 libplymouth2 libunity-2d-private0 libunity-core-6.0-5 libwhoopsie0    lsb-base lsb-release passwd plymouth plymouth-label plymouth-theme-ubuntu-logo plymouth-theme-ubuntu-text python-apport    python-problem-report python3-apport python3-commandnotfound python3-problem-report unity unity-2d unity-2d-common unity-2d-panel    unity-2d-shell unity-2d-spread unity-common unity-lens-applications unity-services whoopsie  43 upgraded, 0 newly installed, 0 to remove and 2 not upgraded.  Need to get 0 B/47.4 MB of archives.  After this operation, 3,360 kB of additional disk space will be used.  Do you want to continue [Y/n]? y  Extracting templates from packages: 100%  dpkg: parse error, in file '/var/lib/dpkg/status' near line 4794 package 'wine1.6-i386':   `Depends' field, invalid package name `wine1.6:any': character `:' not allowed (only letters, digits and characters `-+._')  E: Sub-process /usr/bin/dpkg returned an error code (2)  


Solution:1

It looks like that wine package had an invalid format, but dpkg didn't catch it at installation time and wrote some information to the package database that it isn't able to read back now.

Edit the file /var/lib/dpkg/status in a text editor:

sudoedit /var/lib/dpkg/status  

Go to line 4794 and change Package: wine1.6:any to Package: wine1.6

Check the directory /var/lib/dpkg/info for files whose name begins with wine1.6:any. If there are any, rename them to remove the :any part. Then dpkg should be happy and you should be able to remove the wine1.6 package.

If there are other packages with that spurious :any, do the same for them. If :any occurs in dependency lines (Depends: … wine1.6:any … or Recommends: … or Suggests: … or Conflicts: …), remove it there too.


Note:If u also have question or solution just comment us below or mail us on toontricks1994@gmail.com
Previous
Next Post »