Posts Tagged ‘python’

Fix Unable to connect to xend: Connection refused. ExpatError: no element found

The error message

Unable to connect to xend: Connection refused. Is xend running?

can be caused by a number of issues, but if your xend.log contains lines regarding syntax, such as:

[2012-01-23 11:33:37 5670] INFO (SrvDaemon:227) Xend stopped due to signal 15.
[2012-01-23 11:33:38 6427] INFO (SrvDaemon:332) Xend Daemon started
[2012-01-23 11:33:38 6427] INFO (SrvDaemon:336) Xend changeset: unavailable.
[2012-01-23 11:33:38 6427] ERROR (SrvDaemon:349) Exception starting xend (no element found: line 1, column 0)
Traceback (most recent call last):
  File "/usr/lib64/python2.6/site-packages/xen/xend/server/SrvDaemon.py", line 341, in run
    servers = SrvServer.create()
  File "/usr/lib64/python2.6/site-packages/xen/xend/server/SrvServer.py", line 251, in create
    root.putChild('xend', SrvRoot())
  File "/usr/lib64/python2.6/site-packages/xen/xend/server/SrvRoot.py", line 40, in __init__
    self.get(name)
  File "/usr/lib64/python2.6/site-packages/xen/web/SrvDir.py", line 84, in get
    val = val.getobj()
  File "/usr/lib64/python2.6/site-packages/xen/web/SrvDir.py", line 52, in getobj
    self.obj = klassobj()
  File "/usr/lib64/python2.6/site-packages/xen/xend/server/SrvNode.py", line 30, in __init__
    self.xn = XendNode.instance()
  File "/usr/lib64/python2.6/site-packages/xen/xend/XendNode.py", line 1140, in instance
    inst = XendNode()
  File "/usr/lib64/python2.6/site-packages/xen/xend/XendNode.py", line 158, in __init__
    self._init_PPCIs()
  File "/usr/lib64/python2.6/site-packages/xen/xend/XendNode.py", line 270, in _init_PPCIs
    saved_ppcis = self.state_store.load_state('ppci')
  File "/usr/lib64/python2.6/site-packages/xen/xend/XendStateStore.py", line 104, in load_state
    dom = minidom.parse(xml_path)
  File "/usr/lib64/python2.6/site-packages/_xmlplus/dom/minidom.py", line 1915, in parse
    return expatbuilder.parse(file)
  File "/usr/lib64/python2.6/site-packages/_xmlplus/dom/expatbuilder.py", line 926, in parse
    result = builder.parseFile(fp)
  File "/usr/lib64/python2.6/site-packages/_xmlplus/dom/expatbuilder.py", line 211, in parseFile
    parser.Parse("", True)
ExpatError: no element found: line 1, column 0

there is a good chance your xend database (stored, intuitively, in python syntax…) is suffering from corruption.

It is safe to remove the database but best practice to back it up so rename the directory:

# mv /var/lib/xend /var/lib/xend.bak
# /etc/init.d/xend restart

Portage Errors: libselinux and libsemanage won’t emerge with Python 3.x

You may encounter this problem with libselinux and libsemanage when attempting to compile them while Python 3x is set as the default interpreter.

