无法使用 AWS 系统管理器修补扫描我的 Ubuntu EC2

无法使用 AWS 系统管理器修补扫描我的 Ubuntu EC2

我尝试使用AWS系统管理器扫描我的Ubuntu EC2是否缺少任何补丁。在我使用 AWS-RunPatchBaseline“运行命令”后,它显示 PatchLinux 扫描失败。错误消息如下所示。

有谁知道原因是什么以及如何修复/调试它?

我要打补丁的EC2是:ubuntu 16.04。

(Reading database 
---Output truncated---
----------ERROR-------
debconf: unable to initialize frontend: Dialog
debconf: (TERM is not set, so the dialog frontend is not usable.)
debconf: falling back to frontend: Readline
debconf: unable to initialize frontend: Readline
debconf: (This frontend requires a controlling tty.)
debconf: falling back to frontend: Teletype
dpkg-preconfigure: unable to re-open stdin: 
E: Sub-process /usr/bin/dpkg returned an error code (1)
WARNING: Could not install the python3-requests, this may cause the     
patching operation to fail.
debconf: unable to initialize frontend: Dialog
debconf: (TERM is not set, so the dialog frontend is not usable.)
debconf: falling back to frontend: Readline
debconf: unable to initialize frontend: Readline
debconf: (This frontend requires a controlling tty.)
debconf: falling back to frontend: Teletype
dpkg-preconfigure: unable to re-open stdin: 
E: Sub-process /usr/bin/dpkg returned an error code (1)
WARNING: Could not install the python3-apt, this may cause the patching         
operation to fail.

failed to run commands: exit status 1

更新:事实上,我再次单击“运行命令”,但这次我将完整的输出保存到S3,现在我看到更多错误消息,似乎原因是:aws尝试在我的EC2中安装python3-apt并失败。

事实上,我通过 ssh 连接到这个 ec2 并手动运行:

sudo apt-get update

进而:

sudo apt-get -y upgrade

它显示了这个错误:

Preparing to unpack .../apport_2.20.1-0ubuntu2.13_all.deb ...
  File "/usr/bin/pyclean", line 63
    except (IOError, OSError), e:
                             ^
SyntaxError: invalid syntax
dpkg: warning: subprocess old pre-removal script returned error exit     
status 1
dpkg: trying script from the new package instead ...
  File "/usr/bin/pyclean", line 63
    except (IOError, OSError), e:

SyntaxError: invalid syntax
dpkg: error processing archive /var/cache/apt/archives/apport_2.20.1-    
0ubuntu2.13_all.deb (--unpack):
 subprocess new pre-removal script returned error exit status 1
Traceback (most recent call last):
  File "/usr/bin/pycompile", line 35, in <module>
    from debpython.version import SUPPORTED, debsorted, vrepr, \
  File "/usr/share/python/debpython/version.py", line 24, in <module>
    from ConfigParser import SafeConfigParser
ImportError: No module named 'ConfigParser'
dpkg: error while cleaning up:
 subprocess installed post-installation script returned error exit    
status 1
Errors were encountered while processing:
 /var/cache/apt/archives/apport_2.20.1-0ubuntu2.13_all.deb
Reading package lists...
Building dependency tree...
Reading state information...

我相信,如果我能弄清楚如何成功运行“sudo apt-get -y升级”,那么原来的扫描问题将得到解决。有人知道当我手动执行“sudo apt-get -y update”时如何解决问题吗?

相关内容