An open-source, faster Devin alternative
TypeScript
prevent virtio module missing
Brian Reardon102f3c2e5666
diff --git a/.github/workflows/deploy-worker.yml b/.github/workflows/deploy-worker.ymlindex 727768d0..51f5c05f 100644--- a/.github/workflows/deploy-worker.yml+++ b/.github/workflows/deploy-worker.yml@@ -130,33 +130,63 @@ jobs:sudo rm -f \"\$IMAGES_DIR/default.ext4\"sudo bash deploy/ec2/build-rootfs-docker.sh /usr/local/bin/osb-agent \"\$IMAGES_DIR\" default- # Patch rootfs with kernel modules for virtio-mem support+ # Ensure generic kernel + modules are installed for virtio-mem.+ # Azure VMs ship with the azure kernel which lacks virtio_mem.+ # The generic kernel provides it.+ if ! ls -d /lib/modules/*-generic >/dev/null 2>&1; then+ echo \"No generic kernel found — installing for virtio-mem support...\"+ sudo DEBIAN_FRONTEND=noninteractive apt-get update -qq+ sudo DEBIAN_FRONTEND=noninteractive apt-get install -y -qq linux-image-generic 2>&1 | tail -3+ fi++ # Determine guest kernel versionGUEST_KVER=\"\"if [ -f /opt/opensandbox/guest-kernel-version ]; thenGUEST_KVER=\$(cat /opt/opensandbox/guest-kernel-version)elif ls -d /lib/modules/*-generic >/dev/null 2>&1; thenGUEST_KVER=\$(ls -d /lib/modules/*-generic | sort -V | tail -1 | xargs basename)fi- if [ -n \"\$GUEST_KVER\" ] && [ -d \"/lib/modules/\$GUEST_KVER\" ]; then- echo \"Patching rootfs with kernel modules for \$GUEST_KVER...\"- MNTDIR=\$(mktemp -d)- sudo mount -o loop \"\$IMAGES_DIR/default.ext4\" \"\$MNTDIR\"- sudo rm -rf \"\$MNTDIR/lib/modules\"/*- sudo cp -a \"/lib/modules/\$GUEST_KVER\" \"\$MNTDIR/lib/modules/\"- sudo depmod -b \"\$MNTDIR\" \"\$GUEST_KVER\" 2>/dev/null || true- # Create insmod symlink (busybox applet) if missing- if [ -f \"\$MNTDIR/bin/busybox\" ] && [ ! -e \"\$MNTDIR/sbin/insmod\" ]; then- sudo ln -sf /bin/busybox \"\$MNTDIR/sbin/insmod\"- fi- # Create modprobe symlink if missing- if [ -f \"\$MNTDIR/bin/busybox\" ] && [ ! -e \"\$MNTDIR/sbin/modprobe\" ]; then- sudo ln -sf /bin/busybox \"\$MNTDIR/sbin/modprobe\"++ if [ -z \"\$GUEST_KVER\" ]; then+ echo \"ERROR: Failed to find generic kernel — virtio-mem will not work\"+ exit 1+ fi++ # Patch rootfs with kernel modules+ echo \"Patching rootfs with kernel modules for \$GUEST_KVER...\"+ MNTDIR=\$(mktemp -d)+ sudo mount -o loop \"\$IMAGES_DIR/default.ext4\" \"\$MNTDIR\"+ sudo rm -rf \"\$MNTDIR/lib/modules\"/*+ sudo cp -a \"/lib/modules/\$GUEST_KVER\" \"\$MNTDIR/lib/modules/\"+ sudo depmod -b \"\$MNTDIR\" \"\$GUEST_KVER\" 2>/dev/null || true+ if [ -f \"\$MNTDIR/bin/busybox\" ] && [ ! -e \"\$MNTDIR/sbin/insmod\" ]; then+ sudo ln -sf /bin/busybox \"\$MNTDIR/sbin/insmod\"+ fi+ if [ -f \"\$MNTDIR/bin/busybox\" ] && [ ! -e \"\$MNTDIR/sbin/modprobe\" ]; then+ sudo ln -sf /bin/busybox \"\$MNTDIR/sbin/modprobe\"+ fi+ sudo umount \"\$MNTDIR\"+ rmdir \"\$MNTDIR\"+ echo \"Rootfs patched with kernel modules for \$GUEST_KVER\"++ # Update guest kernel binary to match modules version.+ # Without this, the VM boots with an old kernel that can't load+ # the modules (e.g., virtio_mem won't load).+ CURRENT_KVER=\"\"+ if [ -f /opt/opensandbox/vmlinux ]; then+ CURRENT_KVER=\$(file /opt/opensandbox/vmlinux 2>/dev/null | grep -oE '[0-9]+\\.[0-9]+\\.[0-9]+-[0-9]+-generic' || true)+ fi+ if [ \"\$CURRENT_KVER\" != \"\$GUEST_KVER\" ]; then+ if [ -f \"/boot/vmlinuz-\$GUEST_KVER\" ]; then+ echo \"Updating guest kernel: \$CURRENT_KVER → \$GUEST_KVER\"+ sudo cp /opt/opensandbox/vmlinux /opt/opensandbox/vmlinux.bak 2>/dev/null || true+ sudo cp \"/boot/vmlinuz-\$GUEST_KVER\" /opt/opensandbox/vmlinux+ else+ echo \"ERROR: /boot/vmlinuz-\$GUEST_KVER not found — kernel/module mismatch will break virtio-mem\"+ exit 1fi- sudo umount \"\$MNTDIR\"- rmdir \"\$MNTDIR\"- echo \"Rootfs patched with kernel modules for \$GUEST_KVER\"else- echo \"WARNING: No guest kernel modules found for virtio-mem\"+ echo \"Guest kernel already at \$GUEST_KVER\"fi# Delete golden snapshot so it rebuilds with new agent