This port is non-functional after installation. 1. File permissions are incorrect. At runtime, the port needs write access as the riak user ('riak') to the RIAK_HOMEDIR, RIAK_DBDIR, RIAK_LOGDIR, and RIAK_LIBDIR. By default these are owned by root/wheel. 2. The installed file /usr/local/lib/riak/lib/env.sh was recently (1.4.9 perhaps) modified to use su instead of sudo, but linux command line options (specifically -c) are hard coded, and the entire command is quoted which results in it being interpreted as a path to a file with spaces rather than a command with arguments. This prevents all riak-admin commands from functioning, and perhaps others as well. ----- quick (probably incorrect) fixes 1. Change ownership for all of these directories to the riak user/group. Testing this change via @owner and @group directives in pkg-plist was successful, but probably has security consequences for the system as a whole. 2. Create a patch to change this 'su' command back to 'sudo' and add sudo as a requirement for the port ..OR.. remove the '-c' and quotes. The first option is preferable in order to preserve the quoting which is required in some cases, but I've only tested the second, and it works in limited testing.
Auto-assigned to maintainer robak@freebsd.org
Hi, do you have a patch to test to solve the issues you're describing?
Created attachment 149642 [details] svn diff of pkg-plist
Created attachment 149643 [details] env.sh patch
Two patch files are now attached. pkg-plist.patch is an svn diff of the change to pkg-plist. As I mentioned, this is probably not the right way to do this, since it changes the ownership of far more than is strictly required. I think a better option here is to chage the RIAK_HOMEDIR to something more traditional (e.g. /home/riak), and then setup everything (libs, logs -- all of it) to install there. I don't personally have the time to try and figure out the precise permissions riak needs, or find all the spots where the RIAK_HOMEDIR macro should be used but is not -- I do know that just changing that results in a failure to build, probably because of hard coded paths to the lib dir. env.sh.patch is a normal unidiff of a post-install /usr/local/lib/riak/lib/env.sh with the 'simple' fix created. This also is probably not the "right" way to do this. It might not work if there are spaces in the argument list, and honestly, the whole su/sudo subshell thing seems like a security risk to me. If possible I think that whole thing should be changed to just exit if it's not running as the right user, and instruct the end user to run the command as the proper user to begin with. That's an issue for the actual authors though, it's not FreeBSD specific. The patched issue here is that the linux sh(1) -c argument doesn't mean the same thing on FreeBSD. This is not a problem when using sudo, as it used to.
I've tested patch ready with update to 1.4.12 and fixes for the startup issue due to the bad rights to certain paths that I will commit soon. However, I cant reproduce the riak-admin issue you're mentioning - I have tried number of riak-admin commands (like test, top and diag) and all of them worked as expected. Are you sure its not something in your setup? Can you reproduce it on freshly built 10.1-RELEASE system? Kind regards, Bartek Rutkowski
A commit references this bug: Author: robak Date: Sat Feb 21 20:39:35 UTC 2015 New revision: 379548 URL: https://svnweb.freebsd.org/changeset/ports/379548 Log: databases/riak: update 1.4.10 -> 1.4.12 - Fix issue with starting Riak due to incorrect dirs ownership PR: 195220 Changes: head/databases/riak/Makefile head/databases/riak/distinfo head/databases/riak/pkg-plist
Thanks for your problem report! I've committed the update to the port that contains the fix for the issue I could reproduce. Kind regards, Bartek Rutkowski