Skip to content

Title: Claude CLI fails to install - musl libc compatibility issue with Alpine base image #57

@hack2spider

Description

@hack2spider

Description

The Claude Terminal add-on fails to build due to a musl libc compatibility issue. The Claude CLI binary requires posix_getdents which is not available in the musl version shipped with the Alpine-based Home Assistant base images.

Error

#7 [3/8] RUN curl -fsSL https://claude.ai/install.sh | bash && ln -sf /root/.local/bin/claude /usr/local/bin/claude
#7 6.741 Error relocating /root/.claude/downloads/claude-2.1.63-linux-x64-musl: posix_getdents: symbol not found
#7 ERROR: process "/bin/ash -o pipefail -c curl -fsSL https://claude.ai/install.sh | bash && ln -sf /root/.local/bin/claude /usr/local/bin/claude" did not complete successfully: exit code: 127

Environment

  • Home Assistant OS (Supervisor)
  • Architecture: amd64

Root Cause

The add-on currently uses Alpine-based images (ghcr.io/home-assistant/amd64-base:3.19) which use musl libc. The Claude CLI binary is compiled against a newer musl version that includes posix_getdents, causing a symbol resolution
failure.

Suggested Fix

Switch to Debian-based Home Assistant base images which use glibc.

build.yaml:
build_from:
aarch64: ghcr.io/home-assistant/aarch64-base-debian:bookworm
amd64: ghcr.io/home-assistant/amd64-base-debian:bookworm
armv7: ghcr.io/home-assistant/armv7-base-debian:bookworm

Dockerfile (replace apk with apt-get):
ARG BUILD_FROM
FROM ${BUILD_FROM}

RUN apt-get update && apt-get install -y --no-install-recommends
bash
curl
nano
nodejs
npm
python3
python3-pip
python3-requests
python3-aiohttp
python3-yaml
python3-bs4
git
vim
wget
jq
tree
tmux
&& rm -rf /var/lib/apt/lists/*

RUN curl -fsSL https://claude.ai/install.sh | bash
&& ln -sf /root/.local/bin/claude /usr/local/bin/claude

RUN mkdir -p /config/claude-config
WORKDIR /config

COPY run.sh /run.sh
COPY scripts/ /opt/scripts/
RUN chmod +x /run.sh
&& chmod +x /opt/scripts/*.sh

CMD ["/run.sh"]

Note: yq would need to be installed separately as it's not in Debian's default repos (can use pip install yq or download the binary).

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions