Bug 1440148 - common-ha (debian/ubuntu): ganesha-ha.sh has a hard-coded /usr/libexec/ganesha...
Summary: common-ha (debian/ubuntu): ganesha-ha.sh has a hard-coded /usr/libexec/ganesh...
Keywords:
Status: CLOSED CURRENTRELEASE
Alias: None
Product: GlusterFS
Classification: Community
Component: common-ha
Version: 3.10
Hardware: Unspecified
OS: Unspecified
unspecified
unspecified
Target Milestone: ---
Assignee: Kaleb KEITHLEY
QA Contact:
URL:
Whiteboard:
Depends On:
Blocks: glusterfs-3.10.2
TreeView+ depends on / blocked
 
Reported: 2017-04-07 11:56 UTC by Kaleb KEITHLEY
Modified: 2017-05-31 20:44 UTC (History)
4 users (show)

Fixed In Version: glusterfs-3.10.2
Doc Type: If docs needed, set a value
Doc Text:
Clone Of:
Environment:
Last Closed: 2017-05-31 20:44:07 UTC
Regression: ---
Mount Type: ---
Documentation: ---
CRM:
Verified Versions:
Embargoed:


Attachments (Terms of Use)

Description Kaleb KEITHLEY 2017-04-07 11:56:40 UTC
Description of problem:

Debian-based systems do not use /usr/libexec

Version-Release number of selected component (if applicable):


How reproducible:


Steps to Reproduce:
1.
2.
3.

Actual results:


Expected results:


Additional info:

Comment 1 Kaleb KEITHLEY 2017-04-07 12:00:32 UTC
[07:47:19] <Skinny> I removed the rhel7_config function to test 
[07:47:25] <Skinny> the only error remaining is :  /usr/lib/x86_64-linux-gnu/ganesha/ganesha-ha.sh: Syntax error: redirection unexpected
[07:47:32] <Skinny> around line 242

Comment 2 Kaleb KEITHLEY 2017-04-07 12:04:43 UTC
<Skinny> I think I found it
<Skinny> you have 1 min to confirm my toughts ?
<Skinny> running the ganesha-ha.sh script from the ubuntu command line manually will run just fine (within bash)
<Skinny> however from within the glusterd deamon, the script is executed with a 'sh -c' call
<Skinny> which will override the used shell
<Skinny> the default shell on ubuntu is dash
<Skinny> and that doesnt have the <<< operator
<Skinny> used in the scripts (for logging)
<Skinny> that's the line failing with the 'redirection' error
<kkeithley> but ganesha.ha has shebang /bin/bash
<Skinny> http://stackoverflow.com/a/2462357
<glusterbot> Title: ubuntu - Bash: Syntax error: redirection unexpected - Stack Overflow (at stackoverflow.com)
<Skinny> read that answer (3th comment)
<Skinny> sh 'script' will use 'sh' instead of the shell in the file

Comment 3 Kaleb KEITHLEY 2017-04-07 12:11:21 UTC
<Skinny> resetting ubuntu to use bash at the default shell
<Skinny> fixes this error
<Skinny> just tested it
<Skinny> on to the next one : '[2017-04-07 12:05:01.381485] E [MSGID: 106471] [glusterd-ganesha.c:159:manage_service] 0-management: Could not start NFS-Ganesha.Service manager for distro not recognized.'
--> nishanth (nthomas@nat/redhat/x-ufxtckzgtoeotfuu) has joined #gluster
<Skinny> fixed by (for now symlinking /bin/systemctl to /usr/bin/systemctl)
<Skinny> the locations checked in 'manage_service' dont look in the ubuntu location which is /bin/systemctl

Comment 4 Mark Gerrits 2017-04-07 12:11:47 UTC
also the 'manage_service' function in \xlators\mgmt\glusterd\src\glusterd-ganesha.c doesn't check the default ubuntu location for systemctl which is /bin/systemctl (instead of /usr/bin/systemctl).

I worked around this by creating a symlink

Comment 5 Mark Gerrits 2017-04-07 12:12:08 UTC
(In reply to Mark Gerrits from comment #4)
> also the 'manage_service' function in
> \xlators\mgmt\glusterd\src\glusterd-ganesha.c doesn't check the default
> ubuntu location for systemctl which is /bin/systemctl (instead of
> /usr/bin/systemctl).
> 
> I worked around this by creating a symlink

someone beat me to it :)

Comment 6 Worker Ant 2017-04-07 13:49:06 UTC
REVIEW: https://review.gluster.org/17013 (common-ha: fixes for Debian-based systems) posted (#1) for review on release-3.10 by Kaleb KEITHLEY (kkeithle)

Comment 7 Worker Ant 2017-04-07 14:44:15 UTC
REVIEW: https://review.gluster.org/17013 (common-ha: fixes for Debian-based systems) posted (#2) for review on release-3.10 by Kaleb KEITHLEY (kkeithle)

Comment 8 Worker Ant 2017-04-13 15:38:00 UTC
COMMIT: https://review.gluster.org/17013 committed in release-3.10 by Shyamsundar Ranganathan (srangana) 
------
commit e93e89b2e46033efa22447943269000c85588254
Author: Kaleb S. KEITHLEY <kkeithle>
Date:   Fri Apr 7 09:09:29 2017 -0400

    common-ha: fixes for Debian-based systems
    
    1) Debian-based systems don't have /usr/libexec/... and there is
    a hard-coded invocation of /usr/libexec/ganesha/ganesha-ha.sh within
    ganesha-ha.sh itself.
    Fix: save $0 and use it instead for further invocations of self.
    
    2) default shell is /bin/dash (not /bin/bash). Various runner_run()
    invocations for ganesha used what amounts to
      exec("sh /usr/$libexec/ganesha/ganesha-ha.sh ...);
    which executes the script using the default shell, but there are
    some bash-specific idioms that don't work if the shell is dash.
    Fix: change to exec("/usr/$libexec/ganesha/ganesha-ha.sh ...); so that
    the shebang forces the use of /bin/bash
    
    3) Fedora and RHEL7 have merged /bin/ and /usr/bin, /bin is a symlink
    to /usr/bin. Debian-based systems are not merged, and systemd systems
    have /bin/systemctl. The logic to find .../bin/systemctl is backwards.
    If the logic looks for /usr/bin/systemctl it will not find it on
    Debian-based systems; if it looks for /bin/systemctl it will find it
    on Fedora and RHEL by virtue of the symlink. (RHEL6 and others will
    find their respective init regardless.)
    Fix: change the logic to look for /bin/systemctl instead.
    
    4) The logic for deciding to run systemctl (or not) is a bit silly.
    Fix: simply invoke the found method via the function pointer in the
    table.
    
    Change-Id: I33681b296a73aebb078bda6ac0d3a1d3b9770a21
    BUG: 1440148
    Signed-off-by: Kaleb S. KEITHLEY <kkeithle>
    Reviewed-on: https://review.gluster.org/17013
    Smoke: Gluster Build System <jenkins.org>
    Reviewed-by: Niels de Vos <ndevos>
    NetBSD-regression: NetBSD Build System <jenkins.org>
    CentOS-regression: Gluster Build System <jenkins.org>
    Reviewed-by: jiffin tony Thottan <jthottan>

Comment 9 Raghavendra Talur 2017-05-31 20:44:07 UTC
This bug is getting closed because a release has been made available that should address the reported issue. In case the problem is still not fixed with glusterfs-3.10.2, please open a new bug report.


Note You need to log in before you can comment on or make changes to this bug.