0

I tried to use AWS system manager to scan whether my Ubuntu EC2 is missing any patches. After I "Run a Command" using AWS-RunPatchBaseline, it showed that thr PatchLinux scan failed. The error message is shown below.

Does anybody know what is the reason and how to fix/debug it?

My EC2 to be patched is: 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

Update: in fact I clicked "Run a command" again, but this time I saved the complete output to S3, now I saw more error message, it seems the reason is: aws try to install python3-apt in my EC2 and fail.

in fact, I ssh to this ec2 and manually run:

sudo apt-get update

and then:

sudo apt-get -y upgrade

and it showed this error:

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...

I believe if I can figure out how to run "sudo apt-get -y upgrade" successfully, then the original issue of scan will be resolved. anybody know how to fix the issue when I manually execute "sudo apt-get -y upgrade"?

3
  • Can you post the sequence of commands you used to get this far? Are you working through this?
    – bu5hman
    Dec 6, 2017 at 3:58
  • bu5hman: thx for comment. yes I followed that this. 1. install ssm agent in the EC2. after that, the EC2 is shown in "managed instance", I have not run maintainence windows yet. instead, I click "Run a Command" using using AWS-RunPatchBaseline, and set "scan" it starts to run and then failed. I also scaned several other ubuntu, they r scanned successfully, only this EC2 scan failed.
    – user389955
    Dec 6, 2017 at 4:43
  • I do not know what AWS-RunPatchBaseline exactly did. is there any way I can know what AWS-RunPatchBaseline did so that I can ssh EC2 and run these command myself to see what is wrong, what stopped the EC2 to be scaned?
    – user389955
    Dec 6, 2017 at 4:45

0

You must log in to answer this question.

Browse other questions tagged .