-
Notifications
You must be signed in to change notification settings - Fork 37
Use sudo for installation of problematic casks (e.g. pkg) #22
Comments
@phinze I'd be happy to take a stab at fixing this, any ideas for what needs to be done? |
Any update on this? I also have this problem. |
I've been looking into this issue as well...looks like it's being caused because you can't pass a password to sudo. Perhaps using visudo instead would be a better alternative, or maybe skipping sudo altogether as I don't believe that this solution is using sudo. However, I can't figure out what would be causing the sudo in here. Any help would be appreciated. Thanks! |
I've been searching through the issues on several different forks and there are a number of people running into this issue; it all seems to happen with any package that requires a sudo (VirtualBox, SublimeText, Xtrafinder) and I've yet to see anyone post any kind of solution so far. |
I don't think this should have to require sudo, is there a way we can test the install without it? Or is that something that's happening in the Cask? |
Through some experimentation I do believe that it's the sudo that is messing things up. Virtualbox does not need sudo to install through cask, however sublime-text does (because it's trying to symlink into /usr/local/bin). So I think if there's a way to dodge that sudo we can get most of these working. |
I'm pretty sure Boxen has a way to run as a privileged user, so rather than invoking cc/ @dgoodlad Any ideas / suggestions? |
Puppet's See https://github.com/phinze/puppet-brewcask/blob/master/lib/puppet/provider/package/brewcask.rb#L87 and https://github.com/puppetlabs/puppet/blob/master/lib/puppet/util/execution.rb#L143 In fact, we could probably modify https://github.com/phinze/puppet-brewcask/blob/master/lib/puppet/provider/package/brewcask.rb#L82-L84 to handle special cases... |
Just tried switching over my personal manifests to installing from homebrew-cask with the latest puppet-boxen release and I'm hitting this issue on a few of my apps. |
I'd rather see a change being made in brewcask itself, so puppet knows when it's really necessary to use sudo/different uid. It can be even detected right now by puppet, but the solution would probably waste some time & resources trying first installing the cask with standard uid and then installing the cask again with sudo: @petems I'd rather not install all casks with sudo, it would be like killing a bee with a hammer. |
This is a good idea! If we added these details to the output of |
@phinze Opened issue: Homebrew/homebrew-cask#8817 |
no problem with brewcask/virtualbox This issue can be closed |
@julienlavergne Do you mean you're not having this problem any more? Can you elaborate on how it was fixed? (Is the Virtualbox installer itself no longer requiring sudo?) Or was this issue closed by @johndbritton just while we wait for upstream to merge Homebrew/homebrew-cask#8817 or similar? If someone could point me to the fix, it'd be much appreciated. |
Is this bug solved? I installed following apps that required sudo all failed:
|
One thing worth mentioning is that even once we know which casks require sudo to be installed, we probably shouldn't just execute the cask command as uid 0 (as suggested above). Better to do the command as usual (running as the One hacky way to bump a user's sudo timestamp is just to touch the directory in My current workaround looks something like: def run(*cmds)
begin
brew_cmd = ['brew', 'cask'] + cmds
execute brew_cmd, command_opts
rescue Puppet::ExecutionFailure => e
raise e unless e.message =~ /sudo: no tty present and no askpass program specified/
warning <<-EOT.gsub(/\s+/, ' ').strip
Initial execution of `#{brew_cmd.join(' ')}` failed because it requires sudo, and there's no TTY to accept a
password. We are about to reattempt execution, after bumping the sudo timestamp for that user.
EOT
timestamp = "/var/db/sudo/#{default_user}"
Dir.mkdir(timestamp, 0700) unless File.directory?(timestamp)
FileUtils.touch(timestamp)
execute brew_cmd, command_opts
end
end |
I closed the issue in response to #22 (comment), I haven't tried this again since I filed the issue. |
I am having this issue when installing virtualbox |
maybe open a new terminal and try this script: while true; do sudo ls -l; sleep 2; done; with enter password one time -- On August 19, 2015 at 5:39:11 PM, Chris McKnight (notifications@github.com) wrote: I am having this issue when installing virtualbox — |
@julienlavergne That worked. Thanks! That's something I have seen people do in their dotfiles to be able to get around the sudo timeout. It really seems like a hack though. |
Yeah it’s a hack but another solution doesn’t seem to be known. -- On August 20, 2015 at 7:58:00 AM, Chris McKnight (notifications@github.com) wrote: @julienlavergne That's something I have seen people do in their dotfiles to be able to get around the sudo timeout. It really seems like a hack though. — |
@johndbritton Can you please reopen this issue in that case? @julienlavergne was mistaken in saying "no problem with brewcask/virtualbox", nothing has been done to fix this, and the issue remains. "open a new terminal and try this script"? As a workaround for a puppet module, that's pretty unacceptable. "another solution doesn’t seem to be known" is just wrong. |
Why my opinion is mistaken ? -- On August 21, 2015 at 7:58:09 AM, Radek Simko (notifications@github.com) wrote: Reopened #22. — |
To clarify the situation - I'm still not sure if it's worth keeping open or close... but brewcask is moving towards a state where there will be no symlinks, it will behave much more like standard drag & drop installations. See Homebrew/homebrew-cask#13201 for details & reasons. Currently only I'm not sure if there's any nice way of solving this problem at this moment. I'm not convinced that using |
No pb with last VirtualBox installation if VirtualBox is correctly closed. -- On August 21, 2015 at 12:18:27 PM, Radek Simko (notifications@github.com) wrote: To clarify the situation - I'm still not sure if it's worth keeping open or close... but brewcask is moving towards a state where there will be no symlinks, it will behave much more like standard drag & drop installations. See Homebrew/homebrew-cask#13201 for details & reasons. Currently only pkg and a few other bundle types require su perms. When the changes described in the linked issue get implemented, then suddenly de facto all apps will require su perms, therefore this boxen module will need to run all brew cask commands under su permissions, which will be the definitive solution to all these issues. I'm not sure if there's any nice way of solving this problem at this moment. I'm not convinced that using sudo for installing apps into ~/Applications and generally for things that do not require sudo is a solution. — |
@radeksimko As long as the user who runs boxen is an admin user, no |
All users are not admin by default Envoyé de mon iPhone
|
@julienlavergne Understood, but better post this to the original thread to |
@julienlavergne I thought Virtualbox requires root privileges to install vboxnet drivers, among other things. Are you saying |
Below sudo manifest, It's works.
|
@n0ts's suggestion above worked for me |
Which suggestion finally? From: RJ Pittman notifications@github.com @n0ts's suggestion above worked for me — |
When will this issue be fixed in puppet-brewcask? Next release? |
Adds a sudo workaround: boxen/puppet-brewcask#22 (comment)
@n0ts that seems like a good workaround for targeting /usr/bin/installer. Some packages use additional commands like sudo -E /usr/bin/sqlite3 ... (SizeUp) which fails also when no sudo session is in play. The only work arounds I have found are hacks like: 1.) run "sudo ls" right before running boxen @julienlavergne Great question. Has anyone made progress on this? |
No improvement about your trick
|
See https://gpgtools.org/ and https://help.github.com/articles/signing-commits-using-gpg/ Also configures `sudo` so that my user account can install anything using installer without having to prompt. Running `sudo ls` before running `boxen` did not work. This change addresses that, but feels a little wrong. See boxen/puppet-brewcask#22 (comment)
Closing due to inactivity. If you have any new information, please raise it in boxen/puppet-homebrew since brewcask + homebrew merged. |
When I try and install
virtualbox
using thebrewcask
provider the install fails. It seems to be failing due to a permissions error. Since virtualbox is apkg
asudo
and password entry is required. The run fails because there's no opportunity to collect the password.The text was updated successfully, but these errors were encountered: