Skip to content

run-apache.sh always selects aarch64 due to single-quoted command substitution in architecture check #948

Description

@ladracer

Description:
In Docker/run-apache.sh, the architecture detection compares a literal string to 'amd64' instead of comparing the output of dpkg --print-architecture:
bashif [[ '$(dpkg --print-architecture)' == 'amd64' ]]; then
CURRENTARCH=x86_64
else
CURRENTARCH=aarch64
fi
The single quotes around $(dpkg --print-architecture) prevent bash from performing command substitution. The literal string $(dpkg --print-architecture) is compared to amd64, which is always false, so CURRENTARCH is always set to aarch64.
The script then writes the architecture into the apache module path:
bashecho -e "LoadModule wsgi_module ${DA_PYTHON:-${DA_ROOT}/${DA_DEFAULT_LOCAL}}/lib/python3.12/site-packages/mod_wsgi/server/mod_wsgi-py312.cpython-312-${CURRENTARCH}-linux-gnu.so" >> /etc/apache2/conf-available/docassemble.conf
On an x86_64 host, the actual installed mod_wsgi .so is mod_wsgi-py312.cpython-312-x86_64-linux-gnu.so, but the apache config will reference the nonexistent aarch64 variant, causing apache to fail to start with:
Cannot load .../mod_wsgi-py312.cpython-312-aarch64-linux-gnu.so into server: cannot open shared object file: No such file or directory
Fix:
Change the single quotes to double quotes so command substitution happens:
bashif [[ "$(dpkg --print-architecture)" == "amd64" ]]; then
CURRENTARCH=x86_64
else
CURRENTARCH=aarch64
fi
Environment:

Image: jhpyle/docassemble
Host architecture: x86_64 (uname -m)
dpkg --print-architecture output: amd64
Python: 3.12

Workaround for affected users:
Patch the script in the running container to force the correct architecture:
bashdocker exec sed -i 's/CURRENTARCH=aarch64/CURRENTARCH=x86_64/' /usr/share/docassemble/webapp/run-apache.sh
This change does not survive a container rebuild (it modifies the in-container file, not the image), but holds across docker restart.

Confirmed present in Docker/run-apache.sh on the master branch as of May 2026.

The preceding message was created by Claude after helping me with my codebase...hope it isn't a hallucination.

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