Search code examples
dockerlocalstack

How do I fix Localstack SIGILL Error on Apple Silicon


EDIT: this issue seems to be tracked here: https://github.com/localstack/localstack/issues/12054

I'm trying to run awslocal with localstack. I am running MacOS on an M4 Pro.

I am starting localstack using localstack start, then running awslocal dynamodb list-tables. This command gets stuck with no output, and the docker container gives me a huge error message - the relevant parts of which are:

LocalStack version: 4.0.4.dev126 LocalStack build date: 2025-01-23 LocalStack build git hash: bdfdf1509

Ready. ERROR: '['java', '-XX:+UnlockDiagnosticVMOptions', '-XX:+PrintFlagsFinal', '-version']': exit code -6; output: b'[Global flags]\n bool AbortVMOnCompilationFailure = false
{diagnostic} {default}\n ccstr AbortVMOnException

...

{product} {default}\n#\n# A fatal error has been detected by the Java Runtime Environment:\n#\n# SIGILL (0x4) at pc=0x0000ffff9c53fc5c, pid=36, tid=37\n#\n# JRE version: (21.0.5+11) (build )\n# Java VM: OpenJDK 64-Bit Server VM (21.0.5+11-LTS, mixed mode, tiered, compressed oops, compressed class ptrs, g1 gc, linux-aarch64)\n# Problematic frame:\n# j java.lang.System.registerNatives()V+0 java.base\n#\n# No core dump will be written. Core dumps have been disabled. To enable core dumping, try "ulimit -c unlimited" before starting Java again\n#\n# An error report file with more information is saved as:\n# /opt/code/localstack/hs_err_pid36.log\n[0.021s][warning][os] Loading hsdis library failed\n#\n# The crash happened outside the Java Virtual Machine in native code.\n# See problematic frame for where to report the bug.\n#\n' 2025-01-23T15:51:04.597 INFO --- [-functhread3] localstack.utils.run : Restarting process (received exit code -6): ['java', '-Xmx256m', '-javaagent:/usr/lib/localstack/dynamodb-local/2/ddb-local-loader-0.1.jar', '-Djava.library.path=/usr/lib/localstack/dynamodb-local/2/DynamoDBLocal_lib', '-jar', '/usr/lib/localstack/dynamodb-local/2/DynamoDBLocal.jar', '-port', '33403', '-dbPath', '/tmp/localstack/state/dynamodb']

and then repeatedly:

2025-01-23T15:51:05.345 INFO --- [-functhread3] localstack.utils.run : Restarting process (received exit code -6): ['java', '-Xmx256m', '-javaagent:/usr/lib/localstack/dynamodb-local/2/ddb-local-loader-0.1.jar', '-Djava.library.path=/usr/lib/localstack/dynamodb-local/2/DynamoDBLocal_lib', '-jar', '/usr/lib/localstack/dynamodb-local/2/DynamoDBLocal.jar', '-port', '33403', '-dbPath', '/tmp/localstack/state/dynamodb']

Note especially

fatal error has been detected by the Java Runtime Environment:\n#\n# SIGILL

Which suggests it's an architecture mismatch?

I installed localstack using brew install localstack/tap/localstack-cli. Installed Docker using Docker Desktop. I installed awslocal in a venv using pip install "awscli-local[ver1]"

I tried alternative ways of installing, eg brew install awscli-local together with brew install awscli@1. I tried reinstalling Docker. I tried all combinations of the following settings in Docker:

  • Virtual Machine Manager: Docker VMM or Apple Virtualization framework
  • Use Rosetta for x86_64/amd64 emulation on Apple Silicon on or off
  • VirtioFS, gRPC FUSE or osxfs (Legacy) for file sharing implementation

I tried installing localstack via docker-compose, using image: localstack/localstack:latest-arm64

I tried clearing my docker cache, deleting docker images, containers and volumes, deleting ~/Library/Caches/localstack/volume, making sure I pull localstack/localstack:latest as suggested here: https://github.com/localstack/localstack/issues/8058

None of which changed the error in any way. What might I be doing wrong?


Solution

  • This seems to be a bug in the localstack:latest-arm64 image that affects M4 processors. A possible workaround is enabling Rosetta in Docker and using the localstack:latest-amd64 image instead, as in

    docker run \
      --rm -it \
      -p 127.0.0.1:4566:4566 \
      -p 127.0.0.1:4510-4559:4510-4559 \
      -v /var/run/docker.sock:/var/run/docker.sock \
      localstack/localstack:latest-amd64
    

    This is being discussed here: https://github.com/localstack/localstack/issues/12054