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

Build fails with "Failed to fetch registry file" on Ubuntu #14

Open
Shivshankar-Reddy opened this issue Jan 20, 2025 · 4 comments
Open

Comments

@Shivshankar-Reddy
Copy link

Trying to build the module to test with Valkey, But I am running into "Failed to fetch registry file" error with different mod file every time. Initially I thought it could be due to proxy. However, I am able to get the file by wget and also able to curl to the registry. Could someone have look at this provide some solution.

The error details from the console:

ubuntu@shiv-vm:~/vector-search-work/valkey-search$
ubuntu@shiv-vm:~/vector-search-work/valkey-search$ bazel build //src:valkeysearch
Starting local Bazel server (8.0.1) and connecting to it...
ERROR: Error computing the main repository mapping: Error accessing registry https://bcr.bazel.build/: Failed to fetch registry file https://bcr.bazel.build/modules/bazel_skylib/1.7.1/MODULE.bazel: PKIX path building failed: sun.security.provider.certpath.SunCertPathBuilderException: unable to find valid certification path to requested target
Computing main repo mapping:
ubuntu@shiv-vm:~/vector-search-work/valkey-search$
ubuntu@shiv-vm:~/vector-search-work/valkey-search$
ubuntu@shiv-vm:~/vector-search-work/valkey-search$
ubuntu@shiv-vm:~/vector-search-work/valkey-search$ bazel build //src:valkeysearch
ERROR: Error computing the main repository mapping: Error accessing registry https://bcr.bazel.build/: Failed to fetch registry file https://bcr.bazel.build/modules/platforms/0.0.7/MODULE.bazel: PKIX path building failed: sun.security.provider.certpath.SunCertPathBuilderException: unable to find valid certification path to requested target
Computing main repo mapping:
ubuntu@shiv-vm:~/vector-search-work/valkey-search$
ubuntu@shiv-vm:~/vector-search-work/valkey-search$
ubuntu@shiv-vm:~/vector-search-work/valkey-search$ bazel clean --expunge
INFO: Starting clean (this may take a while). Use --async if the clean takes more than several minutes.
ubuntu@shiv-vm:~/vector-search-work/valkey-search$
ubuntu@shiv-vm:~/vector-search-work/valkey-search$
ubuntu@shiv-vm:~/vector-search-work/valkey-search$ bazel build //src:valkeysearch
Starting local Bazel server (8.0.1) and connecting to it...
ERROR: Error computing the main repository mapping: Error accessing registry https://bcr.bazel.build/: Failed to fetch registry file https://bcr.bazel.build/modules/rules_proto/7.1.0/MODULE.bazel: PKIX path building failed: sun.security.provider.certpath.SunCertPathBuilderException: unable to find valid certification path to requested target
Computing main repo mapping:
ubuntu@shiv-vm:~/vector-search-work/valkey-search$
ubuntu@shiv-vm:~/vector-search-work/valkey-search$
ubuntu@shiv-vm:~/vector-search-work/valkey-search$ bazel clean --expunge
INFO: Starting clean (this may take a while). Use --async if the clean takes more than several minutes.
ubuntu@shiv-vm:~/vector-search-work/valkey-search$
ubuntu@shiv-vm:~/vector-search-work/valkey-search$
ubuntu@shiv-vm:~/vector-search-work/valkey-search$
ubuntu@shiv-vm:~/vector-search-work/valkey-search$ bazel clean --expunge
INFO: Starting clean (this may take a while). Use --async if the clean takes more than several minutes.
ubuntu@shiv-vm:~/vector-search-work/valkey-search$
ubuntu@shiv-vm:~/vector-search-work/valkey-search$
ubuntu@shiv-vm:~/vector-search-work/valkey-search$ bazel build //src:valkeysearch
Starting local Bazel server (8.0.1) and connecting to it...
ERROR: Error computing the main repository mapping: Error accessing registry https://bcr.bazel.build/: Failed to fetch registry file https://bcr.bazel.build/modules/hdrhistogram_c/0.11.2/MODULE.bazel: PKIX path building failed: sun.security.provider.certpath.SunCertPathBuilderException: unable to find valid certification path to requested target
Computing main repo mapping:
ubuntu@shiv-vm:~/vector-search-work/valkey-search$
ubuntu@shiv-vm:~/vector-search-work/valkey-search$
ubuntu@shiv-vm:~/vector-search-work/valkey-search$
ubuntu@shiv-vm:~/vector-search-work/valkey-search$ bazel clean --expunge
INFO: Starting clean (this may take a while). Use --async if the clean takes more than several minutes.
ubuntu@shiv-vm:~/vector-search-work/valkey-search$
ubuntu@shiv-vm:~/vector-search-work/valkey-search$
ubuntu@shiv-vm:~/vector-search-work/valkey-search$ bazel build //src:valkeysearch
Starting local Bazel server (8.0.1) and connecting to it...
ERROR: Error computing the main repository mapping: Error accessing registry https://bcr.bazel.build/: Failed to fetch registry file https://bcr.bazel.build/modules/highwayhash/0.0.0-20240305-5ad3bf8/MODULE.bazel: PKIX path building failed: sun.security.provider.certpath.SunCertPathBuilderException: unable to find valid certification path to requested target
Computing main repo mapping:
ubuntu@shiv-vm:~/vector-search-work/valkey-search$

