如何解决 dpkg 处理包 google-cloud-sdk 时出错

如何解决 dpkg 处理包 google-cloud-sdk 时出错

我为我的 Google Cloud Platform 实例选择了 Debian 9,并且一直运行 sudo apt update良好sudo apt upgrade,直到昨天,在我安装了 apache(没有其他任何东西)并且没有进行其他系统修改之后。我通常通过 SSL 连接到虚拟机并将窗口打开数小时,但是昨天,在尝试libopencv-dev通过运行sudo apt update和进行安装sudo apt upgradesudo apt install libopencv-dev,我收到以下错误:

myusername@instance-1:~$ sudo apt update
Ign:1 http://deb.debian.org/debian stretch InRelease
Get:2 http://deb.debian.org/debian stretch-updates InRelease [88.5 kB]
Get:3 http://deb.debian.org/debian stretch-backports InRelease [82.9 kB] 
Hit:4 http://deb.debian.org/debian stretch Release                                   
Hit:5 http://security.debian.org stretch/updates InRelease                             
Hit:7 http://packages.cloud.google.com/apt cloud-sdk-stretch InRelease                 
Hit:8 http://packages.cloud.google.com/apt google-cloud-compute-stretch InRelease
Hit:9 http://packages.cloud.google.com/apt google-cloud-packages-archive-keyring-stretch InRelease
Fetched 171 kB in 0s (171 kB/s)
Reading package lists... Done
Building dependency tree       
Reading state information... Done
All packages are up to date.
myusername@instance-1:~$ sudo apt upgrade
Reading package lists... Done
Building dependency tree       
Reading state information... Done
Calculating upgrade... Done
0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.
1 not fully installed or removed.
After this operation, 0 B of additional disk space will be used.
Do you want to continue? [Y/n] y
Setting up google-cloud-sdk (162.0.0-0) ...
Killed
dpkg: error processing package google-cloud-sdk (--configure):
 subprocess installed post-installation script returned error exit status 137
E: Sub-process /usr/bin/dpkg returned an error code (1)
myusername@instance-1:~$ 

我向 IRC 频道 (#debian) 寻求帮助,并被告知输出表明 google cloud 包(或其存储库?)不存在;但是,当我运行 aptitude 搜索时,它存在:

myusername@instance-1:~$ sudo apt search google-cloud-sdk
Sorting... Done
Full Text Search... Done
google-cloud-sdk/cloud-sdk-stretch,now 162.0.0-0 all [installed]
  Utilities for the Google Cloud Platform

google-cloud-sdk-app-engine-go/cloud-sdk-stretch 162.0.0-0 amd64
  Go runtime for Google App Engine

google-cloud-sdk-app-engine-java/cloud-sdk-stretch 162.0.0-0 all
  Java runtime for Google App Engine

google-cloud-sdk-app-engine-python/cloud-sdk-stretch 162.0.0-0 all
  Python runtime for Google App Engine

google-cloud-sdk-bigtable-emulator/cloud-sdk-stretch 162.0.0-0 amd64
  Emulator for Google Cloud Bigtable.

google-cloud-sdk-cbt/cloud-sdk-stretch 162.0.0-0 amd64
  Google Cloud Bigtable Command Line Tool

google-cloud-sdk-datalab/cloud-sdk-stretch 162.0.0-0 all
  Command-line utility for Google Cloud Datalab

google-cloud-sdk-datastore-emulator/cloud-sdk-stretch 162.0.0-0 all
  Emulator for Google Cloud Datastore.

google-cloud-sdk-pubsub-emulator/cloud-sdk-stretch 162.0.0-0 all
  Emulator for Google Cloud Pubsub.

google-cloud-sdk-tests/cloud-sdk-stretch 162.0.0-0 all
  Tests for verifying Google Cloud SDK packages.

myusername@instance-1:~$ 

答案1

我认为您应该查看dmesg输出(或日志)以查明postinst脚本何时终止:

Setting up google-cloud-sdk (162.0.0-0) ...
Killed
dpkg: error processing package google-cloud-sdk (--configure):
 subprocess installed post-installation script returned error exit status 137

例如,这可能是内存不足错误。

相关内容