0

I am trying to install apache:
sudo apt-get install apache2
And i am getting this error:

 Setting up google-cloud-sdk (132.0.0-0) ... dpkg: error processing
 package google-cloud-sdk (--configure):  subprocess installed
 post-installation script returned error exit status 1 Errors were
 encountered while processing:  google-cloud-sdk E: Sub-process
 /usr/bin/dpkg returned an error code (1)

Similarly i get th following output when i run sudo dpkg --configure -a:

Setting up google-cloud-sdk (132.0.0-0) ...
dpkg: error processing package google-cloud-sdk (--configure):
 subprocess installed post-installation script returned error exit status 1
Errors were encountered while processing:
 google-cloud-sdk

How can i solve this?

fay
  • 2,086
  • 2
  • 14
  • 36
  • Though installing `apache2`, the error indicates that installing `google-cloud-sdk` was at one time attempted since the post-installation script is being invoked. As suggest by @Janos Lenart, you can see the contents of the post install script in `/var/lib/dpkg/info/google-cloud-sdk.postinst`. The post-inst seems to failing. Can you try running `gcloud components post-process` as suggest by Janos? It may require `sudo` privileges as part of the command's instructions writes a command autocomplete table to a system directory (if installed with a system package manager). – Nicholas Mar 08 '17 at 22:01
  • You may also want to try the same suggested command but with debugging: `gcloud components post-process --verbosity debug`. – Nicholas Mar 10 '17 at 00:31

2 Answers2

1

Fairly crude solution and might ignore an actual problem, but you can skip the post installation script by putting

exit 0

in the 2nd line of the file

/var/lib/dpkg/info/google-cloud-sdk.postinst

Then rerun

dpkg --configure -a
Janos Lenart
  • 25,074
  • 5
  • 73
  • 75
  • i did that, so the `/var/lib/dpkg/info/google-cloud-sdk.postinst` file is now: `#!/bin/sh set -e /usr/bin/gcloud components post-process >/dev/null 2>&1 exit 0 `and i still get tha same error – fay Feb 08 '17 at 08:48
  • exit 0 in 2nd line, just after the #!/bin/sh line! – Janos Lenart Feb 08 '17 at 08:52
  • 1
    /usr/bin/gcloud components post-process is the command that fails, so you can try to run it yourself (without the redirects at the end) to see some error messages – Janos Lenart Feb 08 '17 at 09:03
  • ^^^ seconding this as a means to debug, one command at a time, what exactly is the error – Nick Apr 11 '17 at 20:15
0

If you failed to install Java and find this error then use this following instruction:

~$ java -version
~$ javac

checking list

~$ sudo dpkg --list | grep -i jdk

remove java (put your install version e.g. java8)

~$ sudo apt-get purge oracle-java9-installer

then again checking list

~$ sudo dpkg --list | grep -i jdk

For stopping failed download packages:

checking list

~$ sudo dpkg --list | grep -i pakage_name

remove package

~$ sudo apt-get purge package_name

then again checking list

~$ sudo dpkg --list | grep -i package_name
DimaSan
  • 12,264
  • 11
  • 65
  • 75