obsidian-remote icon indicating copy to clipboard operation
obsidian-remote copied to clipboard

Fix ARM64 Docker build by implementing fallback AppImage extraction

Open Copilot opened this issue 4 months ago • 0 comments

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)

  • Fixes sytone/obsidian-remote#123

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

Copilot avatar Oct 31 '25 20:10 Copilot