Error during semanage

General support questions
Post Reply
yadav_01430
Posts: 8
Joined: 2020/11/14 00:37:37

Error during semanage

Post by yadav_01430 » 2021/08/05 07:42:58

Below command throws an error

semanage port -l
Traceback (most recent call last):
File "/usr/sbin/semanage", line 1074, in <module>
do_parser()
File "/usr/sbin/semanage", line 1053, in do_parser
args.func(args)
File "/usr/sbin/semanage", line 524, in handlePort
OBJECT = object_dict['port']()
File "/usr/sbin/semanage", line 167, in port_ini
from seobject import portRecords
File "/usr/lib64/python2.7/site-packages/seobject/__init__.py", line 106, in <module>
import audit
File "/usr/lib64/python2.7/site-packages/audit.py", line 26, in <module>
_audit = swig_import_helper()
File "/usr/lib64/python2.7/site-packages/audit.py", line 22, in swig_import_helper
_mod = imp.load_module('_audit', fp, pathname, description)
ImportError: /usr/lib64/python2.7/site-packages/_audit.so: undefined symbol: audit_can_read

Even below as well

sealert -a /var/log/audit/audit.log
Opps, sealert hit an error!

Traceback (most recent call last):
File "/usr/bin/sealert", line 691, in <module>
do_analyze_logfile(logfile)
File "/usr/bin/sealert", line 530, in do_analyze_logfile
scanner = ScanLogfile(logfile_path)
File "/usr/bin/sealert", line 492, in __init__
from setroubleshoot.analyze import LogfileAnalyzer
File "/usr/lib64/python2.7/site-packages/setroubleshoot/analyze.py", line 40, in <module>
from setroubleshoot.avc_audit import *
File "/usr/lib64/python2.7/site-packages/setroubleshoot/avc_audit.py", line 27, in <module>
import audit
File "/usr/lib64/python2.7/site-packages/audit.py", line 26, in <module>
_audit = swig_import_helper()
File "/usr/lib64/python2.7/site-packages/audit.py", line 22, in swig_import_helper
_mod = imp.load_module('_audit', fp, pathname, description)
ImportError: /usr/lib64/python2.7/site-packages/_audit.so: undefined symbol: audit_can_read

I reinstalled libselinux libselinux-python but that didn't help also.

User avatar
TrevorH
Site Admin
Posts: 33191
Joined: 2009/09/24 10:40:56
Location: Brighton, UK

Re: Error during semanage

Post by TrevorH » 2021/08/05 09:14:04

Looks like you have either a mismatched or corrupt library on your system. Do you get offered any updates when you run yum update ? If so, apply them and see if the problem is fixed.

It's complaining that /usr/lib64/python2.7/site-packages/_audit.so from the audit-libs-python packages is trying to use a symbol "audit_can_read" that should be part of another audit related lib and it cannot find it. That either means you didn't update the package that supplied that lib at the same time or the lib that supplies it is corrupt or replaced by another that doesn't have the symbol defined.

As far as I can tell from a quick look, the symbol ought to be in /usr/lib64/libaudit.so.1 provided by the audit-libs package. What is the output froom rpm -Va \*audit\* ? If anything is listed other than config files then you have corrupt files and need to investigate how it happened - was it accidental or malicious etc.
The future appears to be RHEL or Debian. I think I'm going Debian.
Info for USB installs on http://wiki.centos.org/HowTos/InstallFromUSBkey
CentOS 5 and 6 are deadest, do not use them.
Use the FAQ Luke

yadav_01430
Posts: 8
Joined: 2020/11/14 00:37:37

Re: Error during semanage

Post by yadav_01430 » 2021/08/05 09:27:13

rpm -Va \*audit\*
S.5....T. c /etc/audisp/audispd.conf
S.5....T. c /etc/audisp/plugins.d/syslog.conf
S.5....T. c /etc/audit/auditd.conf
.M....... c /etc/audit/rules.d/audit.rules
.......T. /usr/lib64/python2.7/site-packages/audit.py
S.5....T. /usr/lib64/python2.7/site-packages/audit.pyc

User avatar
TrevorH
Site Admin
Posts: 33191
Joined: 2009/09/24 10:40:56
Location: Brighton, UK

Re: Error during semanage

Post by TrevorH » 2021/08/05 09:34:22

.......T. /usr/lib64/python2.7/site-packages/audit.py
S.5....T. /usr/lib64/python2.7/site-packages/audit.pyc
The other files in that list are marked as config files (the 'c' in the output) so they are possibly valid changes. The 2 I've listed above are not config files so use rpm -qf on each file to find out the package name that supplies it then yum reinstall those packages.
The future appears to be RHEL or Debian. I think I'm going Debian.
Info for USB installs on http://wiki.centos.org/HowTos/InstallFromUSBkey
CentOS 5 and 6 are deadest, do not use them.
Use the FAQ Luke

yadav_01430
Posts: 8
Joined: 2020/11/14 00:37:37

Re: Error during semanage

Post by yadav_01430 » 2021/08/05 15:57:03

This is fixed..I messed up $LD_LIBRARY_PATH
Removing the entry , I was able to run the command successfully.

Post Reply