Log for the curl and wget request to failed registry.

ubuntu@shiv-vm:~/vector-search-work/valkey-search$ curl https://bcr.bazel.build/
<html>
  <head>
    <script>
      window.location.replace("https://registry.bazel.build/");
    </script>
  </head>
  <body>
    Please see <a href="https://registry.bazel.build/">the Bazel Central Registry website</a> or <a href="https://github.com/bazelbuild/bazel-central-registry">the GitHub repo</a>.
  </body>
</html>

ubuntu@shiv-vm:~/vector-search-work/valkey-search$
ubuntu@shiv-vm:~/vector-search-work/valkey-search$
ubuntu@shiv-vm:~/vector-search-work/valkey-search$
ubuntu@shiv-vm:~/vector-search-work/valkey-search$ curl  https://bcr.bazel.build/modules/highwayhash/0.0.0-20240305-5ad3bf8/MODULE.bazel
module(
    name = "highwayhash",
    version = "0.0.0-20240305-5ad3bf8",
)
ubuntu@shiv-vm:~/vector-search-work/valkey-search$
ubuntu@shiv-vm:~/vector-search-work/valkey-search$
ubuntu@shiv-vm:~/vector-search-work/valkey-search$ wget  https://bcr.bazel.build/modules/highwayhash/0.0.0-20240305-5ad3bf8/MODULE.bazel
--2025-01-20 17:55:18--  https://bcr.bazel.build/modules/highwayhash/0.0.0-20240305-5ad3bf8/MODULE.bazel
Connecting to 127.0.0.1:3128... connected.
Proxy request sent, awaiting response... 200 OK
Length: 76 [application/octet-stream]
Saving to: ‘MODULE.bazel.1’

MODULE.bazel.1                                                     100%[================================================================================================================================================================>]      76  --.-KB/s    in 0s

2025-01-20 17:55:18 (21.7 MB/s) - ‘MODULE.bazel.1’ saved [76/76]

ubuntu@shiv-vm:~/vector-search-work/valkey-search$

git details:

ubuntu@shiv-vm:~/vector-search-work/valkey-search$ ^C
ubuntu@shiv-vm:~/vector-search-work/valkey-search$ git status
On branch main
Your branch is up to date with 'origin/main'.

nothing to commit, working tree clean
ubuntu@shiv-vm:~/vector-search-work/valkey-search$
ubuntu@shiv-vm:~/vector-search-work/valkey-search$
ubuntu@shiv-vm:~/vector-search-work/valkey-search$
ubuntu@shiv-vm:~/vector-search-work/valkey-search$
ubuntu@shiv-vm:~/vector-search-work/valkey-search$ git branch
* main
ubuntu@shiv-vm:~/vector-search-work/valkey-search$
ubuntu@shiv-vm:~/vector-search-work/valkey-search$
ubuntu@shiv-vm:~/vector-search-work/valkey-search$ git remote -v
origin  https://github.com/valkey-io/valkey-search.git (fetch)
origin  https://github.com/valkey-io/valkey-search.git (push)
ubuntu@shiv-vm:~/vector-search-work/valkey-search$
ubuntu@shiv-vm:~/vector-search-work/valkey-search$
ubuntu@shiv-vm:~/vector-search-work/valkey-search$
ubuntu@shiv-vm:~/vector-search-work/valkey-search$ git diff
ubuntu@shiv-vm:~/vector-search-work/valkey-search$

here is the details about the machine.

ubuntu@shiv-vm:~$ lsb_release -a
No LSB modules are available.
Distributor ID: Ubuntu
Description:    Ubuntu 22.04.5 LTS
Release:        22.04
Codename:       jammy
ubuntu@shiv-vm:~$
ubuntu@shiv-vm:~$
ubuntu@shiv-vm:~$ uname -r
5.15.0-117-generic
ubuntu@shiv-vm:~$
ubuntu@shiv-vm:~$ bazel --version
bazel 8.0.1
ubuntu@shiv-vm:~$
ubuntu@shiv-vm:~$
ubuntu@shiv-vm:~$ uname -m
x86_64
ubuntu@shiv-vm:~$

