Note: This bug is displayed in read-only format because the product is no longer active in Red Hat Bugzilla.

Bug 1162646

Summary: Starting rhqctl as a service script not correct in documentation
Product: [JBoss] JBoss Operations Network Reporter: Ken Hitchcock <ken.hitchcock>
Component: DocumentationAssignee: Tyler Kelly <tkelly>
Status: CLOSED CURRENTRELEASE QA Contact: Mike Foley <mfoley>
Severity: medium Docs Contact:
Priority: high    
Version: JON 3.2, JON 3.3.0CC: dsteigne, fbrychta, loleary, mmahoney, mshirley, tkelly
Target Milestone: post-GAKeywords: Documentation, Reopened, Triaged
Target Release: JON 3.3.0   
Hardware: All   
OS: Linux   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
[Install_Guide] Needs to be reworked with info from KBase, in both the Installation Guide and Admin Config Guide.
Last Closed: 2017-07-14 01:56:17 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:

Description Ken Hitchcock 2014-11-11 12:19:45 UTC
Document URL: 
https://access.redhat.com/documentation/en-US/Red_Hat_JBoss_Operations_Network/3.2/pdf/Installation_Guide/Red_Hat_JBoss_Operations_Network-3.2-Installation_Guide-en-US.pdf

Section Number and Name: 
2.7 point 6

Describe the issue: 
the command below fails to start the jon services. 
su - jboss -c "/etc/init.d/rhqctl $*" &

Suggestions for improvement: 
The command needs to specify the shell to start
su - jboss -s /bin/bash -c "/etc/init.d/rhqctl $*" &

This is described in 
https://access.redhat.com/solutions/353603

Please note that this resolution says to use the /bin/sh shell, this wont work for the jon rhqctl script as its /bin/bash

Additional information:

Comment 1 Jared MORGAN 2014-11-12 05:49:24 UTC
(In reply to Ken Hitchcock from comment #0)
> Document URL: 
> https://access.redhat.com/documentation/en-US/
> Red_Hat_JBoss_Operations_Network/3.2/pdf/Installation_Guide/
> Red_Hat_JBoss_Operations_Network-3.2-Installation_Guide-en-US.pdf
> 
> Section Number and Name: 
> 2.7 point 6
> 
> Describe the issue: 
> the command below fails to start the jon services. 
> su - jboss -c "/etc/init.d/rhqctl $*" &
> 
> Suggestions for improvement: 
> The command needs to specify the shell to start
> su - jboss -s /bin/bash -c "/etc/init.d/rhqctl $*" &
> 
> This is described in 
> https://access.redhat.com/solutions/353603
> 
> Please note that this resolution says to use the /bin/sh shell, this wont
> work for the jon rhqctl script as its /bin/bash
> 
> Additional information:

Thanks for reporting this Ken, and for providing the detail you did: it's fantastic! 

I've put this correction into the Installation Guide and it will be in the JON 3.3 version of the docs when the product releases.

Comment 4 Larry O'Leary 2015-01-14 01:50:09 UTC
This doesn't actually fix this issue. I am not sure what the intention was with the original suggested fix but the problem here is not that you need to specify the shell -- although that would be the case if you used a user account that had no shell so is probably a good idea none the less -- but that the script is calling itself. The instructions do not really make any sense at all. Furthermore, the latest iteration doesn't even make mention in the installation guide of where the /etc/init.d/rhqctl comes from.

These same bad instructions are also found in the administration guide so the fix needs to be made in all places and be consistent. To be clear, the 3.2/3.3 documentation is suggesting that the user copy the rhqctl file from <JON_SERVER_HOME>/bin/ to /etc/init.d and then modify /etc/init.d/rhqctl and add the following line to the top:

    su - jboss -c "/etc/init.d/rhqctl $*" &

Which will result in the script calling itself recursively. Even if you add the shell as suggested in comment 0:

    su - jboss -s /bin/bash -c "/etc/init.d/rhqctl $*" &

Again, calling itself recursively. 

This entire process needs to be cleaned up. Because JBoss ON is not providing the script necessary to run as a Sys V service, the only option I see is to provide a notice indicating that a custom script can be created that invokes rhqctl with the desired user and settings. For an example, see knowlegebase solution https://access.redhat.com/solutions/772163.

Comment 5 Jared MORGAN 2015-02-05 01:12:20 UTC
(In reply to Larry O'Leary from comment #4)
> This doesn't actually fix this issue. I am not sure what the intention was
> with the original suggested fix but the problem here is not that you need to
> specify the shell -- although that would be the case if you used a user
> account that had no shell so is probably a good idea none the less -- but
> that the script is calling itself. The instructions do not really make any
> sense at all. Furthermore, the latest iteration doesn't even make mention in
> the installation guide of where the /etc/init.d/rhqctl comes from.
> 
> These same bad instructions are also found in the administration guide so
> the fix needs to be made in all places and be consistent. To be clear, the
> 3.2/3.3 documentation is suggesting that the user copy the rhqctl file from
> <JON_SERVER_HOME>/bin/ to /etc/init.d and then modify /etc/init.d/rhqctl and
> add the following line to the top:
> 
>     su - jboss -c "/etc/init.d/rhqctl $*" &
> 
> Which will result in the script calling itself recursively. Even if you add
> the shell as suggested in comment 0:
> 
>     su - jboss -s /bin/bash -c "/etc/init.d/rhqctl $*" &
> 
> Again, calling itself recursively. 
> 
> This entire process needs to be cleaned up. Because JBoss ON is not
> providing the script necessary to run as a Sys V service, the only option I
> see is to provide a notice indicating that a custom script can be created
> that invokes rhqctl with the desired user and settings. For an example, see
> knowlegebase solution https://access.redhat.com/solutions/772163.

Thanks for this detail Larry. I'm going to look at fixing this for 3.3.1. In both guides.

Comment 7 Scott Mumford 2015-09-03 00:46:58 UTC
Taking ownership of JON docs bugs.

Comment 8 Tyler Kelly 2017-06-14 06:11:36 UTC
This step appears to have been removed from the docs between version 3.2 and 3.3.

Note found in the commented out step:
Removed as per advice that JON should not be run as root user. Tested installing and running jon-server-3.3.0.GA dist as regular user without issue.

As the process works for standard user accounts, it does not appear to be necessary to reintroduce this section in 3.3.

Comment 9 Filip Brychta 2017-06-26 08:55:43 UTC
To avoid confusion between this bz and bz1309482 I would suggest following:
1) Installation guide 3.2: 
Step 6. "Edit the rhqctl control script...", this step should be removed because it's incorrect and a note saying that it's not recommended to run JON under root user should be added. Plus a link to administration guide (Configuring JON Servers and Agents) to section "Running the JBoss ON Server as a Service" which is not correct either and must be fixed according to https://access.redhat.com/solutions/772163 (comment 4).

2) Installation guide 3.3:
Step 6 is no longer there so just add a note as a optional step with a link to administration guide "Running the JBoss ON Server as a Service" which must be fixed according to https://access.redhat.com/solutions/772163 (comment 4)

