title: Error in fail: Auto-Configuration Error: Cannot find Java binary bin/java
body: <p>I am using the following configuration on an up-to-date Debian Testing:</p>
  <pre><code>$ bazel version
  Bazelisk version: v1.10.1
  Starting local Bazel server and connecting to it...
  Build label: 4.0.0
  Build target: bazel-out/k8-opt/bin/src/main/java/com/google/devtools/build/lib/bazel/BazelServer_deploy.jar
  Build time: Thu Jan 21 07:33:24 2021 (1611214404)
  Build timestamp: 1611214404
  Build timestamp as int: 1611214404
  </code></pre>
  <p>I have openjdk 11 (currently 11.0.11) installed and <code>update-alternatives</code> points to it via <code>/usr/bin/java</code>. Environment variable <code>JAVA_HOME</code> is <strong>unset</strong>.</p>
  <p>In this configuration the following command fails:</p>
  <pre><code>$ bazel coverage --config=linux_x86 -c dbg --instrumentation_filter=&quot;//implementation:atos_utest&quot; //implementation/src/utest:all 2&gt;&amp;1 | tee /tmp/buildlog.txt
  2021/07/30 16:40:49 Downloading https://releases.bazel.build/4.0.0/release/bazel-4.0.0-linux-x86_64...
  Extracting Bazel installation...
  Starting local Bazel server and connecting to it...
  Loading: 
  Loading: 0 packages loaded
  Loading: 0 packages loaded
      currently loading: implementation/src/utest
  Analyzing: 27 targets (1 packages loaded)
  Analyzing: 27 targets (1 packages loaded, 0 targets configured)
  Analyzing: 27 targets (18 packages loaded, 73 targets configured)
  Analyzing: 27 targets (27 packages loaded, 144 targets configured)
  ERROR: /home/atoml/.cache/bazel/_bazel_atoml/ababbc8a7f78bac9d28b91a651da5105/external/local_jdk/BUILD.bazel:3:10: in fail_rule rule @local_jdk//:jdk: 
  Traceback (most recent call last):
      File &quot;/home/atoml/.cache/bazel/_bazel_atoml/ababbc8a7f78bac9d28b91a651da5105/external/bazel_tools/tools/jdk/fail_rule.bzl&quot;, line 19, column 13, in _fail_rule_impl
          fail(&quot;%s %s&quot; % (ctx.attr.header, ctx.attr.message))
  Error in fail: Auto-Configuration Error: Cannot find Java binary bin/java in /home/atoml/.cache/bazel/_bazel_atoml/install/1a4a2fac02d50c77031d44c0d91b8920/embedded_tools/tools/jdk/nosystemjdk; either correct your JAVA_HOME, PATH or specify embedded Java (e.g. --javabase=@bazel_tools//tools/jdk:remote_jdk11)
  ERROR: Analysis of target '//implementation/src/utest:uut_compdb' failed; build aborted: Analysis of target '@local_jdk//:jdk' failed
  INFO: Elapsed time: 7.681s
  INFO: 0 processes.
  FAILED: Build did NOT complete successfully (29 packages loaded, 367 targets configured)
  ERROR: Couldn't start the build. Unable to run tests
  FAILED: Build did NOT complete successfully (29 packages loaded, 367 targets configured)
  </code></pre>
  <p>Other build commands succeed. This is a VM setup, on other VM instances with the same configuration as described above, this command succeeds.</p>
  <p>I'd be grateful for hints.  Simple things like <code>bazel clean</code> as in <a href="https://stackoverflow.com/questions/68481735/error-in-fail-auto-configuration-error-cannot-find-java-binary">a similar question</a> do not help, I have even removed the build cache completely, but to no avail. BTW. my build has nothing to do with android.</p>