XAPI Service unable to start , error : xapi dies but pid file exists.

XAPI Service unable to start , error : xapi dies but pid file exists.

book

Article ID: CTX214523

calendar_today

Updated On:

Description

XAPI Service unable to start.  It shows that the it already has a pid and is dead.

Looking at the logs xensource.log, you will find INTERNAL_ERROR as below:

  • xapi top-level caught exception: INTERNAL_ERROR: [ Xmlm.Make(String)(Buffer).Error(_, -372779099) ]
    Caught exception at toplevel: 'Xmlm.Make(String)(Buffer).Error(_, -372779099)'
  • This gives us an indication that XAPI is failing to start because it is unable to read the state.db correctly.
  • Checking the integrity of the DB with “xmllint --format /var/xapi/state.db” returns,

    xmllint --format /var/xapi/state.db
    /var/xapi/state.db:1: parser error : Input is not proper UTF-8, indicate encoding !
    Bytes: 0x94 0x94 0x22 0x20 9537" __mtime="513860953" HVM__boot_params="(('order' 'dc'))" HVM__boot_policy=
  • We can now tell that the DB has incorrect formatting or illegal characters.

Resolution

  1. Take a backup of the state.db under /var/xapi/  and remove the current state.db file as below:
cp /var/xapi/state.db /var/xapi/state.db-old
rm /var/xapi/state.db
  1. Then do a XAPI toolstack restart as below:
#xe-toolstack-restart
  1. This should bring the state.db file back in /var/xapi.  If not then the XAPI DB is corrupted, find what happened to the XAPI database.
  2. After adding the XenServer to the XenCenter, introduce the local storage :
 
# pvscan : Copy the UUID
# xe sr-introduce uuid=<UUID> type=lvm name-label=”Local storage” content-type=user
# ls -l /dev/disk/by-id/
# xe pbd-create sr-uuid=<UUID of the storage>
device-config:device=/dev/disk/by-id/scsi-<SCSI ID> host-uuid=<UUID OF THE HOST>
# xe pbd-plug uuid=<UUID obtained from above step>
  1. Create DVD drive and Removable storage as well.
  2. Create default templates : /opt/xensource/libexec/create_templates. 

Issue/Introduction

XAPI Service unable to start. It shows that the it already has a pid and is dead.