You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I have a Chef script set up to install Java and other packages. This worked on previous versions of OSX, but under Sierra, the Java install fails with sudo: no tty present and no askpass program specified. This is because Sierra changed the rules around sudo and TTYs for security, and chef-client runs as a daemon, so its commands are not attached to a TTY. Homebrew won't let me run it as root, so that's not an option, so I think the best solution to this is if we can specify an askpass program for sudo to use, or alternatively specify the sudo password for homebrew via standard input. Are either of these feasible to do?
Output of your command with --verbose --debug
* execute[install java] action run[2017-04-24T15:17:23-07:00] INFO: Processing execute[install java] action run (liveramp-chef-configure::_80_java line 25)
[execute] ==> Hbc::Installer#install
==> Printing caveats
==> Caveats
This Cask makes minor modifications to the JRE to prevent issues with
packaged applications, as discussed here:
https://bugs.eclipse.org/bugs/show_bug.cgi?id=411361
If your Java application still asks for JRE installation, you might need
to reboot or logout/login.
Installing this Cask means you have AGREED to the Oracle Binary Code
License Agreement for Java SE at
https://www.oracle.com/technetwork/java/javase/terms/license/index.html
==> Hbc::Installer#fetch
==> Downloading
==> Downloading http://download.oracle.com/otn-pub/java/jdk/8u131-b11/d54c1d3a095b4ff2b6607d096fa80163/jdk-8u131-macosx-x64.dmg
Already downloaded: /Users/jcrote/Library/Caches/Homebrew/Cask/java--1.8.0_131-b11,d54c1d3a095b4ff2b6607d096fa80163.dmg
==> Downloaded to -> /Users/jcrote/Library/Caches/Homebrew/Cask/java--1.8.0_131-b11,d54c1d3a095b4ff2b6607d096fa80163.dmg
==> Verifying download
==> Determining which verifications to run for Cask java
==> Checking for verification class Hbc::Verify::Checksum
==> 1 verifications defined
Hbc::Verify::Checksum
==> Running verification of class Hbc::Verify::Checksum
==> Verifying checksum for Cask java
==> SHA256 checksums match
==> Installing Cask java
==> Hbc::Installer#stage
==> Extracting primary container
==> Determining which containers to use based on filetype
==> Checking container class Hbc::Container::Pkg
==> Checking container class Hbc::Container::Ttf
==> Checking container class Hbc::Container::Otf
==> Checking container class Hbc::Container::Air
==> Checking container class Hbc::Container::Cab
==> Checking container class Hbc::Container::Dmg
==> Executing: ["/usr/bin/hdiutil", "imageinfo", "/Users/jcrote/Library/Caches/Homebrew/Cask/java--1.8.0_131-b11,d54c1d3a095b4ff2b6607d096fa80163.dmg"]
==> Using container class Hbc::Container::Dmg for /Users/jcrote/Library/Caches/Homebrew/Cask/java--1.8.0_131-b11,d54c1d3a095b4ff2b6607d096fa80163.dmg
==> Executing: ["/usr/bin/hdiutil", "mount", "-plist", "-nobrowse", "-readonly", "-noidme", "-mountrandom", "/tmp", "/Users/jcrote/Library/Caches/Homebrew/Cask/java--1.8.0_131-b11,d54c1d3a095b4ff2b6607d096fa80163.dmg"]
==> Executing: ["/usr/bin/mkbom", "-s", "-i", "/var/folders/6k/rwx3qt3j6k9g2wyzsyx__n49_093x4/T/20170424-43605-n79hk8.list", "--", "/var/folders/6k/rwx3qt3j6k9g2wyzsyx__n49_093x4/T/20170424-43605-1px23e0.bom"]
==> Executing: ["/usr/bin/ditto", "--bom", "/var/folders/6k/rwx3qt3j6k9g2wyzsyx__n49_093x4/T/20170424-43605-1px23e0.bom", "--", "/private/tmp/dmg.9oWuL0", "/usr/local/Caskroom/java/1.8.0_131-b11,d54c1d3a095b4ff2b6607d096fa80163"]
==> Executing: ["/usr/sbin/diskutil", "eject", "/private/tmp/dmg.9oWuL0"]
==> Creating metadata directory /usr/local/Caskroom/java/.metadata/1.8.0_131-b11,d54c1d3a095b4ff2b6607d096fa80163/20170424221727.984.
==> Creating metadata subdirectory /usr/local/Caskroom/java/.metadata/1.8.0_131-b11,d54c1d3a095b4ff2b6607d096fa80163/20170424221727.984/Casks.
==> Installing artifacts
==> Determining which artifacts are present in Cask java
==> 4 artifact/s defined
#<Hbc::Artifact::Pkg:0x007f8b059a3db8>
#<Hbc::Artifact::Uninstall:0x007f8b059a3d18>
#<Hbc::Artifact::PostflightBlock:0x007f8b059a3c78>
#<Hbc::Artifact::Zap:0x007f8b059a3bd8>
==> Installing artifact of class Hbc::Artifact::Pkg
==> Running installer for java; your password may be necessary.
==> Package installers may write to any location; options such as --appdir are ignored.
==> Executing: ["/usr/bin/sudo", "-E", "--", "/usr/sbin/installer", "-pkg", "/usr/local/Caskroom/java/1.8.0_131-b11,d54c1d3a095b4ff2b6607d096fa80163/JDK 8 Update 131.pkg", "-target", "/", "-verboseR"]
Error: Command failed to execute!
==> Failed command:
/usr/bin/sudo -E -- /usr/sbin/installer -pkg #<Pathname:/usr/local/Caskroom/java/1.8.0_131-b11,d54c1d3a095b4ff2b6607d096fa80163/JDK 8 Update 131.pkg> -target / -verboseR
==> Standard Output of failed command:
==> Standard Error of failed command:
sudo: no tty present and no askpass program specified
==> Exit status of failed command:
#<Process::Status: pid 43760 exit 1>
Error: nothing to install/usr/local/Homebrew/Library/Homebrew/cask/lib/hbc/cli/install.rb:13:in `run'
/usr/local/Homebrew/Library/Homebrew/cask/lib/hbc/cli.rb:115:in `run_command'
/usr/local/Homebrew/Library/Homebrew/cask/lib/hbc/cli.rb:158:in `process'
/usr/local/Homebrew/Library/Homebrew/cmd/cask.rb:8:in `cask'
/usr/local/Homebrew/Library/Homebrew/brew.rb:90:in `<main>'
Error: Kernel.exit
/usr/local/Homebrew/Library/Homebrew/cask/lib/hbc/cli.rb:163:in `exit'
/usr/local/Homebrew/Library/Homebrew/cask/lib/hbc/cli.rb:163:in `rescue in process'
/usr/local/Homebrew/Library/Homebrew/cask/lib/hbc/cli.rb:149:in `process'
/usr/local/Homebrew/Library/Homebrew/cmd/cask.rb:8:in `cask'
/usr/local/Homebrew/Library/Homebrew/brew.rb:90:in `<main>'
==> sudo: no tty present and no askpass program specified
==> Purging files for version 1.8.0_131-b11,d54c1d3a095b4ff2b6607d096fa80163 of Cask java
================================================================================
Error executing action `run` on resource 'execute[install java]'
================================================================================
Mixlib::ShellOut::ShellCommandFailed
------------------------------------
Expected process to exit with [0], but received '1'
---- Begin output of brew cask install java --verbose --debug ----
STDOUT: ==> Hbc::Installer#install
==> Printing caveats
==> Caveats
This Cask makes minor modifications to the JRE to prevent issues with
packaged applications, as discussed here:
https://bugs.eclipse.org/bugs/show_bug.cgi?id=411361
If your Java application still asks for JRE installation, you might need
to reboot or logout/login.
Installing this Cask means you have AGREED to the Oracle Binary Code
License Agreement for Java SE at
https://www.oracle.com/technetwork/java/javase/terms/license/index.html
==> Hbc::Installer#fetch
==> Downloading
==> Downloading http://download.oracle.com/otn-pub/java/jdk/8u131-b11/d54c1d3a095b4ff2b6607d096fa80163/jdk-8u131-macosx-x64.dmg
Already downloaded: /Users/jcrote/Library/Caches/Homebrew/Cask/java--1.8.0_131-b11,d54c1d3a095b4ff2b6607d096fa80163.dmg
==> Downloaded to -> /Users/jcrote/Library/Caches/Homebrew/Cask/java--1.8.0_131-b11,d54c1d3a095b4ff2b6607d096fa80163.dmg
==> Verifying download
==> Determining which verifications to run for Cask java
==> Checking for verification class Hbc::Verify::Checksum
==> 1 verifications defined
Hbc::Verify::Checksum
==> Running verification of class Hbc::Verify::Checksum
==> Verifying checksum for Cask java
==> SHA256 checksums match
==> Installing Cask java
==> Hbc::Installer#stage
==> Extracting primary container
==> Determining which containers to use based on filetype
==> Checking container class Hbc::Container::Pkg
==> Checking container class Hbc::Container::Ttf
==> Checking container class Hbc::Container::Otf
==> Checking container class Hbc::Container::Air
==> Checking container class Hbc::Container::Cab
==> Checking container class Hbc::Container::Dmg
==> Executing: ["/usr/bin/hdiutil", "imageinfo", "/Users/jcrote/Library/Caches/Homebrew/Cask/java--1.8.0_131-b11,d54c1d3a095b4ff2b6607d096fa80163.dmg"]
==> Using container class Hbc::Container::Dmg for /Users/jcrote/Library/Caches/Homebrew/Cask/java--1.8.0_131-b11,d54c1d3a095b4ff2b6607d096fa80163.dmg
==> Executing: ["/usr/bin/hdiutil", "mount", "-plist", "-nobrowse", "-readonly", "-noidme", "-mountrandom", "/tmp", "/Users/jcrote/Library/Caches/Homebrew/Cask/java--1.8.0_131-b11,d54c1d3a095b4ff2b6607d096fa80163.dmg"]
==> Executing: ["/usr/bin/mkbom", "-s", "-i", "/var/folders/6k/rwx3qt3j6k9g2wyzsyx__n49_093x4/T/20170424-43605-n79hk8.list", "--", "/var/folders/6k/rwx3qt3j6k9g2wyzsyx__n49_093x4/T/20170424-43605-1px23e0.bom"]
==> Executing: ["/usr/bin/ditto", "--bom", "/var/folders/6k/rwx3qt3j6k9g2wyzsyx__n49_093x4/T/20170424-43605-1px23e0.bom", "--", "/private/tmp/dmg.9oWuL0", "/usr/local/Caskroom/java/1.8.0_131-b11,d54c1d3a095b4ff2b6607d096fa80163"]
==> Executing: ["/usr/sbin/diskutil", "eject", "/private/tmp/dmg.9oWuL0"]
==> Creating metadata directory /usr/local/Caskroom/java/.metadata/1.8.0_131-b11,d54c1d3a095b4ff2b6607d096fa80163/20170424221727.984.
==> Creating metadata subdirectory /usr/local/Caskroom/java/.metadata/1.8.0_131-b11,d54c1d3a095b4ff2b6607d096fa80163/20170424221727.984/Casks.
==> Installing artifacts
==> Determining which artifacts are present in Cask java
==> 4 artifact/s defined
#<Hbc::Artifact::Pkg:0x007f8b059a3db8>
#<Hbc::Artifact::Uninstall:0x007f8b059a3d18>
#<Hbc::Artifact::PostflightBlock:0x007f8b059a3c78>
#<Hbc::Artifact::Zap:0x007f8b059a3bd8>
==> Installing artifact of class Hbc::Artifact::Pkg
==> Running installer for java; your password may be necessary.
==> Package installers may write to any location; options such as --appdir are ignored.
==> Executing: ["/usr/bin/sudo", "-E", "--", "/usr/sbin/installer", "-pkg", "/usr/local/Caskroom/java/1.8.0_131-b11,d54c1d3a095b4ff2b6607d096fa80163/JDK 8 Update 131.pkg", "-target", "/", "-verboseR"]
==> sudo: no tty present and no askpass program specified
==> Purging files for version 1.8.0_131-b11,d54c1d3a095b4ff2b6607d096fa80163 of Cask java
STDERR: Error: Command failed to execute!
==> Failed command:
/usr/bin/sudo -E -- /usr/sbin/installer -pkg #<Pathname:/usr/local/Caskroom/java/1.8.0_131-b11,d54c1d3a095b4ff2b6607d096fa80163/JDK 8 Update 131.pkg> -target / -verboseR
==> Standard Output of failed command:
==> Standard Error of failed command:
sudo: no tty present and no askpass program specified
==> Exit status of failed command:
#<Process::Status: pid 43760 exit 1>
Error: nothing to install/usr/local/Homebrew/Library/Homebrew/cask/lib/hbc/cli/install.rb:13:in `run'
/usr/local/Homebrew/Library/Homebrew/cask/lib/hbc/cli.rb:115:in `run_command'
/usr/local/Homebrew/Library/Homebrew/cask/lib/hbc/cli.rb:158:in `process'
/usr/local/Homebrew/Library/Homebrew/cmd/cask.rb:8:in `cask'
/usr/local/Homebrew/Library/Homebrew/brew.rb:90:in `<main>'
Error: Kernel.exit
/usr/local/Homebrew/Library/Homebrew/cask/lib/hbc/cli.rb:163:in `exit'
/usr/local/Homebrew/Library/Homebrew/cask/lib/hbc/cli.rb:163:in `rescue in process'
/usr/local/Homebrew/Library/Homebrew/cask/lib/hbc/cli.rb:149:in `process'
/usr/local/Homebrew/Library/Homebrew/cmd/cask.rb:8:in `cask'
/usr/local/Homebrew/Library/Homebrew/brew.rb:90:in `<main>'
---- End output of brew cask install java --verbose --debug ----
Ran brew cask install java --verbose --debug returned 1
Cookbook Trace:
---------------
/Users/jcrote/.chef/local-mode-cache/cache/cookbooks/compat_resource/files/lib/chef_compat/monkeypatches/chef/runner.rb:41:in `run_action'
Resource Declaration:
---------------------
# In /Users/jcrote/.chef/local-mode-cache/cache/cookbooks/liveramp-chef-configure/recipes/_80_java.rb
25: execute 'install java' do
26: command 'brew cask install java --verbose --debug'
27: not_if { File.exist?("/Library/Java/JavaVirtualMachines/#{jdk}") }
28: end
29:
Compiled Resource:
------------------
# Declared in /Users/jcrote/.chef/local-mode-cache/cache/cookbooks/liveramp-chef-configure/recipes/_80_java.rb:25:in `from_file'
execute("install java") do
action [:run]
retries 0
retry_delay 2
default_guard_interpreter :execute
command "brew cask install java --verbose --debug"
backup 5
returns 0
declared_type :execute
cookbook_name "liveramp-chef-configure"
recipe_name "_80_java"
not_if { #code block }
end
Platform:
---------
x86_64-darwin14
[2017-04-24T15:17:28-07:00] INFO: Running queued delayed notifications before re-raising exception
Running handlers:
[2017-04-24T15:17:28-07:00] ERROR: Running exception handlers
Running handlers complete
[2017-04-24T15:17:28-07:00] ERROR: Exception handlers complete
Chef Client failed. 12 resources updated in 54 seconds
[2017-04-24T15:17:28-07:00] FATAL: Stacktrace dumped to /Users/jcrote/.chef/local-mode-cache/cache/chef-stacktrace.out
[2017-04-24T15:17:28-07:00] FATAL: Please provide the contents of the stacktrace.out file if you file a bug report
[2017-04-24T15:17:28-07:00] ERROR: execute[install java] (liveramp-chef-configure::_80_java line 25) had an error: Mixlib::ShellOut::ShellCommandFailed: Expected process to exit with [0], but received '1'
---- Begin output of brew cask install java --verbose --debug ----
STDOUT: ==> Hbc::Installer#install
==> Printing caveats
==> Caveats
This Cask makes minor modifications to the JRE to prevent issues with
packaged applications, as discussed here:
https://bugs.eclipse.org/bugs/show_bug.cgi?id=411361
If your Java application still asks for JRE installation, you might need
to reboot or logout/login.
Installing this Cask means you have AGREED to the Oracle Binary Code
License Agreement for Java SE at
https://www.oracle.com/technetwork/java/javase/terms/license/index.html
==> Hbc::Installer#fetch
==> Downloading
==> Downloading http://download.oracle.com/otn-pub/java/jdk/8u131-b11/d54c1d3a095b4ff2b6607d096fa80163/jdk-8u131-macosx-x64.dmg
Already downloaded: /Users/jcrote/Library/Caches/Homebrew/Cask/java--1.8.0_131-b11,d54c1d3a095b4ff2b6607d096fa80163.dmg
==> Downloaded to -> /Users/jcrote/Library/Caches/Homebrew/Cask/java--1.8.0_131-b11,d54c1d3a095b4ff2b6607d096fa80163.dmg
==> Verifying download
==> Determining which verifications to run for Cask java
==> Checking for verification class Hbc::Verify::Checksum
==> 1 verifications defined
Hbc::Verify::Checksum
==> Running verification of class Hbc::Verify::Checksum
==> Verifying checksum for Cask java
==> SHA256 checksums match
==> Installing Cask java
==> Hbc::Installer#stage
==> Extracting primary container
==> Determining which containers to use based on filetype
==> Checking container class Hbc::Container::Pkg
==> Checking container class Hbc::Container::Ttf
==> Checking container class Hbc::Container::Otf
==> Checking container class Hbc::Container::Air
==> Checking container class Hbc::Container::Cab
==> Checking container class Hbc::Container::Dmg
==> Executing: ["/usr/bin/hdiutil", "imageinfo", "/Users/jcrote/Library/Caches/Homebrew/Cask/java--1.8.0_131-b11,d54c1d3a095b4ff2b6607d096fa80163.dmg"]
==> Using container class Hbc::Container::Dmg for /Users/jcrote/Library/Caches/Homebrew/Cask/java--1.8.0_131-b11,d54c1d3a095b4ff2b6607d096fa80163.dmg
==> Executing: ["/usr/bin/hdiutil", "mount", "-plist", "-nobrowse", "-readonly", "-noidme", "-mountrandom", "/tmp", "/Users/jcrote/Library/Caches/Homebrew/Cask/java--1.8.0_131-b11,d54c1d3a095b4ff2b6607d096fa80163.dmg"]
==> Executing: ["/usr/bin/mkbom", "-s", "-i", "/var/folders/6k/rwx3qt3j6k9g2wyzsyx__n49_093x4/T/20170424-43605-n79hk8.list", "--", "/var/folders/6k/rwx3qt3j6k9g2wyzsyx__n49_093x4/T/20170424-43605-1px23e0.bom"]
==> Executing: ["/usr/bin/ditto", "--bom", "/var/folders/6k/rwx3qt3j6k9g2wyzsyx__n49_093x4/T/20170424-43605-1px23e0.bom", "--", "/private/tmp/dmg.9oWuL0", "/usr/local/Caskroom/java/1.8.0_131-b11,d54c1d3a095b4ff2b6607d096fa80163"]
==> Executing: ["/usr/sbin/diskutil", "eject", "/private/tmp/dmg.9oWuL0"]
==> Creating metadata directory /usr/local/Caskroom/java/.metadata/1.8.0_131-b11,d54c1d3a095b4ff2b6607d096fa80163/20170424221727.984.
==> Creating metadata subdirectory /usr/local/Caskroom/java/.metadata/1.8.0_131-b11,d54c1d3a095b4ff2b6607d096fa80163/20170424221727.984/Casks.
==> Installing artifacts
==> Determining which artifacts are present in Cask java
==> 4 artifact/s defined
#<Hbc::Artifact::Pkg:0x007f8b059a3db8>
#<Hbc::Artifact::Uninstall:0x007f8b059a3d18>
#<Hbc::Artifact::PostflightBlock:0x007f8b059a3c78>
#<Hbc::Artifact::Zap:0x007f8b059a3bd8>
==> Installing artifact of class Hbc::Artifact::Pkg
==> Running installer for java; your password may be necessary.
==> Package installers may write to any location; options such as --appdir are ignored.
==> Executing: ["/usr/bin/sudo", "-E", "--", "/usr/sbin/installer", "-pkg", "/usr/local/Caskroom/java/1.8.0_131-b11,d54c1d3a095b4ff2b6607d096fa80163/JDK 8 Update 131.pkg", "-target", "/", "-verboseR"]
==> sudo: no tty present and no askpass program specified
==> Purging files for version 1.8.0_131-b11,d54c1d3a095b4ff2b6607d096fa80163 of Cask java
STDERR: Error: Command failed to execute!
==> Failed command:
/usr/bin/sudo -E -- /usr/sbin/installer -pkg #<Pathname:/usr/local/Caskroom/java/1.8.0_131-b11,d54c1d3a095b4ff2b6607d096fa80163/JDK 8 Update 131.pkg> -target / -verboseR
==> Standard Output of failed command:
==> Standard Error of failed command:
sudo: no tty present and no askpass program specified
==> Exit status of failed command:
#<Process::Status: pid 43760 exit 1>
Error: nothing to install/usr/local/Homebrew/Library/Homebrew/cask/lib/hbc/cli/install.rb:13:in `run'
/usr/local/Homebrew/Library/Homebrew/cask/lib/hbc/cli.rb:115:in `run_command'
/usr/local/Homebrew/Library/Homebrew/cask/lib/hbc/cli.rb:158:in `process'
/usr/local/Homebrew/Library/Homebrew/cmd/cask.rb:8:in `cask'
/usr/local/Homebrew/Library/Homebrew/brew.rb:90:in `<main>'
Error: Kernel.exit
/usr/local/Homebrew/Library/Homebrew/cask/lib/hbc/cli.rb:163:in `exit'
/usr/local/Homebrew/Library/Homebrew/cask/lib/hbc/cli.rb:163:in `rescue in process'
/usr/local/Homebrew/Library/Homebrew/cask/lib/hbc/cli.rb:149:in `process'
/usr/local/Homebrew/Library/Homebrew/cmd/cask.rb:8:in `cask'
/usr/local/Homebrew/Library/Homebrew/brew.rb:90:in `<main>'
---- End output of brew cask install java --verbose --debug ----
Ran brew cask install java --verbose --debug returned 1
[2017-04-24T15:17:28-07:00] FATAL: Chef::Exceptions::ChildConvergeError: Chef run process exited unsuccessfully (exit code 1)
Occasionally we get some report of how some specific thing doesn’t work under a Chef script. My view on this is: when tool A wants to do things by directly calling tool B, tool A has to do the work to comply with tool B, not the reverse. However, if tool B can make a small change with no repercussions to help tool A, it should.
All that is to say: depends on the amount of work.
@reitermarkus has been doing the majority of work on the core, so I’ll leave the decision to him and be completely behind it.
Homebrew won't let me run it as root, so that's not an option, so I think the best solution to this is if we can specify an askpass program for sudo to use, or alternatively specify the sudo password for homebrew via standard input.
brew cask does actually already support SUDO_ASKPASS.
General troubleshooting steps
brew update-reset && brew update
and retried my command.brew doctor
, fixed as many issues as possible and retried my command.Description of issue
I have a Chef script set up to install Java and other packages. This worked on previous versions of OSX, but under Sierra, the Java install fails with
sudo: no tty present and no askpass program specified
. This is because Sierra changed the rules around sudo and TTYs for security, and chef-client runs as a daemon, so its commands are not attached to a TTY. Homebrew won't let me run it as root, so that's not an option, so I think the best solution to this is if we can specify an askpass program for sudo to use, or alternatively specify the sudo password for homebrew via standard input. Are either of these feasible to do?Output of your command with
--verbose --debug
Output of
brew cask doctor
The text was updated successfully, but these errors were encountered: