Skip to content

Commit 6bde630

Browse files
committed
fix(vm-driver): fixes BYOC sandbox creation failing with ext4-fs write access unavailable
1 parent 31807d6 commit 6bde630

2 files changed

Lines changed: 13 additions & 2 deletions

File tree

‎crates/openshell-driver-vm/scripts/openshell-vm-sandbox-init.sh‎

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -243,6 +243,12 @@ setup_overlay_root() {
243243
if [ "${OPENSHELL_VM_INIT_MODE:-sandbox}" = "image-prep" ]; then
244244
prepare_guest_image_rootfs
245245
sync
246+
if mount -o remount,ro /overlay 2>/dev/null; then
247+
:
248+
else
249+
umount /overlay
250+
fi
251+
sync
246252
ts "image-prep complete"
247253
exit 0
248254
fi
@@ -252,7 +258,7 @@ setup_overlay_root() {
252258

253259
local lower_root="/lower"
254260
if [ -b /dev/vdc ]; then
255-
mount -t ext4 -o ro /dev/vdc /image-cache
261+
mount -t ext4 -o ro,noload /dev/vdc /image-cache
256262
if [ -d /image-cache/image-rootfs ]; then
257263
lower_root="/image-cache/image-rootfs"
258264
ts "using prepared image rootfs lowerdir"

‎crates/openshell-driver-vm/src/runtime.rs‎

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1057,7 +1057,12 @@ impl VmContext {
10571057
self.ctx_id,
10581058
image_block_id_c.as_ptr(),
10591059
image_disk_c.as_ptr(),
1060-
true,
1060+
// Attach as writable at the hypervisor level so the
1061+
// kernel can replay the ext4 journal if the image-prep
1062+
// VM did not unmount cleanly. The guest still mounts
1063+
// the filesystem with -o ro, so guest processes cannot
1064+
// write to it. See: openshell-vm-sandbox-init.sh
1065+
false,
10611066
)
10621067
},
10631068
"krun_add_disk",

0 commit comments

Comments
 (0)