0

root@tet0-Lenovo-G500s:~# sudo apt-get install git
Reading package lists... Done
Building dependency tree       
Reading state information... Done
The following additional packages will be installed:
 debianutils git-man krb5-locales less libbsd0 libcurl3-gnutls libedit2 liberror-perl
 libgssapi-krb5-2 libk5crypto3 libkeyutils1 libkrb5-3 libkrb5support0 libnghttp2-14 libpsl5
 librtmp1 libssl1.0.0 libx11-6 libx11-data libxau6 libxcb1 libxdmcp6 libxext6 libxmuu1
 multiarch-support openssh-client publicsuffix xauth
Suggested packages:
 gettext-base git-daemon-run | git-daemon-sysvinit git-doc git-el git-email git-gui gitk gitweb
 git-cvs git-mediawiki git-svn krb5-doc krb5-user keychain libpam-ssh monkeysphere ssh-askpass
The following NEW packages will be installed:
 debianutils git git-man krb5-locales less libbsd0 libcurl3-gnutls libedit2 liberror-perl
 libgssapi-krb5-2 libk5crypto3 libkeyutils1 libkrb5-3 libkrb5support0 libnghttp2-14 libpsl5
 librtmp1 libssl1.0.0 libx11-6 libx11-data libxau6 libxcb1 libxdmcp6 libxext6 libxmuu1
 multiarch-support openssh-client publicsuffix xauth
0 upgraded, 29 newly installed, 0 to remove and 0 not upgraded.
21 not fully installed or removed.
Need to get 0 B/8,915 kB of archives.
After this operation, 55.1 MB of additional disk space will be used.
Do you want to continue? [Y/n] Y
Preconfiguring packages ...
/usr/bin/dpkg: 1: /usr/bin/dpkg: Syntax error: word unexpected (expecting ")")
E: Sub-process /usr/bin/dpkg returned an error code (2)

10
  • dpkg -l | egrep -v '^ii|rc' please, add the output to your question.
    – nobody
    Mar 27, 2020 at 8:28
  • now it's showing, bash: /usr/bin/dpkg: cannot execute binary file: Exec format error @nobody
    – Satyajit
    Mar 27, 2020 at 8:35
  • 1
    Did you replace /usr/bin/dpkg with a shell script or something? What is the output of file /usr/bin/dpkg? What commands did you run involving dpkg before this?
    – muru
    Mar 27, 2020 at 8:42
  • Oh, uname -a please I need ypur arch.
    – nobody
    Mar 27, 2020 at 8:43
  • That error can happen if /usr/bin/dpkg is the wrong binary architecture for your system (such as ARM on x86, or possibly x86_64 on i386) Mar 27, 2020 at 8:45

1 Answer 1

1

Okay 32-bit.

mkdir $HOME/dpkg 

enter this directory

cd $HOME/dpkg

then download dpkg with wget.

wget -c http://mirrors.kernel.org/ubuntu/pool/main/d/dpkg/dpkg_1.19.0.5ubuntu2_i386.deb

uncompress the deb package.

ar x dpkg_1.19.0.5ubuntu2_i386.deb 

then we extract the datas.

tar xf data.tar.xz 

then substitute the wrong dpkg.

sudo cp ./usr/bin/dpkg /usr/bin/dpkg

then try

sudo apt-get clean && sudo dpkg --configure -a

when dpkg is working again.

dpkg --print-foreign-architectures 

If you get an output,

remove foreign-architectures

but you have to adapt it to your situation. you have to change the part i386 to the one you get from output. I hope the last part is understandable.

If you are unsure show the output from last command.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .