Skip to content

Conversation

Copy link

Copilot AI commented Oct 31, 2025

Multi-platform Docker builds fail on linux/arm64 with "Exec format error" when executing ./obsidian.AppImage --appimage-extract. This occurs because ARM64 binaries cannot execute on x86_64 build hosts during cross-compilation.

Changes

  • Added squashfs-tools to dependencies for manual AppImage extraction
  • Implemented fallback extraction logic: Try native --appimage-extract first; on failure, locate squashfs filesystem within the AppImage by scanning for magic bytes ('hsqs') and extract using unsquashfs
  • Added validation to ensure offset is found before extraction
  • Documented approach with inline comments explaining AppImage structure and cross-build constraints
# Original approach - fails during cross-compilation
./obsidian.AppImage --appimage-extract

# New approach with fallback
(./obsidian.AppImage --appimage-extract || \
 (echo "Extracting AppImage manually..." && \
  offset=$(LC_ALL=C grep -aob 'hsqs' ./obsidian.AppImage | tail -1 | cut -d: -f1) && \
  test -n "$offset" && \
  tail -c +$((offset + 1)) ./obsidian.AppImage > obsidian.squashfs && \
  unsquashfs -d squashfs-root obsidian.squashfs && \
  rm obsidian.squashfs))

This ensures successful builds for both amd64 and arm64 platforms regardless of build host architecture.

Original prompt

This section details on the original issue you should resolve

<issue_title>Build failure</issue_title>
<issue_description>Describe the bug
The follow error occurs on build failure:

 > [linux/arm64 3/4] RUN echo "**** download obsidian ****" &&     curl -L -o ./obsidian.AppImage         "https://github.com/obsidianmd/obsidian-releases/releases/download/v1.8.10/Obsidian-1.8.10-arm64.AppImage" &&     chmod +x ./obsidian.AppImage &&     ./obsidian.AppImage --appimage-extract &&     rm ./obsidian.AppImage:
0.183 **** download obsidian ****
   0 --:--:-- --:--:-- --:--:--     0
5.198 /bin/sh: 1: ./obsidian.AppImage: Exec format error

This was found in the build: https://github.com/sytone/obsidian-remote/actions/runs/18983661540/job/54222163711

To Reproduce
Steps to reproduce the behavior:

Go to repo and run build.

Expected behavior
Build to succeed and publish updated images.

Screenshots
NA

Desktop (please complete the following information):

NA

Smartphone (please complete the following information):

NA

Additional context
NA</issue_description>

<agent_instructions>Look at the build issues and work out why it is failiing.</agent_instructions>

Comments on the Issue (you are @copilot in this section)


💬 We'd love your input! Share your thoughts on Copilot coding agent in our 2 minute survey.

Copilot AI and others added 2 commits October 31, 2025 20:12
Co-authored-by: sytone <1399443+sytone@users.noreply.github.com>
Co-authored-by: sytone <1399443+sytone@users.noreply.github.com>
Copilot AI changed the title [WIP] Fix build failure due to exec format error Fix ARM64 Docker build by implementing fallback AppImage extraction Oct 31, 2025
Copilot AI requested a review from sytone October 31, 2025 20:16
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Build failure

2 participants