Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

brew install fails because sudo chef-client #111

Closed
arukaen opened this issue Nov 10, 2016 · 3 comments
Closed

brew install fails because sudo chef-client #111

arukaen opened this issue Nov 10, 2016 · 3 comments

Comments

@arukaen
Copy link

arukaen commented Nov 10, 2016

Cookbook version

2.1.2

Chef-client version

12.5.1

Platform Details

Mac OSX

Scenario:

Bootstrapping a new node fails when I attempt to install packages because chef-client is running as sudo/root and as of November 1st, 2016 Homebrew has disabled running brew with root. This also occurs even when I have default['homebrew']['owner'] = 'my username'

Homebrew/brew@eabdbde

Steps to Reproduce:

bootstrap a node or sudo chef-client with a recipe that installs a package using brew.

@bcg62
Copy link
Contributor

bcg62 commented Nov 10, 2016

I have hit this in other circumstances. Some brew cask installs have sudo embedded like wireshark:

/usr/bin/sudo -E -- /usr/sbin/installer -pkg #<Pathname:/usr/local/Caskroom/wireshark/2.2.1/Wireshark 2.2.1 Intel 64.pkg> -target /

The work around used to be having chef run the install as root to negate the sudo call.

This now fails with

"Error: Running Homebrew as root is extremely dangerous and no longer supported.
As Homebrew does not drop privileges on installation you would be giving all
build scripts full access to your system."

Once you remove this and install as the current user brew blows up expecting a tty to be available to prompt for a password

==> Failed command:
/usr/bin/sudo -E -- /usr/sbin/installer -pkg #<Pathname:/usr/local/Caskroom/wireshark/2.2.1/Wireshark 2.2.1 Intel 64.pkg> -target /

==> Standard Output of failed command:


==> Standard Error of failed command:
sudo: no tty present and no askpass program specified

I'm not sure how to approach this, see other discussions here

Homebrew/brew#1476
Homebrew/homebrew-cask#5667
Homebrew/homebrew-cask#19180

@bcg62
Copy link
Contributor

bcg62 commented Apr 12, 2017

quick update, you can currently work around this outright failing by creating a sudo askpass script similar to this https://github.com/markcarver/mac-ssh-askpass and then setting it in your environment with $SUDO_ASKPASS - granted this will display a pop up to the user for their sudo password in the middle of a chef run... not ideal but it's enough for now

@tas50
Copy link
Contributor

tas50 commented Apr 20, 2017

Closing as a dupe of #105

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants