|
|
baab13 |
From d3ac6c888953d0bcd304d30dfa0f1c731987f358 Mon Sep 17 00:00:00 2001
|
|
|
baab13 |
From: Denys Vlasenko <dvlasenk@redhat.com>
|
|
|
baab13 |
Date: Mon, 6 Jan 2014 16:46:48 +0100
|
|
|
baab13 |
Subject: [ABRT PATCH 20/27] move MCE handling in event to
|
|
|
baab13 |
abrt-action-check-oops-for-hw-error
|
|
|
baab13 |
|
|
|
baab13 |
Having a separate tool should help with internationalization
|
|
|
baab13 |
|
|
|
baab13 |
Signed-off-by: Denys Vlasenko <dvlasenk@redhat.com>
|
|
|
baab13 |
|
|
|
baab13 |
Related to rhbz#1032077
|
|
|
baab13 |
|
|
|
baab13 |
Signed-off-by: Jakub Filak <jfilak@redhat.com>
|
|
|
baab13 |
---
|
|
|
baab13 |
configure.ac | 1 +
|
|
|
baab13 |
doc/Makefile.am | 1 +
|
|
|
baab13 |
po/POTFILES.in | 1 +
|
|
|
baab13 |
src/plugins/Makefile.am | 3 +
|
|
|
baab13 |
src/plugins/abrt-action-check-oops-for-hw-error.in | 118 +++++++++++++++++++++
|
|
|
baab13 |
src/plugins/koops_event.conf | 57 +---------
|
|
|
baab13 |
8 files changed, 129 insertions(+), 55 deletions(-)
|
|
|
baab13 |
create mode 100644 src/plugins/abrt-action-check-oops-for-hw-error.in
|
|
|
baab13 |
|
|
|
baab13 |
diff --git a/configure.ac b/configure.ac
|
|
|
baab13 |
index 3bd13bc..346faa8 100644
|
|
|
baab13 |
--- a/configure.ac
|
|
|
baab13 |
+++ b/configure.ac
|
|
|
baab13 |
@@ -279,6 +279,7 @@ AC_CONFIG_FILES([
|
|
|
baab13 |
src/dbus/Makefile
|
|
|
baab13 |
src/plugins/abrt-action-install-debuginfo
|
|
|
baab13 |
src/plugins/abrt-action-analyze-vmcore
|
|
|
baab13 |
+ src/plugins/abrt-action-check-oops-for-hw-error
|
|
|
baab13 |
src/python-problem/Makefile
|
|
|
baab13 |
src/python-problem/doc/Makefile
|
|
|
baab13 |
src/python-problem/tests/Makefile
|
|
|
baab13 |
diff --git a/doc/Makefile.am b/doc/Makefile.am
|
|
|
baab13 |
index f1abef8..e76abde 100644
|
|
|
baab13 |
--- a/doc/Makefile.am
|
|
|
baab13 |
+++ b/doc/Makefile.am
|
|
|
baab13 |
@@ -32,6 +32,7 @@ MAN1_TXT += abrt-action-save-package-data.txt
|
|
|
baab13 |
MAN1_TXT += abrt-action-save-kernel-data.txt
|
|
|
baab13 |
MAN1_TXT += abrt-install-ccpp-hook.txt
|
|
|
baab13 |
MAN1_TXT += abrt-action-analyze-vmcore.txt
|
|
|
baab13 |
+MAN1_TXT += abrt-action-check-oops-for-hw-error.txt
|
|
|
baab13 |
MAN1_TXT += abrt-action-analyze-ccpp-local.txt
|
|
|
baab13 |
MAN1_TXT += abrt-watch-log.txt
|
|
|
baab13 |
MAN1_TXT += abrt-upload-watch.txt
|
|
|
baab13 |
diff --git a/po/POTFILES.in b/po/POTFILES.in
|
|
|
baab13 |
index 5f883c0..6d90162 100644
|
|
|
baab13 |
--- a/po/POTFILES.in
|
|
|
baab13 |
+++ b/po/POTFILES.in
|
|
|
baab13 |
@@ -25,6 +25,7 @@ src/plugins/abrt-action-analyze-oops.c
|
|
|
baab13 |
src/plugins/abrt-action-analyze-xorg.c
|
|
|
baab13 |
src/plugins/abrt-action-analyze-python.c
|
|
|
baab13 |
src/plugins/abrt-action-analyze-vmcore.in
|
|
|
baab13 |
+src/plugins/abrt-action-check-oops-for-hw-error.in
|
|
|
baab13 |
src/plugins/abrt-action-generate-backtrace.c
|
|
|
baab13 |
src/plugins/abrt-action-generate-core-backtrace.c
|
|
|
baab13 |
src/plugins/abrt-action-install-debuginfo.in
|
|
|
baab13 |
diff --git a/src/plugins/Makefile.am b/src/plugins/Makefile.am
|
|
|
baab13 |
index 60246f2..dd32c7d 100644
|
|
|
baab13 |
--- a/src/plugins/Makefile.am
|
|
|
baab13 |
+++ b/src/plugins/Makefile.am
|
|
|
baab13 |
@@ -5,6 +5,7 @@ bin_SCRIPTS = \
|
|
|
baab13 |
abrt-action-analyze-core \
|
|
|
baab13 |
abrt-action-analyze-vulnerability \
|
|
|
baab13 |
abrt-action-analyze-vmcore \
|
|
|
baab13 |
+ abrt-action-check-oops-for-hw-error \
|
|
|
baab13 |
abrt-action-list-dsos \
|
|
|
baab13 |
abrt-action-perform-ccpp-analysis \
|
|
|
baab13 |
abrt-action-save-kernel-data \
|
|
|
baab13 |
@@ -74,6 +75,7 @@ PYTHON_FILES = \
|
|
|
baab13 |
abrt-action-analyze-core \
|
|
|
baab13 |
abrt-action-analyze-vulnerability \
|
|
|
baab13 |
abrt-action-analyze-vmcore.in \
|
|
|
baab13 |
+ abrt-action-check-oops-for-hw-error.in \
|
|
|
baab13 |
abrt-action-perform-ccpp-analysis.in \
|
|
|
baab13 |
abrt-action-notify
|
|
|
baab13 |
|
|
|
baab13 |
@@ -88,6 +90,7 @@ EXTRA_DIST = \
|
|
|
baab13 |
analyze_RetraceServer.xml.in \
|
|
|
baab13 |
analyze_VMcore.xml.in \
|
|
|
baab13 |
abrt-action-analyze-vmcore \
|
|
|
baab13 |
+ abrt-action-check-oops-for-hw-error \
|
|
|
baab13 |
abrt-action-save-kernel-data \
|
|
|
baab13 |
abrt-action-ureport \
|
|
|
baab13 |
abrt-gdb-exploitable \
|
|
|
baab13 |
diff --git a/src/plugins/abrt-action-check-oops-for-hw-error.in b/src/plugins/abrt-action-check-oops-for-hw-error.in
|
|
|
baab13 |
new file mode 100644
|
|
|
baab13 |
index 0000000..83c0f22
|
|
|
baab13 |
--- /dev/null
|
|
|
baab13 |
+++ b/src/plugins/abrt-action-check-oops-for-hw-error.in
|
|
|
baab13 |
@@ -0,0 +1,118 @@
|
|
|
baab13 |
+#!/usr/bin/python -u
|
|
|
baab13 |
+
|
|
|
baab13 |
+import sys
|
|
|
baab13 |
+import os
|
|
|
baab13 |
+import locale
|
|
|
baab13 |
+import gettext
|
|
|
baab13 |
+
|
|
|
baab13 |
+GETTEXT_PROGNAME = "abrt"
|
|
|
baab13 |
+
|
|
|
baab13 |
+_ = gettext.lgettext
|
|
|
baab13 |
+
|
|
|
baab13 |
+def file_has_string(filename, string):
|
|
|
baab13 |
+ try:
|
|
|
baab13 |
+ f = open(filename, "r")
|
|
|
baab13 |
+ except IOError as e:
|
|
|
baab13 |
+ #print e
|
|
|
baab13 |
+ return False
|
|
|
baab13 |
+ for line in f:
|
|
|
baab13 |
+ if string in line:
|
|
|
baab13 |
+ f.close()
|
|
|
baab13 |
+ return True
|
|
|
baab13 |
+ f.close()
|
|
|
baab13 |
+ return False
|
|
|
baab13 |
+
|
|
|
baab13 |
+
|
|
|
baab13 |
+def tail_with_search(filename, string, maxlen):
|
|
|
baab13 |
+ try:
|
|
|
baab13 |
+ f = open(filename, "r")
|
|
|
baab13 |
+ except IOError as e:
|
|
|
baab13 |
+ #print e
|
|
|
baab13 |
+ return []
|
|
|
baab13 |
+ l = []
|
|
|
baab13 |
+ for line in f:
|
|
|
baab13 |
+ if string in line:
|
|
|
baab13 |
+ l.append(line)
|
|
|
baab13 |
+ if len(l) > maxlen:
|
|
|
baab13 |
+ del l[0]
|
|
|
baab13 |
+ f.close()
|
|
|
baab13 |
+ return l
|
|
|
baab13 |
+
|
|
|
baab13 |
+
|
|
|
baab13 |
+if __name__ == "__main__":
|
|
|
baab13 |
+ try:
|
|
|
baab13 |
+ locale.setlocale(locale.LC_ALL, "")
|
|
|
baab13 |
+ except locale.Error:
|
|
|
baab13 |
+ os.environ['LC_ALL'] = 'C'
|
|
|
baab13 |
+ locale.setlocale(locale.LC_ALL, "")
|
|
|
baab13 |
+
|
|
|
baab13 |
+ # Defeat "AttributeError: 'module' object has no attribute 'nl_langinfo'"
|
|
|
baab13 |
+ try:
|
|
|
baab13 |
+ gettext.bind_textdomain_codeset(GETTEXT_PROGNAME,
|
|
|
baab13 |
+ locale.nl_langinfo(locale.CODESET))
|
|
|
baab13 |
+ except AttributeError:
|
|
|
baab13 |
+ pass
|
|
|
baab13 |
+
|
|
|
baab13 |
+ gettext.bindtextdomain(GETTEXT_PROGNAME, '/usr/share/locale')
|
|
|
baab13 |
+ gettext.textdomain(GETTEXT_PROGNAME)
|
|
|
baab13 |
+
|
|
|
baab13 |
+ #
|
|
|
baab13 |
+ # So far we only look for Machine Check Exceptions here.
|
|
|
baab13 |
+ #
|
|
|
baab13 |
+
|
|
|
baab13 |
+ # See if MCEs were seen
|
|
|
baab13 |
+ if not file_has_string("dmesg", "Machine check events logged"):
|
|
|
baab13 |
+ sys.exit(0)
|
|
|
baab13 |
+ #
|
|
|
baab13 |
+ # There was an MCE. IOW: it's not a bug, it's a HW error.
|
|
|
baab13 |
+ f = open("not-reportable", "w")
|
|
|
baab13 |
+ f.write("The kernel log indicates that hardware errors were detected.\n");
|
|
|
baab13 |
+ f.write("This is most likely not a software problem.\n");
|
|
|
baab13 |
+ f.close()
|
|
|
baab13 |
+
|
|
|
baab13 |
+ #
|
|
|
baab13 |
+ # Did mcelog logged it to /var/log/mcelog
|
|
|
baab13 |
+ # (RHEL6 by default does this)?
|
|
|
baab13 |
+ if os.path.exists("/var/log/mcelog"):
|
|
|
baab13 |
+ f = open("comment", "w")
|
|
|
baab13 |
+ f.write("The kernel log indicates that hardware errors were detected.\n")
|
|
|
baab13 |
+ f.write("/var/log/mcelog file may have more information.\n")
|
|
|
baab13 |
+ f.write("The last 20 lines of /var/log/mcelog are:\n")
|
|
|
baab13 |
+ f.write("=========================================\n")
|
|
|
baab13 |
+ #tail -n20 /var/log/mcelog 2>&1
|
|
|
baab13 |
+ l = tail_with_search("/var/log/mcelog", "", 20)
|
|
|
baab13 |
+ for line in l:
|
|
|
baab13 |
+ f.write(line)
|
|
|
baab13 |
+ f.close()
|
|
|
baab13 |
+ sys.exit(0)
|
|
|
baab13 |
+ #
|
|
|
baab13 |
+ # On RHEL7, mcelog is run so that its output ends up in syslog.
|
|
|
baab13 |
+ # Do we see that?
|
|
|
baab13 |
+ if file_has_string("/var/log/messages", "mcelog: Hardware event"):
|
|
|
baab13 |
+ f = open("comment", "w")
|
|
|
baab13 |
+ f.write("The kernel log indicates that hardware errors were detected.\n")
|
|
|
baab13 |
+ f.write("System log may have more information.\n")
|
|
|
baab13 |
+ f.write("The last 20 mcelog lines of system log are:\n")
|
|
|
baab13 |
+ f.write("==========================================\n")
|
|
|
baab13 |
+ #grep -Fi 'mcelog:' /var/log/messages | tail -n20 2>&1
|
|
|
baab13 |
+ l = tail_with_search("/var/log/messages", "mcelog:", 20)
|
|
|
baab13 |
+ for line in l:
|
|
|
baab13 |
+ f.write(line)
|
|
|
baab13 |
+ f.close()
|
|
|
baab13 |
+ sys.exit(0)
|
|
|
baab13 |
+ #
|
|
|
baab13 |
+ # Apparently, there is no running mcelog daemon!
|
|
|
baab13 |
+ # Let user know that he needs one.
|
|
|
baab13 |
+ f = open("comment", "w")
|
|
|
baab13 |
+ f.write("The kernel log indicates that hardware errors were detected.\n")
|
|
|
baab13 |
+ f.write("The data was saved by kernel for processing by the mcelog tool.\n")
|
|
|
baab13 |
+ f.write("However, neither /var/log/mcelog nor system log contain mcelog messages.\n")
|
|
|
baab13 |
+ f.write("Most likely reason is that mcelog is not installed or not configured\n")
|
|
|
baab13 |
+ f.write("to be started during boot.\n")
|
|
|
baab13 |
+ f.write("Without this tool running, the binary data saved by kernel\n")
|
|
|
baab13 |
+ f.write("is of limited usefulness.\n")
|
|
|
baab13 |
+ f.write("(You can save this data anyway by running 'cat </dev/mcelog >FILE').\n")
|
|
|
baab13 |
+ f.write("The recommended course of action is to install mcelog.\n")
|
|
|
baab13 |
+ f.write("If another hardware error would occur, a user-readable description\n")
|
|
|
baab13 |
+ f.write("of it will be saved in system log or /var/log/mcelog.\n")
|
|
|
baab13 |
+ f.close()
|
|
|
baab13 |
diff --git a/src/plugins/koops_event.conf b/src/plugins/koops_event.conf
|
|
|
baab13 |
index 7dfbe36..3740f65 100644
|
|
|
baab13 |
--- a/src/plugins/koops_event.conf
|
|
|
baab13 |
+++ b/src/plugins/koops_event.conf
|
|
|
baab13 |
@@ -3,61 +3,8 @@ EVENT=post-create analyzer=Kerneloops
|
|
|
baab13 |
# >> instead of > is due to bugzilla.redhat.com/show_bug.cgi?id=854266
|
|
|
baab13 |
abrt-action-analyze-oops &&
|
|
|
baab13 |
dmesg >>dmesg &&
|
|
|
baab13 |
- abrt-action-save-kernel-data
|
|
|
baab13 |
- abrt-action-save-kernel-data || exit $?
|
|
|
baab13 |
- #
|
|
|
baab13 |
- # If it exists, we can save a copy of MCE log here:
|
|
|
baab13 |
- #test -f /var/log/mcelog && cp /var/log/mcelog .
|
|
|
baab13 |
- # but in current config, sosreport already does that.
|
|
|
baab13 |
- #
|
|
|
baab13 |
- # See if MCEs were seen but mcelog isn't installed or running
|
|
|
baab13 |
- grep -qFi 'Machine check events logged' dmesg || exit 0
|
|
|
baab13 |
- #
|
|
|
baab13 |
- # There was an MCE. IOW: it's not a bug, it's a HW error.
|
|
|
baab13 |
- # Did mcelog logged it to /var/log/mcelog
|
|
|
baab13 |
- # (RHEL6 by default does this)?
|
|
|
baab13 |
- test -f /var/log/mcelog &&
|
|
|
baab13 |
- {
|
|
|
baab13 |
- # (Ab)use user comment field to inform user about it.
|
|
|
baab13 |
- echo "The kernel log indicates that hardware errors were detected."
|
|
|
baab13 |
- echo "/var/log/mcelog file may have more information."
|
|
|
baab13 |
- echo "The last 20 lines of /var/log/mcelog are:"
|
|
|
baab13 |
- echo "========================================="
|
|
|
baab13 |
- # Redirecting sterr in case selinux makes it unreadable
|
|
|
baab13 |
- # (annoying anyway, but at least user knows what's going on):
|
|
|
baab13 |
- tail -n20 /var/log/mcelog 2>&1
|
|
|
baab13 |
- exit 0
|
|
|
baab13 |
- } >comment
|
|
|
baab13 |
- #
|
|
|
baab13 |
- # On RHEL7, mcelog is run so that its output ends up in syslog.
|
|
|
baab13 |
- # Do we see that?
|
|
|
baab13 |
- grep -qFi 'mcelog: Hardware event' /var/log/messages &&
|
|
|
baab13 |
- {
|
|
|
baab13 |
- echo "The kernel log indicates that hardware errors were detected."
|
|
|
baab13 |
- echo "System log may have more information."
|
|
|
baab13 |
- echo "The last 20 mcelog lines of system log are:"
|
|
|
baab13 |
- echo "========================================="
|
|
|
baab13 |
- # Redirecting sterr in case selinux makes it unreadable
|
|
|
baab13 |
- # (annoying anyway, but at least user knows what's going on):
|
|
|
baab13 |
- grep -Fi 'mcelog:' /var/log/messages | tail -n20 2>&1
|
|
|
baab13 |
- exit 0
|
|
|
baab13 |
- } >comment
|
|
|
baab13 |
- #
|
|
|
baab13 |
- # Apparently, there is no running mcelog daemon!
|
|
|
baab13 |
- # Let user know that he needs one.
|
|
|
baab13 |
- {
|
|
|
baab13 |
- echo "The kernel log indicates that hardware errors were detected."
|
|
|
baab13 |
- echo "The data was saved by kernel for processing by the mcelog tool."
|
|
|
baab13 |
- echo "However, neither /var/log/mcelog nor system log contain mcelog messages."
|
|
|
baab13 |
- echo "Most likely reason is that mcelog is not installed or not configured"
|
|
|
baab13 |
- echo "to be started during boot."
|
|
|
baab13 |
- echo "Without this tool running, the binary data saved by kernel"
|
|
|
baab13 |
- echo "is of limited usefulness."
|
|
|
baab13 |
- echo "(You can save this data anyway by running 'cat </dev/mcelog >FILE')."
|
|
|
baab13 |
- echo "The recommended course of action is to install mcelog."
|
|
|
baab13 |
- echo "If another hardware error would occur, a user-readable description"
|
|
|
baab13 |
- echo "of it will be saved in system log or /var/log/mcelog."
|
|
|
baab13 |
- } >comment
|
|
|
baab13 |
+ abrt-action-save-kernel-data &&
|
|
|
baab13 |
+ abrt-action-check-oops-for-hw-error
|
|
|
baab13 |
|
|
|
baab13 |
# If you want behavior similar to one provided by kerneloops daemon
|
|
|
baab13 |
# distributed by kerneloops.org - that is, if you want
|
|
|
baab13 |
--
|
|
|
baab13 |
1.8.3.1
|
|
|
baab13 |
|