make PYLIBVER=python3.1 pywrap 
make -C src pywrap
make[1]: Entering directory `/var/tmp/portage/sys-libs/libsemanage-2.0.27/work/libsemanage-2.0.27/src'
cc -O2 -march=i686 -pipe -fomit-frame-pointer -mno-tls-direct-seg-refs -fstack-protector-all -I../include -I/usr/include -D_GNU_SOURCE -I/usr/include/python3.1 -fPIC -DSHARED -c -o semanageswig_wrap.lo semanageswig_wrap.c
semanageswig_wrap.c: In function 'PySwigObject_format':
semanageswig_wrap.c:1319: warning: initialization makes pointer from integer without a cast
semanageswig_wrap.c:1321: warning: assignment makes pointer from integer without a cast
semanageswig_wrap.c: In function 'PySwigObject_repr':
semanageswig_wrap.c:1351: warning: initialization makes pointer from integer without a cast
semanageswig_wrap.c: In function 'PySwigObject_print':
semanageswig_wrap.c:1373: warning: passing argument 1 of 'fputs' makes pointer from integer without a cast
/usr/include/stdio.h:662: note: expected 'const char * __restrict__' but argument is of type 'int'
semanageswig_wrap.c: In function 'PySwigObject_str':
semanageswig_wrap.c:1386: warning: return makes pointer from integer without a cast
semanageswig_wrap.c: In function '_PySwigObject_type':
semanageswig_wrap.c:1582: warning: initialization from incompatible pointer type
semanageswig_wrap.c:1583: warning: initialization from incompatible pointer type
semanageswig_wrap.c:1586: warning: initialization from incompatible pointer type
semanageswig_wrap.c:1587: warning: initialization from incompatible pointer type
semanageswig_wrap.c:1594: error: 'coercion' undeclared (first use in this function)
semanageswig_wrap.c:1594: error: (Each undeclared identifier is reported only once
semanageswig_wrap.c:1594: error: for each function it appears in.)
semanageswig_wrap.c:1594: error: expected '}' before numeric constant
semanageswig_wrap.c:1616: warning: initialization makes integer from pointer without a cast
semanageswig_wrap.c:1619: warning: initialization from incompatible pointer type
semanageswig_wrap.c:1620: warning: initialization from incompatible pointer type
semanageswig_wrap.c:1624: warning: initialization from incompatible pointer type
semanageswig_wrap.c:1627: error: 'cmpfunc' undeclared (first use in this function)
semanageswig_wrap.c:1627: error: expected '}' before 'PySwigObject_compare'
semanageswig_wrap.c:1674: error: 'PyTypeObject' has no member named 'ob_type'
semanageswig_wrap.c: In function 'PySwigPacked_repr':
semanageswig_wrap.c:1723: warning: return makes pointer from integer without a cast
semanageswig_wrap.c:1725: warning: return makes pointer from integer without a cast
semanageswig_wrap.c: In function 'PySwigPacked_str':
semanageswig_wrap.c:1734: warning: return makes pointer from integer without a cast
semanageswig_wrap.c:1736: warning: return makes pointer from integer without a cast
semanageswig_wrap.c: In function '_PySwigPacked_type':
semanageswig_wrap.c:1783: warning: initialization makes integer from pointer without a cast
semanageswig_wrap.c:1786: warning: initialization from incompatible pointer type
semanageswig_wrap.c:1787: warning: initialization from incompatible pointer type
semanageswig_wrap.c:1788: warning: initialization from incompatible pointer type
semanageswig_wrap.c:1790: error: 'cmpfunc' undeclared (first use in this function)
semanageswig_wrap.c:1790: error: expected '}' before 'PySwigPacked_compare'
semanageswig_wrap.c:1837: error: 'PyTypeObject' has no member named 'ob_type'
semanageswig_wrap.c: In function '_SWIG_This':
semanageswig_wrap.c:1882: warning: return makes pointer from integer without a cast
semanageswig_wrap.c: In function 'SWIG_Python_GetSwigThis':
semanageswig_wrap.c:1903: warning: assignment makes pointer from integer without a cast
semanageswig_wrap.c: In function 'SWIG_Python_NewShadowInstance':
semanageswig_wrap.c:2117: warning: assignment makes pointer from integer without a cast
semanageswig_wrap.c: In function 'SWIG_Python_SetModule':
semanageswig_wrap.c:2299: warning: initialization makes pointer from integer without a cast
semanageswig_wrap.c: In function 'SWIG_Python_TypeQuery':
semanageswig_wrap.c:2319: warning: initialization makes pointer from integer without a cast
semanageswig_wrap.c: In function 'SWIG_Python_TypeError':
semanageswig_wrap.c:2408: warning: initialization makes pointer from integer without a cast
semanageswig_wrap.c: In function 'SWIG_From_int':
semanageswig_wrap.c:2554: warning: return makes pointer from integer without a cast
semanageswig_wrap.c: In function 'SWIG_FromCharPtrAndSize':
semanageswig_wrap.c:2580: warning: return makes pointer from integer without a cast
semanageswig_wrap.c: In function 'SWIG_AsCharPtrAndSize':
semanageswig_wrap.c:2626: warning: assignment makes pointer from integer without a cast
semanageswig_wrap.c: In function 'swig_varlink_repr':
semanageswig_wrap.c:12117: warning: return makes pointer from integer without a cast
semanageswig_wrap.c: In function 'swig_varlink_str':
semanageswig_wrap.c:12122: warning: initialization makes pointer from integer without a cast
semanageswig_wrap.c: In function 'swig_varlink_print':
semanageswig_wrap.c:12136: warning: format '%s' expects type 'char *', but argument 3 has type 'int'
semanageswig_wrap.c: In function 'swig_varlink_type':
semanageswig_wrap.c:12196: warning: initialization makes integer from pointer without a cast
semanageswig_wrap.c:12199: warning: initialization from incompatible pointer type
semanageswig_wrap.c:12200: warning: initialization from incompatible pointer type
semanageswig_wrap.c:12201: warning: initialization from incompatible pointer type
semanageswig_wrap.c:12204: warning: initialization from incompatible pointer type
semanageswig_wrap.c:12210: warning: initialization from incompatible pointer type
semanageswig_wrap.c:12215: warning: initialization from incompatible pointer type
semanageswig_wrap.c:12231: error: 'PyTypeObject' has no member named 'ob_type'
semanageswig_wrap.c: In function 'init_semanage':
semanageswig_wrap.c:12362: warning: assignment makes pointer from integer without a cast
make[1]: *** [semanageswig_wrap.lo] Error 1
make[1]: Leaving directory `/var/tmp/portage/sys-libs/libsemanage-2.0.27/work/libsemanage-2.0.27/src'
make: *** [pywrap] Error 2
emake failed
 * ERROR: sys-libs/libsemanage-2.0.27 failed (compile phase):
 *   (no error message)
 * 
 * Call stack:
 *     ebuild.sh, line  56:  Called src_compile
 *   environment, line 4388:  Called die
 * The specific snippet of code:
 *       emake PYLIBVER="python$(python_get_version)" pywrap || die
 * 
 * If you need support, post the output of 'emerge --info =sys-libs/libsemanage-2.0.27',
 * the complete build log and the output of 'emerge -pqv =sys-libs/libsemanage-2.0.27'.
 * The complete build log is located at '/var/tmp/portage/sys-libs/libsemanage-2.0.27/temp/build.log'.
 * The ebuild environment file is located at '/var/tmp/portage/sys-libs/libsemanage-2.0.27/temp/environment'.
 * S: '/var/tmp/portage/sys-libs/libsemanage-2.0.27/work/libsemanage-2.0.27'

