Skip to content

Segmentation fault on GitLab CI when using qemu-user-static for arm64v8

Summary

When building a Dockerfile on GitLab CI using the shared runners targeting arm64v8 QEMU crashes with an uncaught target signal 11 (Segmentation fault).

The same happens also without Docker when doing a Debian debootstrap with qemu-user-static for arm64v8.

The problem does not occur when building locally on Ubuntu 20.04. Thus, it is likely a problem of the GitLab shared runners.

Steps to reproduce

  • Use shared runner on GitLab CI.
  • Use image docker:20.10.8 with service docker:20.10.8-dind. (20.10.6 exhibits the same issue)
  • Use qemu-user-static 6.0.0-2. (5.2.0-2 exhibits the same issue)
  • Base Docker image on debian:bullseye-slim.
  • Install Debian package libc-bin during build of image.
  • Now QEMU will crash:

See example projects below for more details. Especially @arnaudr has an excellent stripped down example which shows the same problem without Docker.

Example Project

Docker Container for Logitech Media Server

https://gitlab.com/toertel/docker-image-logitech-media-server/-/tree/feature/debian-bullseye

https://gitlab.com/toertel/docker-image-logitech-media-server/-/pipelines/359877022

Other persons with identical problem

@arnaudr: https://gitlab.com/arnaudr/test-binfmt-misc/-/pipelines/356065926/builds

https://askubuntu.com/questions/1339558/cant-build-dockerfile-for-arm64-due-to-libc-bin-segmentation-fault

What is the current bug behavior?

When installing libc-bin on Debian Bullseye on arm64v8 using GitLab CI, QEMU crashes with a segmentation fault.

What is the expected correct behavior?

Installation of libc-bin succeeds without problems like on amd64 or armv7.

Relevant logs and/or screenshots

Setting up sox (14.4.2+git20190427-2) ...
Setting up libio-socket-ssl-perl (2.069-1) ...
Processing triggers for libc-bin (2.31-13) ...
qemu: uncaught target signal 11 (Segmentation fault) - core dumped
Segmentation fault (core dumped)
qemu: uncaught target signal 11 (Segmentation fault) - core dumped
Segmentation fault (core dumped)
dpkg: error processing package libc-bin (--configure):
 installed libc-bin package post-installation script subprocess returned error exit status 139
Processing triggers for ca-certificates (20210119) ...
Updating certificates in /etc/ssl/certs...
0 added, 0 removed; done.
Running hooks in /etc/ca-certificates/update.d...
done.
Errors were encountered while processing:
 libc-bin
E: Sub-process /usr/bin/dpkg returned an error code (1)

Output of checks

This bug happens on GitLab.com.

Results of GitLab environment info

n/a

Results of GitLab application Check

n/a

Possible fixes

Wild guess: It might be fixed by updating the Linux kernel on the shared runners. The whole build process works just fine on my local Ubuntu 20.04 machine using Linux 5.4.0-81-generic #91-Ubuntu SMP.

There's a workaround available in this comment.

Edited by Manuel Grabowski