bottlerocket-os / bottlerocket-os/bottlerocket
Build `metal-dev` + `aarch64` fails with `file/dir not found (index.json)`
- Dominant language
- Rust
- Stars
- 9.7k
- Forks
- 586
- Avg merge
- 1d 11h
- Merged PRs (30d)
- 11
Description
I'm trying to get familiar with the build process of bottlerocket, but running what seems to be the commands for a new contributor is yielding an error that feels like something has changed internally, but it hasn't made its way to the docs yet? This kind of boils down to an `index.json` not existing, it seems like that file is supposed to be generated during the build process, but I'm not sure if its an error on my part or if the build process docs aren't telling the whole story?
I'm hoping to try contributing to this project, and am trying to take good notes on what the actual build process steps are so I can try making an PR for documentation updates with info a total newb like myself would appreciate. So any and all feedback/context on this is welcome!
PS: I have tried building this in a few different ways so far, including directly on my macos, from an ubuntu Vm, this ubuntu LXC, and even a docker container. They have all failed, but with slightly different errors so far. I figured I should only try creating one issue for now and picked this one since it seems the easiest to replicate.
**Platform I'm building on:**
```bash
# About my System
$ uname -a
Linux ubuntu 6.10.7-orbstack-00280-gd3b7ec68d3d4 #2 SMP Mon Sep 2 03:51:24 UTC 2024 x86_64 x86_64 x86_64 GNU/Linux
$ lsb_release -a
No LSB modules are available.
Distributor ID: Ubuntu
Description: Ubuntu 24.04.1 LTS
Release: 24.04
Codename: noble
$ hostnamectl
Static hostname: ubuntu
Icon name: computer-container
Chassis: container ☐
Machine ID: a6fefb6f61f244778be96c03fef9430e
Boot ID: 88b06cfa567940818cdba5df5ef6190c
Virtualization: lxc
Operating System: Ubuntu 24.04.1 LTS
Kernel: Linux 6.10.7-orbstack-00280-gd3b7ec68d3d4
Architecture: x86-64
```
**What I expected to happen:**
`cargo make` to complete successfully.
**What actually happened:**
```bash
# Trying to build the metal-dev for ARM
$ VARIANT=metal-dev
$ ARCH=aarch64
$ CORES=6
$ BR_PATH=/path/to/bottlerocket # just a convenience ENV to help with debugging
$ sudo cargo make -e BUILDSYS_VARIANT=$VARIANT -e BUILDSYS_ARCH=$ARCH -e BUILDSYS_JOBS=$CORES
[cargo-make] INFO - cargo make 0.37.16
[cargo-make] INFO - Calling cargo metadata to extract project info
[cargo-make] INFO - Cargo metadata done
[cargo-make] INFO - Build File: Makefile.toml
[cargo-make] INFO - Task: default
[cargo-make] INFO - Profile: development
[cargo-make] INFO - Running Task: install-twoliter
Found Twoliter v0.4.5 installed.
Skipping installation.
[cargo-make] INFO - Execute Command: "/path/to/bottlerocket/tools/twoliter/twoliter" "--log-level=info" "fetch" "--project-path=/path/to/bottlerocket/Twoliter.toml" "--arch=aarch64"
[2024-09-15T16:34:49Z WARN twoliter::project] A Release.toml file was found. Release.toml is deprecated. Please remove it from your project.
[2024-09-15T16:34:49Z INFO twoliter::lock] Resolving project references to check against lock file
public.ecr.aws/bottlerocket/bottlerocket-core-kit@sha256:502b175071511c643eb727d81b1538e237db663839f95cf91951bff56e3b5efa: Pulling from bottlerocket/bottlerocket-core-kit
35be9e349dd5: Pulling fs layer
...
33770f63d6bd: Waiting
...
264ad05621e6: Pull complete
...
Digest: sha256:502b175071511c643eb727d81b1538e237db663839f95cf91951bff56e3b5efa
Status: Downloaded newer image for public.ecr.aws/bottlerocket/bottlerocket-core-kit@sha256:502b175071511c643eb727d81b1538e237db663839f95cf91951bff56e3b5efa
public.ecr.aws/bottlerocket/bottlerocket-core-kit@sha256:502b175071511c643eb727d81b1538e237db663839f95cf91951bff56e3b5efa
public.ecr.aws/bottlerocket/bottlerocket-core-kit@sha256:be8fe3bdd66abed30aac76155246b99505a5e3cd8099be25b858c993c563be2b: Pulling from bottlerocket/bottlerocket-core-kit
fd14c67319ca: Pulling fs layer
...
1606b6590baf: Waiting
...
fee32fc19fdb: Pull complete
...
Digest: sha256:be8fe3bdd66abed30aac76155246b99505a5e3cd8099be25b858c993c563be2b
Status: Downloaded newer image for public.ecr.aws/bottlerocket/bottlerocket-core-kit@sha256:be8fe3bdd66abed30aac76155246b99505a5e3cd8099be25b858c993c563be2b
public.ecr.aws/bottlerocket/bottlerocket-core-kit@sha256:be8fe3bdd66abed30aac76155246b99505a5e3cd8099be25b858c993c563be2b
[2024-09-15T16:37:32Z INFO twoliter::lock] Extracting kit dependencies. dependencies=["bottlerocket-core-kit-2.5.0@bottlerocket (public.ecr.aws/bottlerocket/bottlerocket-core-kit:v2.5.0)"]
[2024-09-15T16:37:32Z INFO twoliter::lock] Extracting kit 'bottlerocket-core-kit-2.5.0@bottlerocket (public.ecr.aws/bottlerocket/bottlerocket-core-kit:v2.5.0)' to '/path/to/bottlerocket/build/external-kits'
public.ecr.aws/bottlerocket/bottlerocket-core-kit@sha256:502b175071511c643eb727d81b1538e237db663839f95cf91951bff56e3b5efa: Pulling from bottlerocket/bottlerocket-core-kit
Digest: sha256:502b175071511c643eb727d81b1538e237db663839f95cf91951bff56e3b5efa
Status: Image is up to date for public.ecr.aws/bottlerocket/bottlerocket-core-kit@sha256:502b175071511c643eb727d81b1538e237db663839f95cf91951bff56e3b5efa
public.ecr.aws/bottlerocket/bottlerocket-core-kit@sha256:502b175071511c643eb727d81b1538e237db663839f95cf91951bff56e3b5efa
Error: Unable to read from '/path/to/bottlerocket/bottlerocket/build/external-kits/cache/sha256-502b175071511c643eb727d81b1538e237db663839f95cf91951bff56e3b5efa/index.json'
Caused by:
No such file or directory (os error 2)
Error while executing command, exit code: 1
```
**Me looking for the missing file (just in case lol)**
```bash
# Looking for 'index.json'
ls $BR_PATH/bottlerocket/build/external-kits/cache/sha256-502b175071511c643eb727d81b1538e237db663839f95cf91951bff56e3b5efa/
... ...
2748f06e1ee6e8e749ec4defce2451b1556f1a64401bcb8512886afbebf4c36d.json
manifest.json
```
**Could be crazy, but does this look like what should be in `index.json`?**
```bash
# Checking contents of 2748f06e1ee6e8e749ec4defce2451b1556f1a64401bcb8512886afbebf4c36d.json
$ jq '.' $BR_PATH/build/external-kits/cache/sha256-502b175071511c643eb727d81b1538e237db663839f95cf91951bff56e3b5efa/2748f06e1ee6e8e749ec4defce2451b1556f1a64401bcb8512886afbebf4c36d.json
{
"architecture": "arm64",
"config": {
"Env": [],
"WorkingDir": "/",
"OnBuild": null,
"Labels": {
"dev.bottlerocket.kit.v1": "eyJraXQiOltdLCJuYW1lIjoiYm90dGxlcm9ja2V0LWNvcmUta2l0Iiwic2RrIjp7ImRpZ2VzdCI6IkNJeC9HNzRXK0llNGdkSjQwRC9OL1VieVE5SnF3Vk9kLzlJSDRydTN6WWs9IiwibmFtZSI6ImJvdHRsZXJvY2tldC1zZGsiLCJzb3VyY2UiOiJwdWJsaWMuZWNyLmF3cy9ib3R0bGVyb2NrZXQvYm90dGxlcm9ja2V0LXNkazp2MC40NS4wIiwidmVuZG9yIjoiYm90dGxlcm9ja2V0IiwidmVyc2lvbiI6IjAuNDUuMCJ9LCJ2ZXJzaW9uIjoiMi41LjAifQo="
}
},
"created": "2024-09-11T19:39:45.780104584Z",
"history": [],
"os": "linux",
"rootfs": {
"type": "layers",
"diff_ids": [ # size == 122 layers
"sha256:",
...
"sha256:", # 120 times
...
"sha256:"
]
}
}
```
**How to reproduce the problem:**
1. Use an `ubuntu 24.04.1 LTS` image
2. Install dependencies
> ```bash
> sudo apt update && apt upgrade -y
> sudo apt install -y --no-install-recommends docker.io docker-buildx
> sudo apt install -y build-essential openssl libssl-dev pkg-config liblz4-tool
> sudo apt install -y rustup git curl yq
> ```
3. install rust stable & cargo-make
> ```bash
> sudo rustup install stable
> sudo rustup default stable
> sudo cargo install cargo-make
> ```
4. Set build ENVs
> ```bash
> VARIANT=metal-dev
> ARCH=aarch64
> CORES=6
> LOGFILE=issue-4195.$(grep PRETTY_NAME /etc/os-release | cut -f 2 -d= | tr ' ' '-').log
> ```
5. Clone the repo
> ```bash
> git clone https://github.com/bottlerocket-os/bottlerocket
> cd bottlerocket
> BR_PATH=$(pwd) # just a convenience ENV to help with debugging
> ```
6. Run the build
> ```bash
> CARGO_PROFILE_DEV_BUILD_OVERRIDE_DEBUG=true \
> RUST_BACKTRACE=full \
> sudo cargo make -e BUILDSYS_VARIANT=$VARIANT -e BUILDSYS_ARCH=$ARCH -e BUILDSYS_JOBS=$CORES 2>&1 | tee $LOGFILE
> ```
Contributor guide
Assessment
This issue has not been assessed yet.