@Shivshankar-Reddy Shivshankar-Reddy changed the title Build fails with "Failed to fetch registry file" Build fails with "Failed to fetch registry file" on Ubuntu Jan 20, 2025
@yairgott
Copy link
Collaborator

yairgott commented Jan 22, 2025

Please run the following and let me know if it resolved the issue:

sudo apt update
sudo apt install ca-certificates -y 
sudo update-ca-certificates 

@Shivshankar-Reddy
Copy link
Author

Thank you @yairgott for looking at the issue.

the issue is fixed by adding --host_jvm_args in build command like below, or adding in .bazelrc.

Command line solution.

bazel --host_jvm_args=-Djavax.net.ssl.trustStore=/etc/ssl/certs/java/cacerts --host_jvm_args=-Djavax.net.ssl.trustStorePassword=changeit build //src:valkeysearch

.bazelrc solution

ubuntu@shiv-vm:~/vector-search-work/valkey-search$ cat .bazelrc
startup --host_jvm_args=-Djavax.net.ssl.trustStore=/etc/ssl/certs/java/cacerts --host_jvm_args=-Djavax.net.ssl.trustStorePassword=changeit
build --cxxopt=-std=c++20
build --copt=-fPIC


build logs.

ubuntu@shiv-vm:~/vector-search-work/valkey-search$
ubuntu@shiv-vm:~/vector-search-work/valkey-search$ bazel build //src:valkeysearch
Starting local Bazel server (8.0.1) and connecting to it...
DEBUG: /home/ubuntu/.cache/bazel/_bazel_ubuntu/3998419f0ded84e52b4eafb977909fc3/external/protobuf+/protobuf.bzl:650:10: The py_proto_library macro is deprecated and will be removed in the 30.x release. switch to the rule defined by rules_python or the one in bazel/py_proto_library.bzl.
DEBUG: /home/ubuntu/.cache/bazel/_bazel_ubuntu/3998419f0ded84e52b4eafb977909fc3/external/protobuf+/protobuf.bzl:650:10: The py_proto_library macro is deprecated and will be removed in the 30.x release. switch to the rule defined by rules_python or the one in bazel/py_proto_library.bzl.
DEBUG: /home/ubuntu/.cache/bazel/_bazel_ubuntu/3998419f0ded84e52b4eafb977909fc3/external/protobuf+/protobuf.bzl:650:10: The py_proto_library macro is deprecated and will be removed in the 30.x release. switch to the rule defined by rules_python or the one in bazel/py_proto_library.bzl.
DEBUG: /home/ubuntu/.cache/bazel/_bazel_ubuntu/3998419f0ded84e52b4eafb977909fc3/external/protobuf+/protobuf.bzl:650:10: The py_proto_library macro is deprecated and will be removed in the 30.x release. switch to the rule defined by rules_python or the one in bazel/py_proto_library.bzl.
INFO: Analyzed target //src:valkeysearch (235 packages loaded, 11650 targets configured).
INFO: Found 1 target...
Target //src:valkeysearch up-to-date:
  bazel-bin/src/libvalkeysearch.so
INFO: Elapsed time: 1701.366s, Critical Path: 109.34s
INFO: 4498 processes: 1869 internal, 2629 linux-sandbox.
INFO: Build completed successfully, 4498 total actions
ubuntu@shiv-vm:~/vector-search-work/valkey-search$ ls bazel-bin/src/
attribute.cppmap            commands     indexes              index_schema.pb.cc  index_schema_proto.cppmap      libvalkeysearch.so           metrics.cppmap        _objs  rdb_io_stream.cppmap   server_events.cppmap  valkey_search.cppmap
attribute_data_type.cppmap  coordinator  index_schema.cppmap  index_schema.pb.h   keyspace_event_manager.cppmap  libvalkeysearch.so-0.params  module_loader.cppmap  query  schema_manager.cppmap  utils                 vector_externalizer.cppmap
ubuntu@shiv-vm:~/vector-search-work/valkey-search$

Please check on your side about this option, if you think the change is neccessary and harmless I can create PR for this. Please let me know.

@Shivshankar-Reddy
Copy link
Author

@yairgott
Copy link
Collaborator

Thanks for sharing and I'm glade that you managed to address it!

I’m concerned that the file path /etc/ssl/certs/java/cacerts may not be applicable across all major Linux distributions. Also, I wonder if you need to include those flags when building under the dev-container. If so, we should definitely add them to the dev-container. I suggest doing this by modifying the entrypoint.sh script to append those flags to the .bazelrc file.

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

2 participants