pack
pack copied to clipboard
`pack build` segfaults on M2 mac + podman
Summary
pack build
segfaults on M2 mac + podman
Reproduction
Steps
- follow pack + podman setup guide - https://buildpacks.io/docs/for-app-developers/how-to/special-cases/build-on-podman/
-
pack build sample-app -p samples/apps/ruby-bundler/ -B cnbs/sample-builder:jammy
- 💥
Current behavior
...
[builder] [DEPRECATED] The `--path` flag is deprecated because it relies on being remembered across bundler invocations, which bundler will no longer do in future versions. Instead please use `bundle config set --local path '/layers/samples_ruby-bundler/bundler'`, and stop using this flag
[builder] /layers/samples_ruby-bundler/ruby/lib/ruby/3.1.0/bundler/vendor/thor/lib/thor/shell/basic.rb:420: [BUG] Segmentation fault at 0x0000000000000000
[builder] ruby 3.1.3p185 (2022-11-24 revision 1a6b16756e) [x86_64-linux]
[builder]
[builder] -- Control frame information -----------------------------------------------
[builder] /cnb/buildpacks/samples_ruby-bundler/0.0.1/bin/build: line 55: 73 Segmentation fault (core dumped) bundle install --path "${bundler_layer_dir}" --binstubs "${bundler_layer_dir}/bin"
[builder] Timer: Builder ran for 5.887238556s and ended at 2024-03-14T16:00:36Z
[builder] ERROR: failed to build: exit status 139
ERROR: failed to build: executing lifecycle: failed with status code: 51
Expected behavior
pack build
works as documented.
Environment
pack info
❯ pack report
Pack:
Version: 0.33.2+git-f2cffc4.build-5562
OS/Arch: darwin/arm64
Default Lifecycle Version: 0.18.5
Supported Platform APIs: 0.3, 0.4, 0.5, 0.6, 0.7, 0.8, 0.9, 0.10, 0.11, 0.12
Config:
[[trusted-builders]]
name = "[REDACTED]"
[[trusted-builders]]
name = "[REDACTED]"
docker info
❯ podman info
host:
arch: arm64
buildahVersion: 1.33.5
cgroupControllers:
- cpuset
- cpu
- io
- memory
- pids
- rdma
- misc
cgroupManager: systemd
cgroupVersion: v2
conmon:
package: conmon-2.1.10-1.fc39.aarch64
path: /usr/bin/conmon
version: 'conmon version 2.1.10, commit: '
cpuUtilization:
idlePercent: 93.47
systemPercent: 4.66
userPercent: 1.87
cpus: 4
databaseBackend: sqlite
distribution:
distribution: fedora
variant: coreos
version: "39"
eventLogger: journald
freeLocks: 2046
hostname: localhost.localdomain
idMappings:
gidmap: null
uidmap: null
kernel: 6.7.7-200.fc39.aarch64
linkmode: dynamic
logDriver: journald
memFree: 16291729408
memTotal: 16724766720
networkBackend: netavark
networkBackendInfo:
backend: netavark
dns:
package: aardvark-dns-1.10.0-1.fc39.aarch64
path: /usr/libexec/podman/aardvark-dns
version: aardvark-dns 1.10.0
package: netavark-1.10.3-1.fc39.aarch64
path: /usr/libexec/podman/netavark
version: netavark 1.10.3
ociRuntime:
name: crun
package: crun-1.14.3-1.fc39.aarch64
path: /usr/bin/crun
version: |-
crun version 1.14.3
commit: 1961d211ba98f532ea52d2e80f4c20359f241a98
rundir: /run/crun
spec: 1.0.0
+SYSTEMD +SELINUX +APPARMOR +CAP +SECCOMP +EBPF +CRIU +LIBKRUN +WASM:wasmedge +YAJL
os: linux
pasta:
executable: /usr/bin/pasta
package: passt-0^20240220.g1e6f92b-1.fc39.aarch64
version: |
pasta 0^20240220.g1e6f92b-1.fc39.aarch64-pasta
Copyright Red Hat
GNU General Public License, version 2 or later
<https://www.gnu.org/licenses/old-licenses/gpl-2.0.html>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.
remoteSocket:
exists: true
path: /run/podman/podman.sock
security:
apparmorEnabled: false
capabilities: CAP_CHOWN,CAP_DAC_OVERRIDE,CAP_FOWNER,CAP_FSETID,CAP_KILL,CAP_NET_BIND_SERVICE,CAP_SETFCAP,CAP_SETGID,CAP_SETPCAP,CAP_SETUID,CAP_SYS_CHROOT
rootless: false
seccompEnabled: true
seccompProfilePath: /usr/share/containers/seccomp.json
selinuxEnabled: true
serviceIsRemote: true
slirp4netns:
executable: /usr/bin/slirp4netns
package: slirp4netns-1.2.2-1.fc39.aarch64
version: |-
slirp4netns version 1.2.2
commit: 0ee2d87523e906518d34a6b423271e4826f71faf
libslirp: 4.7.0
SLIRP_CONFIG_VERSION_MAX: 4
libseccomp: 2.5.3
swapFree: 0
swapTotal: 0
uptime: 0h 0m 26.00s
variant: v8
plugins:
authorization: null
log:
- k8s-file
- none
- passthrough
- journald
network:
- bridge
- macvlan
- ipvlan
volume:
- local
registries:
search:
- docker.io
store:
configFile: /usr/share/containers/storage.conf
containerStore:
number: 0
paused: 0
running: 0
stopped: 0
graphDriverName: overlay
graphOptions:
overlay.imagestore: /usr/lib/containers/storage
overlay.mountopt: nodev,metacopy=on
graphRoot: /var/lib/containers/storage
graphRootAllocated: 106769133568
graphRootUsed: 3505274880
graphStatus:
Backing Filesystem: xfs
Native Overlay Diff: "false"
Supports d_type: "true"
Supports shifting: "true"
Supports volatile: "true"
Using metacopy: "true"
imageCopyTmpDir: /var/tmp
imageStore:
number: 4
runRoot: /run/containers/storage
transientStore: false
volumePath: /var/lib/containers/storage/volumes
version:
APIVersion: 4.9.3
Built: 1708357248
BuiltTime: Mon Feb 19 16:40:48 2024
GitCommit: ""
GoVersion: go1.21.7
Os: linux
OsArch: linux/arm64
Version: 4.9.3
Using Docker Desktop or Colima, it works
Hi @mpern.
But it looks like it is a problem with our sample ruby buildpack on ARM
There are some documentation around some buildpacks and builders available for ARM arquitectura, like the one from Daniel or Dshaun you can give it a try also.
I don't think it's the buildpack.
After switching to colima to manage my docker runtime, it "just works"
> colima start --cpu 4 --memory 16
> export DOCKER_DEFAULT_PLATFORM=linux/amd64
> pack build sample-app -p sample/apps/ruby-bundler/ -B cnbs/sample-builder:jammy
...
[exporter] *** Images (df1f75d8e38e):
[exporter] sample-app
[exporter] Timer: Saving sample-app... ran for 128.743222ms and ended at 2024-03-15T10:20:37Z
[exporter] Timer: Exporter ran for 875.31219ms and ended at 2024-03-15T10:20:37Z
[exporter] Timer: Cache started at 2024-03-15T10:20:37Z
[exporter] Reusing cache layer 'samples/ruby-bundler:bundler'
[exporter] Timer: Cache ran for 1.894101ms and ended at 2024-03-15T10:20:37Z
Successfully built image sample-app
DOCKER_DEFAULT_PLATFORM=linux/amd64
I think, because you are setting your platform to be linux/amd64
, we are working to support arm
architecture, but today it is limited.
the thing is, you are trying to use the sample builder cnbs/sample-builder:jammy
, this builder is based on jammy linux/amd64
, also the ruby buildpack
is probably pointing to linux/amd64
binaries, then when you try to run that on linux/arm
you get into issues, because you need a builder/buildpacks that are compliant for arm
architecture. This is a known issue, and we are working on that direction. (see this RFC).
That's why I suggested to try to use the builders from Daniel or DShaun because they already did the job to compile, some of them, for arm
architecture.
If you run pack build
and you uses a compliant arm
builder and buildpacks, you should be able to get your app image built correctly