>>> Failed to emerge sys-libs/libsemanage-2.0.27

To work around:

# eselect python list
Available Python interpreters:
  [1]   python2.6
  [2]   python3.1 *
# eselect python set 1
# emerge libselinux libsemanage

The drawback to this workaround is as soon as you change the default interpreter back to 3.x these packages will be picked up by python-updater.

Portage Errors: app-emulation/xen-tools check_python FAILED

You may run into something like this while updating or installing your Xen platform:

>>> Emerging (1 of 3) app-emulation/xen-tools-4.1.0-r1
* xen-4.1.0.tar.gz RMD160 SHA1 SHA256 size ;-) ...                                   [ ok ]
* Package:    app-emulation/xen-tools-4.1.0-r1
* Repository: gentoo
* Maintainer: xen@gentoo.org
* USE:        acm elibc_glibc flask kernel_linux pygrub userland_GNU x86
* FEATURES:   sandbox
>>> Unpacking source...
>>> Unpacking xen-4.1.0.tar.gz to /var/tmp/portage/app-emulation/xen-tools-4.1.0-r1/work
>>> Source unpacked in /var/tmp/portage/app-emulation/xen-tools-4.1.0-r1/work
>>> Preparing source in /var/tmp/portage/app-emulation/xen-tools-4.1.0-r1/work/xen-4.1.0 ...
* Applying xen-tools-3.4.0-network-bridge-broadcast.patch ...                        [ ok ]
* Applying xen-tools-3.3.0-nostrip.patch ...                                         [ ok ]
>>> Source prepared.
>>> Configuring source in /var/tmp/portage/app-emulation/xen-tools-4.1.0-r1/work/xen-4.1.0 ...
>>> Source configured.
>>> Compiling source in /var/tmp/portage/app-emulation/xen-tools-4.1.0-r1/work/xen-4.1.0 ...
make -j2 -C tools
make: Entering directory `/var/tmp/portage/app-emulation/xen-tools-4.1.0-r1/work/xen-4.1.0/tools'
make[1]: Entering directory `/var/tmp/portage/app-emulation/xen-tools-4.1.0-r1/work/xen-4.1.0/tools'
make -C check all
make[2]: Entering directory `/var/tmp/portage/app-emulation/xen-tools-4.1.0-r1/work/xen-4.1.0/tools/check'
PYTHON=python LIBXENAPI_BINDINGS=n ACM_SECURITY=y ./chk build
Xen CHECK-BUILD  Mon Apr 11 16:19:03 EDT 2011
Checking check_crypto_lib: OK
Checking check_curl: unused, OK
Checking check_openssl_devel: OK
Checking check_python:
*** check_python FAILED: need python version >= 2.2
Checking check_python_devel: OK
Checking check_uuid_devel: OK
Checking check_xgettext: OK
Checking check_xml2: OK
Checking check_zlib_devel: OK
Checking check_zlib_lib: OK
make[2]: *** [check-build] Error 1
make[2]: Leaving directory `/var/tmp/portage/app-emulation/xen-tools-4.1.0-r1/work/xen-4.1.0/tools/check'
make[1]: *** [subdir-all-check] Error 2
make[1]: Leaving directory `/var/tmp/portage/app-emulation/xen-tools-4.1.0-r1/work/xen-4.1.0/tools'
make: *** [subdirs-all] Error 2
make: Leaving directory `/var/tmp/portage/app-emulation/xen-tools-4.1.0-r1/work/xen-4.1.0/tools'
emake failed
* ERROR: app-emulation/xen-tools-4.1.0-r1 failed (compile phase):
*   compile failed
*
* Call stack:
*     ebuild.sh, line  56:  Called src_compile
*   environment, line 4879:  Called die
* The specific snippet of code:
*       emake -C tools ${myopt} || die "compile failed";
*
* If you need support, post the output of 'emerge --info =app-emulation/xen-tools-4.1.0-r1',
* the complete build log and the output of 'emerge -pqv =app-emulation/xen-tools-4.1.0-r1'.
* The complete build log is located at '/var/tmp/portage/app-emulation/xen-tools-4.1.0-r1/temp/build.log'.
* The ebuild environment file is located at '/var/tmp/portage/app-emulation/xen-tools-4.1.0-r1/temp/environment'.
* S: '/var/tmp/portage/app-emulation/xen-tools-4.1.0-r1/work/xen-4.1.0'
 
