Come for the products,
stay for the community

The Atlassian Community can help you and your team get more value out of Atlassian products and practices.

Atlassian Community about banner
Community Members
Community Events
Community Groups

Unable to run 32-bit executable on Ubuntu 16.04 on Pipelines



I'm having an issue with running a 32-bit executable built with GCC inside a Bitbucket pipeline using the atlassian/default-image:2 image:


+ file /usr/local/bin/pawncc/usr/local/bin/pawncc: ELF 32-bit LSB executable, Intel 80386, version 1 (SYSV), dynamically linked, interpreter /lib/, for GNU/Linux 2.6.24, BuildID[sha1]=1df4edb3e7046c89aaac29df60750a897c3e0540, not stripped
+ ldd /usr/local/bin/pawncc	not a dynamic executable

LDD says that it's "not a dynamic executable".

Do I need to install some extra packages to run 32-bit programs? I currently have the following:

+ apt-get install -y libc6:i386 linux-libc-dev:i386 cmake gcc-multilib gcc-4.8 gcc-4.8-multilib g++-4.8 g++-4.8-multilib cmake snapd



Sample bitbucket-pipelines.yml that reproduces the issue:

image: atlassian/default-image:2

- step:
name: Build
- uname -a
- cat /etc/lsb-release
- dpkg --add-architecture i386
- apt-get update -qq
- apt-get install -y binfmt-support file wget libc6-i386 linux-libc-dev:i386 gcc gcc-multilib
- echo 'int main() { printf("Hello, world!"); }' >> test.c
- gcc -m32 test.c -o test
- ./test


bash: ./test: cannot execute binary file: Exec format error

3 answers

1 vote

If ldd is reporting it's not a valid executable, then it's been built incorrectly for the current architecture, or you are missing supporting libraries in the running environment.

While this running inside a bitbucket pipeline, it's not really a bitbucket question - there's something missing from the environment or the compile

The executable is built correctly - I'm using the same script on Travis CI and it's working

Ok, that's one thing fixed or ruled out.  The next question has to be what is the difference between your Travis environment and the Bitbucket pipeline environment?

No idea... I even ran the same Docker image as Pipelines uses on my computer with the same set of commands, and it worked for me there

I've just tried using a i386 image of ubuntu (i386/ubuntu:xenial) and it failed as well, but this time during build initialization stage:

standard_init_linux.go:211exec user process caused "exec format error"time="2021-05-14T13:04:46Z" level=error msg="init failed" error="standard_init_linux.go:211exec user process caused \"exec format error\"" name=kata-agent pid=1 source=agentpanic--this line should have never been executed, congratulations--goroutine 1 [running, locked to thread]:main.init.0()  /go/src/ +0x10f+ umask 000+ GIT_LFS_SKIP_SMUDGE=1 retry 6 git clone --branch="master" --depth 50 https://x-token-auth:$$BITBUCKET_REPO_FULL_NAME.git $BUILD_DIRCloning into '/opt/atlassian/pipelines/agent/build'... 

No, it's the same answer - the environment you've got is different somehow, the one in your pipeline can't run the executable because it doesn't support that type of executable like the other test environments do.

I suspect that Bitbucket runs some script that modifies the default environment of the container, because the same build scripts run PERFECTLY when I using Docker with the same image (atlassian/default-image). Or maybe Pipelines run docker with some weird options that prevent 32-bit support or something.

@Zeex @mfkenney Did you find a solution or workaround for this? 


I've run into exactly the same issue and have come to the same conclusion. Bitbucket Pipelines must run the docker containers with a different configuration or in an environment that doesn't support 32-bit executables. 

We've created our own docker image as follows:

FROM ubuntu:20.04

RUN dpkg --add-architecture i386 && \
    apt-get update && \
    apt-get install -y build-essential libc6-i386 libstdc++6 unzip git libgit2-dev python3 python3-pip python3-cffi


When running this docker image on Windows using WSL then the build script works fine.

However, when running the same scripts inside Bitbucket Pipelines then there is an error:

bash: /opt/mspgcc/bin/msp430-gcc: cannot execute binary file: Exec format error

Yes, I emailed Bitbucket support and they were able to enable 32-bit for my pipeline

Like Jason likes this

@Zeex Just FYI, I ran into the same problem. I have a 64-bit Debian container image with some 32-bit executables (an old GCC cross compiler). The image works on every Docker installation I've tried except Bitbucket. My work-around is to use a self-hosted pipeline runner -- the image runs fine.

I have no idea how Bitbucket is running the images in their Cloud but they must be doing something non-standard ...

Suggest an answer

Log in or Sign up to answer

Atlassian Community Events