相关文章推荐

Stack Exchange Network

Stack Exchange network consists of 181 Q&A communities including Stack Overflow , the largest, most trusted online community for developers to learn, share their knowledge, and build their careers. Visit Stack Exchange

Server Fault is a question and answer site for system and network administrators. It only takes a minute to sign up.

Sign up to join this community

Teams

Q&A for work

Connect and share knowledge within a single location that is structured and easy to search.

Learn more about Teams

I'm making a set of changes to a group of 150 servers. All systems were able to successfully download and install a specific set of RPM's via yum , except for one. One this particular system, all yum commands outside of "clean" dump the following to the screen:

[root@dev1v ~]# yum install sssd
Loaded plugins: rhnplugin
/usr/lib64/python2.6/xmlrpclib.py:612: DeprecationWarning: The xmllib module is obsolete.  Use xml.sax instead.
  import xmllib # lazy subclassing (!)
Traceback (most recent call last):
  File "/usr/bin/yum", line 29, in <module>
    yummain.user_main(sys.argv[1:], exit_code=True)
  File "/usr/share/yum-cli/yummain.py", line 285, in user_main
    errcode = main(args)
  File "/usr/share/yum-cli/yummain.py", line 136, in main
    result, resultmsgs = base.doCommands()
  File "/usr/share/yum-cli/cli.py", line 434, in doCommands
    self._getTs(needTsRemove)
  File "/usr/lib/python2.6/site-packages/yum/depsolve.py", line 99, in _getTs
    self._getTsInfo(remove_only)
  File "/usr/lib/python2.6/site-packages/yum/repoMDObject.py", line 124, in __init__
    self.parse(srcfile)
  File "/usr/lib/python2.6/site-packages/yum/repoMDObject.py", line 140, in parse
    parser = iterparse(infile)
  File "/usr/lib/python2.6/site-packages/yum/misc.py", line 1169, in cElementTree_iterparse
    _cElementTree_import()
  File "/usr/lib/python2.6/site-packages/yum/misc.py", line 1164, in _cElementTree_import
    import cElementTree
ImportError: No module named cElementTree

I've tried:

  • yum clean
  • reinstalling bits and pieces manually via RPM... expat, part of python, etc.
  • rebuilding the RPM database
  • Any thoughts?

    The fix:

    Apparently, the Oracle installation on this system injected Oracle's path into LD_LIBRARY_PATH...

    [root@dev1v etc]# export 
    declare -x LD_LIBRARY_PATH="/home/oracle/app/oracle/product/11.2.0/client_1/lib"
    

    Unsetting the variable allowed yum to function properly again.

    Hmm, in python 2.6, cElementTree lives in /usr/lib64/python2.6/xml/etree/cElementTree.py, which is part of the python package. The fact that you're reaching the import cElementTree in the yum code indicates that xml.etree seems missing.

    Try reinstalling python by manually downloading the rpm and using rpm -Uvh.

    If that doesn't work, what happens if you import xml.etree.cElementTree in a python shell? What does rpm --verify python say?

    I have also seen someone causing this issue by putting Oracle's lib/ path in /etc/ld.so.conf.d

    Using:

    echo /opt/oracle/app/product/11.2.0/dbhome_1/lib/ > /etc/ld.so.conf.d/oracle.conf

    Solved this issue by removing /etc/ld.so.conf.d/oracle.conf.

    Recently, I resolved this problem as the following: (OS: CentOS 6.3 with Oracle installed).

  • Edit /etc/profile and find export LD_LIBRARY_PATH line if present.

  • Add /lib64 before $ORACLE_HOME/lib

    export  LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/lib64:$ORACLE_HOME/lib:/lib:/usr/lib:/usr/lib/oracle/11.2/client/lib
    
  • Log out and re-logon as root.

  • If any variable is defined in /etc/ld.so.conf then remove it and run # ldconfig command to recreate ld cache.

    [root@host ~]# ldconfig
    

    Confirm that the Python library now links to the correct /lib64/libexpat.so.1 library.

    [root@host ~]# ldd /usr/lib64/python2.6/lib-dynload/pyexpat.so
                    Welcome on the ServerFault! Maybe you could elaborate this more, it is now like a magician answer ("and sacrifice a black hen and you will have rain"). Why? How?
    – peterh
                    Aug 17, 2017 at 21:34
            

    Thanks for contributing an answer to Server Fault!

    • Please be sure to answer the question. Provide details and share your research!

    But avoid

    • Asking for help, clarification, or responding to other answers.
    • Making statements based on opinion; back them up with references or personal experience.

    To learn more, see our tips on writing great answers.

  •  
    推荐文章