>>> Failed to emerge app-emulation/xen-tools-4.1.0-r1, Log file:
 
>>>  '/var/tmp/portage/app-emulation/xen-tools-4.1.0-r1/temp/build.log'
 
* Messages for package app-emulation/xen-tools-4.1.0-r1:
 
* ERROR: app-emulation/xen-tools-4.1.0-r1 failed (compile phase):
*   compile failed
*
* Call stack:
*     ebuild.sh, line  56:  Called src_compile
*   environment, line 4879:  Called die
* The specific snippet of code:
*       emake -C tools ${myopt} || die "compile failed";
*
* If you need support, post the output of 'emerge --info =app-emulation/xen-tools-4.1.0-r1',
* the complete build log and the output of 'emerge -pqv =app-emulation/xen-tools-4.1.0-r1'.
* The complete build log is located at '/var/tmp/portage/app-emulation/xen-tools-4.1.0-r1/temp/build.log'.
* The ebuild environment file is located at '/var/tmp/portage/app-emulation/xen-tools-4.1.0-r1/temp/environment'.
* S: '/var/tmp/portage/app-emulation/xen-tools-4.1.0-r1/work/xen-4.1.0'

The problem is due to Xen’s check-build not recognizing your Python 3x installation as “greater than or equal to 2.2.” You can resolve this by temporarily switching your Python profile:

# eselect python list
Available Python interpreters:
  [1]   python2.4
  [2]   python2.5
  [3]   python2.6
  [4]   python3.1 *
# eselect python set 3

It might be advisable to run python-updater and any other updates you have before compiling xen-tools with python2x; once you switch back to the latest version of python xen-tools will be picked up by python-updater and fail to compile.

For more information please see my bug report at http://bugs.gentoo.org/show_bug.cgi?id=363299

Return top
foxpa.ws
Online Marketing Toplist
Internet
Technology Blogs - Blog Rankings

Internet Blogs - BlogCatalog Blog Directory

Technology blogs
Bad Karma Networks

Please Donate!


Made in Canada  •  There's a fox in the Gibson!  •  2010-12