Skip to content
This repository has been archived by the owner on Jan 18, 2023. It is now read-only.

Installation fails if java was already installed #139

Open
eyalzek opened this issue Oct 21, 2016 · 6 comments
Open

Installation fails if java was already installed #139

eyalzek opened this issue Oct 21, 2016 · 6 comments

Comments

@eyalzek
Copy link

eyalzek commented Oct 21, 2016

Since the file /etc/profile.d/jdk.sh exists before the installation, apt-get is prompting for replacing the file:

           Error executing action `install` on resource 'apt_package[mesos]'
           ================================================================================

           Mixlib::ShellOut::ShellCommandFailed
           ------------------------------------
           Expected process to exit with [0], but received '100'
           ---- Begin output of apt-get -q -y --no-install-recommends install mesos=1.0.1* ----
           STDOUT: Reading package lists...
           Building dependency tree...
           Reading state information...
           mesos is already the newest version.
           0 upgraded, 0 newly installed, 0 to remove and 68 not upgraded.
           1 not fully installed or removed.
           After this operation, 0 B of additional disk space will be used.
           Setting up oracle-java8-set-default (8u111+8u111arm-1~webupd8~0) ...
           STDERR: perl: warning: Setting locale failed.
           perl: warning: Please check that your locale settings:
            LANGUAGE = "C.UTF-8",
            LC_ALL = (unset),
            LC_TIME = "de_DE.UTF-8",
            LC_MONETARY = "de_DE.UTF-8",
            LC_ADDRESS = "de_DE.UTF-8",
            LC_TELEPHONE = "de_DE.UTF-8",
            LC_NAME = "de_DE.UTF-8",
            LC_MEASUREMENT = "de_DE.UTF-8",
            LC_IDENTIFICATION = "de_DE.UTF-8",
            LC_NUMERIC = "de_DE.UTF-8",
            LC_PAPER = "de_DE.UTF-8",
            LANG = "C.UTF-8"
        are supported and installed on your system.
           perl: warning: Falling back to the standard locale ("C").
           locale: Cannot set LC_ALL to default locale: No such file or directory

           Configuration file '/etc/profile.d/jdk.sh'
            ==> File on system created by you or by a script.
            ==> File also in package provided by package maintainer.
       What would you like to do about it ?  Your options are:
        Y or I  : install the package maintainer's version
        N or O  : keep your currently-installed version
          D     : show the differences between the versions
          Z     : start a shell to examine the situation
            The default action is to keep your current version.
           *** jdk.sh (Y/I/N/O/D/Z) [default=N] ? dpkg: error processing package oracle-java8-set-default (--configure):
            EOF on stdin at conffile prompt
           Errors were encountered while processing:
            oracle-java8-set-default
           E: Sub-process /usr/bin/dpkg returned an error code (1)
           ---- End output of apt-get -q -y --no-install-recommends install mesos=1.0.1* ----
           Ran apt-get -q -y --no-install-recommends install mesos=1.0.1* returned 100

           Cookbook Trace:
           ---------------
           /tmp/kitchen/cache/cookbooks/compat_resource/files/lib/chef_compat/monkeypatches/chef/runner.rb:41:in `run_action'

           Resource Declaration:
           ---------------------
           # In /tmp/kitchen/cache/cookbooks/mesos/recipes/install.rb

            40:   package 'mesos' do
            41:     action :install
            42:     # --no-install-recommends to skip installing zk. unnecessary.
            43:     options '--no-install-recommends'
            44:     # Glob is necessary to select the deb version string
            45:     version "#{node['mesos']['version']}*"
            46:   end
            47: when 'rhel'

           Compiled Resource:
           ------------------
           # Declared in /tmp/kitchen/cache/cookbooks/mesos/recipes/install.rb:40:in `from_file'

           apt_package("mesos") do
             package_name "mesos"
             action [:install]
             retries 0
             retry_delay 2
             default_guard_interpreter :default
             declared_type :package
             cookbook_name "mesos"
             recipe_name "install"
             version "1.0.1*"
             options "--no-install-recommends"
           end

I don't know why it started happening all of a sudden, but currently to bypass it I have to:

file '/etc/profile.d/jdk.sh' do
  action :delete
end

before calling include_recipe 'mesos::master' ...

@eyalzek
Copy link
Author

eyalzek commented Dec 5, 2016

Would it be possible to turn this into an attribute?
https://github.com/mdsol/mesos_cookbook/blob/master/recipes/install.rb#L43
I can make a PR if necessary...

@rveznaver
Copy link
Collaborator

@eyalzek What would that fix?

@eyalzek
Copy link
Author

eyalzek commented Dec 5, 2016

Here is an example from the docker cookbook:
https://github.com/chef-cookbooks/docker/blob/master/libraries/docker_installation_package.rb#L19
and to install with options (from README.md):

docker_installation_package 'default' do
  version '1.8.3'
  action :create
  package_options %q|--force-yes -o Dpkg::Options::='--force-confold' -o Dpkg::Options::='--force-all'| # if Ubuntu for example
end

@rveznaver
Copy link
Collaborator

@eyalzek Thanks, I am aware how package options work :) My question remains: Why would you want to change those options and what would you fix by changing them?

@eyalzek
Copy link
Author

eyalzek commented Dec 6, 2016

Huh sorry, misread your question :)
It'll give me the option to pass -o Dpkg::Options::='--force-confold' which will prevent the error described in my first message.

I am in mind to do the following on all my nodes anyway:

file '/etc/apt/apt.conf.d/99conf-default' do
  action :create
  content <<-EOS
Dpkg::Options {
   "--force-confdef";
   "--force-confold";
}
  EOS
end

In which case, the changes to this cookbook won't be necessary for me (but I still believe it's good to have the option to customize these parameters).

@rveznaver
Copy link
Collaborator

This seems like an issue with the java cookbook not setting up the Java package properly. Installing the mesos package should not pull oracle-java8-set-default as it is supposed to be installed by the aforementioned cookbook.

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

No branches or pull requests

2 participants