Skip to content

Commit de00b80

Browse files
committed
Improve chroot cleanup & fix image references
1 parent 7b99986 commit de00b80

2 files changed

Lines changed: 23 additions & 13 deletions

File tree

images/scripts/build-toolchain.sh

Lines changed: 13 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -67,10 +67,19 @@ if [[ -z "$OUTPUT_DIR" ]]; then
6767
OUTPUT_DIR="$(dirname "$ROOTFS")"
6868
fi
6969

70+
kill_chroot_procs() {
71+
# Kill any processes still referencing the mount point
72+
if [[ -n "$MOUNT_POINT" ]]; then
73+
fuser -km "$MOUNT_POINT" 2>/dev/null || true
74+
sleep 0.5
75+
fi
76+
}
77+
7078
cleanup() {
7179
echo "Cleaning up..."
7280
if [[ -n "$MOUNT_POINT" ]] && mountpoint -q "$MOUNT_POINT" 2>/dev/null; then
73-
umount -R "$MOUNT_POINT" 2>/dev/null || true
81+
kill_chroot_procs
82+
umount -R "$MOUNT_POINT" 2>/dev/null || umount -lR "$MOUNT_POINT" 2>/dev/null || true
7483
fi
7584
if [[ -n "$MOUNT_POINT" ]] && [[ -d "$MOUNT_POINT" ]]; then
7685
rmdir "$MOUNT_POINT" 2>/dev/null || true
@@ -128,7 +137,7 @@ install_python_312() {
128137
chroot "$MOUNT_POINT" /bin/bash -c "
129138
export DEBIAN_FRONTEND=noninteractive
130139
apt-get update -qq
131-
apt-get install -y -qq --no-install-recommends software-properties-common
140+
apt-get install -y -qq --no-install-recommends software-properties-common gnupg
132141
add-apt-repository -y ppa:deadsnakes/ppa
133142
apt-get update -qq
134143
apt-get install -y -qq --no-install-recommends \
@@ -197,11 +206,12 @@ echo ">>> Cleaning up..."
197206
chroot "$MOUNT_POINT" /bin/bash -c "
198207
rm -rf /tmp/* /var/tmp/* /var/cache/apt/*
199208
"
209+
kill_chroot_procs
200210
umount "${MOUNT_POINT}/dev/pts" 2>/dev/null || true
201211
umount "${MOUNT_POINT}/dev" 2>/dev/null || true
202212
umount "${MOUNT_POINT}/sys" 2>/dev/null || true
203213
umount "${MOUNT_POINT}/proc" 2>/dev/null || true
204-
umount "$MOUNT_POINT"
214+
umount "$MOUNT_POINT" 2>/dev/null || umount -l "$MOUNT_POINT"
205215
MOUNT_POINT=""
206216

207217
# Recompute digest

packages/db/src/seed.ts

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -88,44 +88,44 @@ async function seedImages(db: Database) {
8888
id: IMAGE_IDS['ubuntu-22.04/base'],
8989
osVersion: 'ubuntu-22.04',
9090
toolchain: 'base',
91-
kernelRef: 'images/ubuntu-22.04-base/vmlinux',
92-
rootfsRef: 'images/ubuntu-22.04-base/rootfs.ext4',
91+
kernelRef: 'images/vmlinux-5.10',
92+
rootfsRef: 'images/ubuntu-22.04/base/rootfs.ext4',
9393
digest: '0000000000000000000000000000000000000000000000000000000000000000',
9494
sizeBytes: 0,
9595
},
9696
{
9797
id: IMAGE_IDS['ubuntu-22.04/node-22'],
9898
osVersion: 'ubuntu-22.04',
9999
toolchain: 'node-22',
100-
kernelRef: 'images/ubuntu-22.04-base/vmlinux',
101-
rootfsRef: 'images/ubuntu-22.04-node-22/rootfs.ext4',
100+
kernelRef: 'images/vmlinux-5.10',
101+
rootfsRef: 'images/ubuntu-22.04/node-22/rootfs.ext4',
102102
digest: '0000000000000000000000000000000000000000000000000000000000000000',
103103
sizeBytes: 0,
104104
},
105105
{
106106
id: IMAGE_IDS['ubuntu-22.04/bun'],
107107
osVersion: 'ubuntu-22.04',
108108
toolchain: 'bun',
109-
kernelRef: 'images/ubuntu-22.04-base/vmlinux',
110-
rootfsRef: 'images/ubuntu-22.04-bun/rootfs.ext4',
109+
kernelRef: 'images/vmlinux-5.10',
110+
rootfsRef: 'images/ubuntu-22.04/bun/rootfs.ext4',
111111
digest: '0000000000000000000000000000000000000000000000000000000000000000',
112112
sizeBytes: 0,
113113
},
114114
{
115115
id: IMAGE_IDS['ubuntu-22.04/python-3.12'],
116116
osVersion: 'ubuntu-22.04',
117117
toolchain: 'python-3.12',
118-
kernelRef: 'images/ubuntu-22.04-base/vmlinux',
119-
rootfsRef: 'images/ubuntu-22.04-python-3.12/rootfs.ext4',
118+
kernelRef: 'images/vmlinux-5.10',
119+
rootfsRef: 'images/ubuntu-22.04/python-3.12/rootfs.ext4',
120120
digest: '0000000000000000000000000000000000000000000000000000000000000000',
121121
sizeBytes: 0,
122122
},
123123
{
124124
id: IMAGE_IDS['ubuntu-22.04/go-1.22'],
125125
osVersion: 'ubuntu-22.04',
126126
toolchain: 'go-1.22',
127-
kernelRef: 'images/ubuntu-22.04-base/vmlinux',
128-
rootfsRef: 'images/ubuntu-22.04-go-1.22/rootfs.ext4',
127+
kernelRef: 'images/vmlinux-5.10',
128+
rootfsRef: 'images/ubuntu-22.04/go-1.22/rootfs.ext4',
129129
digest: '0000000000000000000000000000000000000000000000000000000000000000',
130130
sizeBytes: 0,
131131
},

0 commit comments

Comments
 (0)