3) Close bz1309482 as duplicate of this bz

4) Create new bz for fixes described in https://bugzilla.redhat.com/show_bug.cgi?id=1309482#c1

Comment 10 Tyler Kelly 2017-06-27 07:36:55 UTC
*** Bug 1309482 has been marked as a duplicate of this bug. ***

Comment 11 Tyler Kelly 2017-06-27 08:49:22 UTC
changes per Bug 1162646:
incl. incorporation of https://access.redhat.com/solutions/772163 into Admin doc and adding note install guide referring to admin doc for running JON as a service and a further note not to run JON as a root user.

1 - JON 3.2:
Git Commit:
https://gitlab.cee.redhat.com/tkelly/jon_pre33/commit/8b3ee44d12fc410def0eee2a283a1ebe7c5dff36

Git Merge:
https://gitlab.cee.redhat.com/red-hat-jboss-operations-network-documentation/jon_pre33/merge_requests/6

Pantheon Previews:
Config guide:
https://access.qa.redhat.com/documentation/en-us/red_hat_jboss_operations_network/3.2/html-single/admin_and_config/#running-jon-as-a-service

Install guide (not checked due to pantheon issues late in the afternoon/evening, but passed local build):
https://access.qa.redhat.com/documentation/en-us/red_hat_jboss_operations_network/3.2/html-single/installation_guide/#install-rhel-jar

2 JON 3.3:
Git Commit:
https://gitlab.cee.redhat.com/tkelly/doc-jon-docs/commit/ee1985c7ffd12926e774d0334eb806b11c5cdbfc

Git Merge:
https://gitlab.cee.redhat.com/red-hat-jboss-operations-network-documentation/doc-jon-docs/merge_requests/29

Pantheon Previews:
Config guide:
https://access.qa.redhat.com/documentation/en-us/red_hat_jboss_operations_network/3.3/html-single/admin_and_config/#running-jon-as-a-service

Install guide:
https://access.qa.redhat.com/documentation/en-us/red_hat_jboss_operations_network/3.3/html-single/installation_guide/#install-rhel-jar

3: Done
4: https://bugzilla.redhat.com/show_bug.cgi?id=1465306

Comment 12 Tyler Kelly 2017-06-27 21:58:19 UTC
Install Guide now building on pantheon.