fm-mgr fails on debian due to init.d differences

Bug #1963296 reported by Al Bailey
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
StarlingX
Fix Released
Medium
Gerry Kopec

Bug Description

Debian issue for fm-mgr and fm-api.

The init.d for fm-mgr is trying to source a file that does not exist on debian, and use a method that does not exist in the debian-equivalent for the lsb initialization.

The file needs to be updated to work on both.

Proposed fix is to modify these two files
https://github.com/starlingx/fault/blob/master/fm-mgr/sources/fminit
https://github.com/starlingx/fault/blob/master/fm-rest-api/fm/scripts/fm-api

We simply need to add a detection to the top of the file, to know if we are debian or centos
and source the appropriate file, and use the appropriate 'status' method.

Note: /lib/lsb does not exist on centos so the following code seems to work without affecting a centos env

Change this line:
. /etc/init.d/functions

to:

CENTOS_FUNCTIONS="/etc/init.d/functions"
DEBIAN_FUNCTIONS="/lib/lsb/init-functions"
if [ -f ${DEBIAN_FUNCTIONS} ] ; then
    STATUS_FUNC=status_of_proc
    . ${DEBIAN_FUNCTIONS}
else
    STATUS_FUNC=status
    . ${CENTOS_FUNCTIONS}
fi

NOTE: this example is for fm-mgr. the status method for fm-api may be sufficient already.

change the 3 places in the fminit file (2 places in stop, one place in status) from:
   status ${FMMGR_NAME} >/dev/null
to:
   ${STATUS_FUNC} ${FMMGR_NAME} >/dev/null

Revision history for this message
Al Bailey (albailey1974) wrote :

The init script for fm-api should also be updated similarly:

https://github.com/starlingx/fault/blob/master/fm-rest-api/fm/scripts/fm-api

description: updated
description: updated
Revision history for this message
Dan Voiculeasa (dvoicule) wrote :

We could just add one line to /lib/lsb/init-functions, this way we don't have to modify the lsb scripts.
status() { status_of_proc $@; };

Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix proposed to integ (master)

Fix proposed to branch: master
Review: https://review.opendev.org/c/starlingx/integ/+/832752

Changed in starlingx:
status: New → In Progress
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix proposed to tools (master)

Fix proposed to branch: master
Review: https://review.opendev.org/c/starlingx/tools/+/834589

Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix merged to integ (master)

Reviewed: https://review.opendev.org/c/starlingx/integ/+/832752
Committed: https://opendev.org/starlingx/integ/commit/9d2572980ad60b7c6b783c2dd27929fe6df6abef
Submitter: "Zuul (22348)"
Branch: master

commit 9d2572980ad60b7c6b783c2dd27929fe6df6abef
Author: Gerry Kopec <email address hidden>
Date: Thu Mar 17 12:47:07 2022 -0400

    debian: Add status method to lsb for centos compatibility

    In debian builds, patch lsb-base package to add method to
    /lib/lsb/init-functions to wrap status calls to use correct method
    status_of_proc()

    This fixes fm-mgr service failing to recover on host unlock on debian.

    Test Plan:
    PASS: Package builds and install successfully with debian build
    PASS: fm-mgr service recovers on host unlock on debian on AIO-SX
    PASS: No impact on centos build, install or provisioning of AIO-SX

    Closes-Bug: 1963296
    Signed-off-by: Gerry Kopec <email address hidden>
    Change-Id: I607c4b3b6ed8aaaff2654e97d0baa826c57741a2

Changed in starlingx:
status: In Progress → Fix Released
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix merged to tools (master)

Reviewed: https://review.opendev.org/c/starlingx/tools/+/834589
Committed: https://opendev.org/starlingx/tools/commit/9911b7a09e7f2f95cf86aae91b888a2382a98e7f
Submitter: "Zuul (22348)"
Branch: master

commit 9911b7a09e7f2f95cf86aae91b888a2382a98e7f
Author: Gerry Kopec <email address hidden>
Date: Mon Mar 21 23:08:22 2022 -0400

    debian: Update base-bullseye & stx-std for lsb

    Update package lists as lsb package will now be built & patched.

    Test Plan:
    PASS: Build iso in debian, install successfully

    Partial-Bug: 1963296
    Depends-On: https://review.opendev.org/c/starlingx/integ/+/832752
    Signed-off-by: Gerry Kopec <email address hidden>
    Change-Id: Ie308600e9a3c13823779dd36df49b0d9b927c15c

Ghada Khalil (gkhalil)
tags: added: stx.7.0 stx.debian stx.fault
Changed in starlingx:
assignee: nobody → Gerry Kopec (gerry-kopec)
importance: Undecided → Medium
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix proposed to utilities (master)

Fix proposed to branch: master
Review: https://review.opendev.org/c/starlingx/utilities/+/835115

Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix merged to utilities (master)

Reviewed: https://review.opendev.org/c/starlingx/utilities/+/835115
Committed: https://opendev.org/starlingx/utilities/commit/ee19884f512ee9f7550954c6cd00b5885b93e05c
Submitter: "Zuul (22348)"
Branch: master

commit ee19884f512ee9f7550954c6cd00b5885b93e05c
Author: Gerry Kopec <email address hidden>
Date: Thu Mar 24 14:14:32 2022 -0400

    debian: remove workaround resolved by lsb patch

    With patching of status_of_proc wrapper in lsb-base package, we can
    remove workaround UAR 46.

    Test Plan
    PASS: fm-mgr and open-ldap services recover on host unlock

    Partial-Bug: 1963296
    Depends-On: https://review.opendev.org/c/starlingx/integ/+/832752
    Signed-off-by: Gerry Kopec <email address hidden>
    Change-Id: Id793761c4b453955dd0a9389a7572b09b61bebe1

To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.