soloist icon indicating copy to clipboard operation
soloist copied to clipboard

Soloist is incompatible with the homebrew cookbook because it forces you to run as root

Open hazeledmands opened this issue 11 years ago • 5 comments

From the readme for the opscode-cookbooks/homebrew repository:

it's anticipated that you'll run the cookbook as your own user

...and if you use soloist to install any homebrew packages:

ShellCommandFailed: Expected process to exit with [0], but received '1'
---- Begin output of brew install  phantomjs ----
STDOUT:
STDERR: Error: Cowardly refusing to `sudo brew install'
You can use brew with sudo, but only if the brew executable is owned by root.
However, this is both not recommended and completely unsupported so do so at
your own risk.
---- End output of brew install  phantomjs ----

I'm new enough to chef that I'm not sure what the best thing to do here is -- but maybe we should make it optional to run soloist as root?

hazeledmands avatar May 18 '13 15:05 hazeledmands

Well that's odd. Soloist totally runs as you, and so has the ability to harvest your user info before it sudoes anything. I'm wondering if there's some way of passing that through. @mkocher?

On Saturday, May 18, 2013, Max Edmands wrote:

From the readme for the opscode-cookbooks/homebrewhttps://github.com/opscode-cookbooks/homebrew#prerequisitesrepository:

it's anticipated that you'll run the cookbook as your own user

...and if you use soloist to install any homebrew packages:

ShellCommandFailed: Expected process to exit with [0], but received '1' ---- Begin output of brew install phantomjs ---- STDOUT: STDERR: Error: Cowardly refusing to `sudo brew install' You can use brew with sudo, but only if the brew executable is owned by root. However, this is both not recommended and completely unsupported so do so at your own risk. ---- End output of brew install phantomjs ----

I'm new enough to chef that I'm not sure what the best thing to do here is -- but maybe we should make it optional to run soloist as root?

— Reply to this email directly or view it on GitHubhttps://github.com/mkocher/soloist/issues/27 .

Doc Ritezel +1-415-601-5766

ohrite avatar May 18 '13 16:05 ohrite

@cunnie and I ran into this when we tried to switch Sprout over to the homebrew cookbook a couple of weeks ago.

It has to do with the way that the homebrew cookbook shells out.

At least in the case of Sprout, I think we'll want to keep sudo but find some other way to have the homebrew cookbook shell out as node['current_user']

On Saturday, May 18, 2013, Doc Ritezel wrote:

Well that's odd. Soloist totally runs as you, and so has the ability to harvest your user info before it sudoes anything. I'm wondering if there's some way of passing that through. @mkocher?

On Saturday, May 18, 2013, Max Edmands wrote:

From the readme for the opscode-cookbooks/homebrew< https://github.com/opscode-cookbooks/homebrew#prerequisites>repository:

it's anticipated that you'll run the cookbook as your own user

...and if you use soloist to install any homebrew packages:

ShellCommandFailed: Expected process to exit with [0], but received '1' ---- Begin output of brew install phantomjs ---- STDOUT: STDERR: Error: Cowardly refusing to `sudo brew install' You can use brew with sudo, but only if the brew executable is owned by root. However, this is both not recommended and completely unsupported so do so at your own risk. ---- End output of brew install phantomjs ----

I'm new enough to chef that I'm not sure what the best thing to do here is -- but maybe we should make it optional to run soloist as root?

— Reply to this email directly or view it on GitHub< https://github.com/mkocher/soloist/issues/27> .

Doc Ritezel +1-415-601-5766

— Reply to this email directly or view it on GitHubhttps://github.com/mkocher/soloist/issues/27#issuecomment-18103503 .

hiremaga avatar May 18 '13 16:05 hiremaga

@hiremaga, based on your suggestion I locally modified the homebrew cookbook's libraries/homebrew_package.rb from:

def brew(*args)
  get_response_from_command("brew #{args.join(' ')}")
end

to:

def brew(*args)
  get_response_from_command("su #{node['current_user']} -c 'brew #{args.join(' ')}'")
end

And it made everything work like a charm. Seems to go against their "it's anticipated that you'll run the cookbook as your own user" though, so I'm not sure if they'd accept this as a pull request...

hazeledmands avatar May 18 '13 17:05 hazeledmands

Fast forward to the year 2015. We just ran into this and burned 30 mins or so.

camelpunch avatar Dec 07 '15 16:12 camelpunch

@camelpunch - advice on how to fix this? I've been unable to get our soloist scripts working because of this issue.

weitzel926 avatar Dec 07 '15 20:12 weitzel926