====== Docker X-compile libc-bin segfault ====== ===== Overview ===== In many of my docker containers, I use Ubuntu images as the base image. Additionally, I usually run an ''apt update'' and ''apt upgrade'' in the build steps of my container. At one point, the builds would fail with something to this effect when x-compiling for ARM (Raspberry PI): 51.42 Unpacking libc-bin (2.35-0ubuntu3.8) over (2.35-0ubuntu3.7) ... 51.89 Setting up libc-bin (2.35-0ubuntu3.8) ... 52.23 Segmentation fault (core dumped) 52.40 Segmentation fault (core dumped) 52.41 dpkg: error processing package libc-bin (--configure): 52.41 installed libc-bin package post-installation script subprocess returned e rror exit status 139 52.45 Errors were encountered while processing: 52.45 libc-bin 52.56 E: Sub-process /usr/bin/dpkg returned an error code (1) This turns out to be an issue QEMU on my linux box that I'm building these on. Now, on to the fix. ===== The Fix ===== At this point, I just added a function to my bashrc file to just fix this where it happens. function fix_docker_build() { # If there are errors processing libc-bin, run this # from https://t.brk.io/6A docker pull tonistiigi/binfmt:latest docker run --privileged --rm tonistiigi/binfmt --uninstall qemu-* docker run --privileged --rm tonistiigi/binfmt --install all } You can run the individual commands or just add this to your bashrc file (and ''source ~/.bashrc'') and then just run ''fix_docker_build'' anytime later.