Skip to content

YC (S26) | Open Computer History | Continuously record your company computer work, map your workflows, help you find work worth automating, and power your agents' context

fix(ci): force-reinstall libopenblas if apt cache skips dpkg metadata

Louis Beaumontbcb4cc126c16
diff --git a/.github/workflows/e2e-test.yml b/.github/workflows/e2e-test.yml
index 335e70cd5..6cdf38ce3 100644
--- a/.github/workflows/e2e-test.yml
+++ b/.github/workflows/e2e-test.yml
@@ -206,23 +206,35 @@ jobs:
sudo mkdir -p /usr/lib/x86_64-linux-gnu/openblas/lib
sudo mkdir -p /usr/lib/x86_64-linux-gnu/openblas/include
- # Ubuntu 24.04 (noble) moved the libopenblas shared object under
- # /usr/lib/x86_64-linux-gnu/openblas-pthread/ (with update-alternatives
- # managing the visible path), so the hard-coded /usr/lib/x86_64-linux-gnu/libopenblas.so
- # assumed here doesn't always exist. Resolve the real path from dpkg
- # instead, and fall back to a find for robustness.
- REAL_SO="$(dpkg -L libopenblas-dev | grep -E '/libopenblas\.so$' | head -1 || true)"
- if [ -z "$REAL_SO" ] || [ ! -e "$REAL_SO" ]; then
- REAL_SO="$(find /usr/lib -maxdepth 4 -name 'libopenblas.so*' -type f 2>/dev/null | head -1 || true)"
- fi
- REAL_A="$(dpkg -L libopenblas-dev | grep -E '/libopenblas\.a$' | head -1 || true)"
+ # The apt cache action sometimes restores files onto disk without
+ # updating the dpkg database, so `dpkg -L libopenblas-dev` can come
+ # back empty. And the libopenblas layout differs across Ubuntu
+ # releases — 24.04 (noble) moved the real .so under /usr/lib/.../openblas-pthread/
+ # with update-alternatives managing the visible path. Find it by
+ # pattern across both layouts, and force a fresh install if nothing
+ # is on disk at all.
+ find_openblas_so() {
+ find /usr/lib /usr/local/lib /lib 2>/dev/null \
+ \( -name 'libopenblas.so' -o -name 'libopenblas.so.*' \) \
+ -print 2>/dev/null | head -1
+ }
- if [ -z "$REAL_SO" ] || [ ! -e "$REAL_SO" ]; then
- echo "::error::libopenblas.so not found after installing libopenblas-dev"
- dpkg -L libopenblas-dev | grep -E '\.(so|a)(\.[0-9]+)?$' || true
+ REAL_SO="$(find_openblas_so)"
+ if [ -z "$REAL_SO" ]; then
+ echo "libopenblas not found on disk — forcing fresh install"
+ sudo apt-get update -qq
+ sudo apt-get install -y --reinstall libopenblas-dev
+ REAL_SO="$(find_openblas_so)"
+ fi
+ if [ -z "$REAL_SO" ]; then
+ echo "::error::libopenblas still not found after --reinstall"
+ dpkg -L libopenblas-dev 2>/dev/null | head -20 || true
+ find /usr/lib /usr/local/lib /lib -name 'libopenblas*' 2>/dev/null | head -20 || true
exit 1
fi
echo "libopenblas.so -> $REAL_SO"
+
+ REAL_A="$(find /usr/lib /usr/local/lib /lib -name 'libopenblas.a' 2>/dev/null | head -1 || true)"
[ -n "$REAL_A" ] && echo "libopenblas.a -> $REAL_A"
sudo ln -sf "$REAL_SO" /usr/lib/x86_64-linux-gnu/openblas/lib/liblibopenblas.so
@@ -235,7 +247,7 @@ jobs:
sudo ln -sf "$REAL_SO" /usr/lib/x86_64-linux-gnu/liblibopenblas.so
[ -n "$REAL_A" ] && sudo ln -sf "$REAL_A" /usr/lib/x86_64-linux-gnu/liblibopenblas.a
- # Sanity check: mold-style lookup — the symlinks must resolve.
+ # Sanity check: the symlinks must be non-dangling (-e follows links).
test -e /usr/lib/x86_64-linux-gnu/liblibopenblas.so
test -e /usr/lib/x86_64-linux-gnu/openblas/lib/liblibopenblas.so
ls -la /usr/lib/x86_64-linux-gnu/liblibopenblas.* /usr/lib/x86_64-linux-gnu/openblas/lib/liblibopenblas.*