Bug 219872 - devel/hadoop2 - kms.sh not working - files missing and permissions incorrect
Summary: devel/hadoop2 - kms.sh not working - files missing and permissions incorrect
Status: Closed FIXED
Alias: None
Product: Ports & Packages
Classification: Unclassified
Component: Individual Port(s) (show other bugs)
Version: Latest
Hardware: Any Any
: --- Affects Only Me
Assignee: Dmitry Sivachenko
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2017-06-08 20:23 UTC by sean.smith
Modified: 2017-06-09 17:06 UTC (History)
0 users

See Also:
bugzilla: maintainer-feedback? (demon)


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description sean.smith 2017-06-08 20:23:38 UTC
I am trying to setup HDFS encryption and need to use the included /usr/local/sbin/kms.sh script but it runs into several issues.  

1. First when running it:
# kms.sh

/usr/local/sbin/kms.sh
/usr/local/sbin/kms.sh: line 83: /usr/local/share/hadoop/kms/tomcat/bin/catalina.sh: Permission denied
/usr/local/sbin/kms.sh: line 83: exec: /usr/local/share/hadoop/kms/tomcat/bin/catalina.sh: cannot execute: Permission denied

I remedied this by running chmod +x /usr/local/share/hadoop/kms/tomcat/bin/catalina.sh 

2. When I run kms.sh I'm met by another error 
# kms.sh

The BASEDIR environment variable is not defined correctly
This environment variable is needed to run this program

I ran this to see what was happening in the script

# sh -x /usr/local/sbin/kms.sh 

and noticed that a script didn't exist 

...
+ exec /bin/catalina.sh
exec: /bin/catalina.sh: not found

I downloaded the catalina.sh script from a github repo - https://github.com/abridgett/pkg-hadoop/tree/master/share/hadoop/kms/tomcat/bin 

3. I ran it again
# sh -x /usr/local/sbin/kms.sh 

...
+ exec /bin/catalina.sh                                                                                                                                                                                            
Cannot find //bin/setclasspath.sh                                                                                                                                                                                  
This file is needed to run this program   

I add this file from the github page also

4. Final run

# kms.sh

kms.sh                                                                                                                                                                                
The BASEDIR environment variable is not defined correctly                                                                                                                                                          
This environment variable is needed to run this program 

At this point I don't know what to do to get this to run and running # sh -x /usr/local/sbin/kms.sh gives no more useful clues


# sh -x /usr/local/sbin/kms.sh
...
+ exec /bin/catalina.sh
Using CATALINA_BASE:   /
Using CATALINA_HOME:   /
Using CATALINA_TMPDIR: //temp
Using JRE_HOME:        /usr/local
Using CLASSPATH:       //bin/bootstrap.jar
Usage: catalina.sh ( commands ... )
commands:
  debug             Start Catalina in a debugger
  debug -security   Debug Catalina with a security manager
  jpda start        Start Catalina under JPDA debugger
  run               Start Catalina in the current window
  run -security     Start in the current window with security manager
  start             Start Catalina in a separate window
  start -security   Start in a separate window with security manager
  stop              Stop Catalina, waiting up to 5 seconds for the process to end
  stop n            Stop Catalina, waiting up to n seconds for the process to end
  stop -force       Stop Catalina, wait up to 5 seconds and then use kill -KILL if still running
  stop n -force     Stop Catalina, wait up to n seconds and then use kill -KILL if still running
  version           What version of tomcat are you running?
Note: Waiting for the process to end and use of the -force option require that $CATALINA_PID is defined
Comment 1 Dmitry Sivachenko freebsd_committer freebsd_triage 2017-06-08 21:52:27 UTC
This is bash script (see first line), so you can't run "sh -x ...", use "bash -x ..." instead.

I see the problem, I'll look at it tomorrow (unless you provide a patch :)
Comment 2 commit-hook freebsd_committer freebsd_triage 2017-06-09 13:57:42 UTC
A commit references this bug:

Author: demon
Date: Fri Jun  9 13:57:18 UTC 2017
New revision: 442991
URL: https://svnweb.freebsd.org/changeset/ports/442991

Log:
  Fix permissions for some scripts;
  install kms-env.sh and httpfs-env.sh with sane defaults;

  PR:		219872

Changes:
  head/devel/hadoop2/Makefile
  head/devel/hadoop2/files/httpfs-env.sh.in
  head/devel/hadoop2/files/kms-env.sh.in
  head/devel/hadoop2/pkg-plist
Comment 3 Dmitry Sivachenko freebsd_committer freebsd_triage 2017-06-09 13:58:51 UTC
I committed some fixes, try to update port and check if it helps.
Comment 4 sean.smith 2017-06-09 16:38:02 UTC
Hi,

I updated the port and "kms.sh start" appears to work now. :) Thank you.