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"?