Skip to content

Commit 08b9cff

Browse files
fix: use /proc/misc for device node detection instead of sysfs
The sysfs paths (/sys/devices/virtual/misc/kvm, /sys/class/misc/tun) don't exist in our minimal kernel config. Use /proc/misc which reliably lists registered misc devices. Fixes /dev/kvm and /dev/net/tun not being auto-created. Bump vz-cli to v0.3.3. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
1 parent 570f8e0 commit 08b9cff

3 files changed

Lines changed: 7 additions & 6 deletions

File tree

crates/Cargo.lock

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

crates/vz-cli/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[package]
22
name = "vz-cli"
3-
version = "0.3.2"
3+
version = "0.3.3"
44
description = "CLI for managing containers and macOS VM sandboxes"
55
edition.workspace = true
66
rust-version.workspace = true

linux/initramfs/init

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -14,10 +14,11 @@ mkdir -p /run /mnt/rootfs /mnt/merged
1414
# Create device nodes that devtmpfs may not auto-populate.
1515
# /dev/kvm: needed for nested virtualization (Firecracker, QEMU).
1616
# /dev/net/tun: needed for tap networking (Firecracker guest NICs).
17-
if [ -e /sys/devices/virtual/misc/kvm ] && [ ! -e /dev/kvm ]; then
17+
# Check /proc/misc since sysfs misc class may not exist in minimal configs.
18+
if grep -q ' kvm$' /proc/misc 2>/dev/null && [ ! -e /dev/kvm ]; then
1819
/bin/busybox mknod /dev/kvm c 10 232 2>/dev/null || true
1920
fi
20-
if [ -e /sys/class/misc/tun ] && [ ! -e /dev/net/tun ]; then
21+
if grep -q ' tun$' /proc/misc 2>/dev/null && [ ! -e /dev/net/tun ]; then
2122
mkdir -p /dev/net
2223
/bin/busybox mknod /dev/net/tun c 10 200 2>/dev/null || true
2324
fi
@@ -70,10 +71,10 @@ switch_root_into_overlay_rootfs() {
7071
mount -t tmpfs tmpfs "$ROOTFS/tmp" || return 1
7172

7273
# Create device nodes that devtmpfs may not auto-populate in the chroot.
73-
if [ -e /sys/devices/virtual/misc/kvm ] && [ ! -e "$ROOTFS/dev/kvm" ]; then
74+
if grep -q ' kvm$' /proc/misc 2>/dev/null && [ ! -e "$ROOTFS/dev/kvm" ]; then
7475
/bin/busybox mknod "$ROOTFS/dev/kvm" c 10 232 2>/dev/null || true
7576
fi
76-
if [ -e /sys/class/misc/tun ] && [ ! -e "$ROOTFS/dev/net/tun" ]; then
77+
if grep -q ' tun$' /proc/misc 2>/dev/null && [ ! -e "$ROOTFS/dev/net/tun" ]; then
7778
mkdir -p "$ROOTFS/dev/net"
7879
/bin/busybox mknod "$ROOTFS/dev/net/tun" c 10 200 2>/dev/null || true
7980
fi

0 commit comments

Comments
 (0)