Skip to content

Commit 0c38075

Browse files
fix CI: locate bpftool binary and add it to PATH manually
linux-tools-generic's update-alternatives symlink for bpftool doesn't fire on GitHub-hosted runners, since their kernel version has no matching linux-tools-<version> package.
1 parent 75e82db commit 0c38075

1 file changed

Lines changed: 12 additions & 1 deletion

File tree

.github/workflows/test.yml

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,8 +26,19 @@ jobs:
2626
sudo apt-get update
2727
# bpftool isn't an installable package by itself on Ubuntu: it's a
2828
# virtual package provided by linux-tools-common + a kernel-flavor
29-
# linux-tools-<flavor> package.
29+
# linux-tools-<flavor> package. The runner's exact kernel version
30+
# has no matching linux-tools-<version> package, so the
31+
# update-alternatives symlink for `bpftool` doesn't get set up;
32+
# find whatever binary the generic-flavor package installed and
33+
# put it on PATH ourselves.
3034
sudo apt-get install -y clang llvm libclang-dev linux-tools-common linux-tools-generic
35+
bpftool_bin=$(sudo find /usr/lib/linux-tools* -name bpftool -type f 2>/dev/null | head -1)
36+
if [ -z "$bpftool_bin" ]; then
37+
echo "::error::Could not find a bpftool binary after installing linux-tools-generic"
38+
exit 1
39+
fi
40+
sudo ln -sf "$bpftool_bin" /usr/local/bin/bpftool
41+
bpftool version
3142
3243
- name: Install uv
3344
run: pip install uv

0 commit comments

Comments
 (0)