kairos-io / kairos

:penguin: The immutable Linux meta-distribution for edge Kubernetes.
https://kairos.io
Apache License 2.0
1.13k stars 97 forks source link

[Auroraboot][mac] Setting the state_dir option fails to build an iso #1695

Open Itxaka opened 1 year ago

Itxaka commented 1 year ago

Runninng

docker run --platform linux/amd64 \
             -v "$PWD"/build:/tmp/auroraboot \
             --rm -ti quay.io/kairos/auroraboot:v0.2.5 \
             --set container_image=quay.io/kairos/core-ubuntu-22-lts-k3s:v1.26.4-k3s1 \
             --set "disable_http_server=true" \
             --set "disable_netboot=true" \
             --set "state_dir=/tmp/auroraboot"

From a Mac with M1/M2 chip fails to build:

5:43PM ERR Failed generating iso 'kairos' from '/tmp/auroraboot/temp-rootfs'. Error: exit status 1
1 error occurred:
    * exit status 1\
# itxaka @ Itxakas-MacBook-Air in ~/projects [20:16:00] C:1
$ docker run --platform linux/amd64 \
             -v "$PWD"/build:/tmp/auroraboot \
             --rm -ti quay.io/kairos/auroraboot:v0.2.5 \
             --set container_image=quay.io/kairos/core-ubuntu-22-lts-k3s:v1.26.4-k3s1 \
             --set "disable_http_server=true" \
             --set "disable_netboot=true" --debug \
             --set "state_dir=/tmp/auroraboot"
6:16PM DBG
6:16PM DBG 1.
6:16PM DBG  <prepare-iso> (background: false)
6:16PM DBG  <prepare-netboot> (background: false)
6:16PM DBG  <prepare-temp> (background: false)
6:16PM DBG
6:16PM DBG 2.
6:16PM DBG  <container-pull> (background: false)
6:16PM DBG  <copy-cloud-config> (background: false)
6:16PM DBG
6:16PM DBG 3.
6:16PM DBG  <gen-iso> (background: false)
6:16PM DBG
6:16PM DBG 4.
6:16PM DBG
6:16PM DBG 5.
6:16PM DBG
6:16PM INF Pulling container image 'quay.io/kairos/core-ubuntu-22-lts-k3s:v1.26.4-k3s1' to '/tmp/auroraboot/temp-rootfs' (local: false)
6:16PM DBG Output ' INFO   Downloading quay.io/kairos/core-ubuntu-22-lts-k3s:v1.26.4-k3s1 to /tmp/auroraboot/temp-rootfs
  ERROR    chmod /tmp/auroraboot/temp-rootfs/etc/machine-id: permission denied
'
6:16PM ERR Failed pulling container image 'quay.io/kairos/core-ubuntu-22-lts-k3s:v1.26.4-k3s1' to '/tmp/auroraboot/temp-rootfs' (local: false): exit status 1
2 errors occurred:
    * exit status 1
    * 'gen-iso' deps container-pull failed

removing the state_dir option makes it work with no issues.

Itxaka commented 1 year ago

Not happening under linux

mudler commented 1 year ago

documentation issue?

allenporter commented 10 months ago

I also ran into this on mac and it seems like there is a problem writing to the bind mount for the flag

 -v "$PWD"/build:/tmp/auroraboot

I assume the reason why removing the state dir config works is because it writes to /tmp/ instead by default which is not in the bind mount directory.

As an alternative that worked for me, you can create a docker volume to store data for reuse across builds like -v auroraboot-tmp:/tmp/auroraboot