From 34bd348f254ae77a898e284612897d72a043f582 Mon Sep 17 00:00:00 2001 From: EnderIce2 Date: Tue, 25 Mar 2025 15:18:43 +0000 Subject: [PATCH] fix(devcontainer): qemu cannot access /dev/kvm "failed to initialize kvm: Permission denied" Signed-off-by: EnderIce2 --- .devcontainer/Dockerfile | 2 ++ .devcontainer/devcontainer.json | 5 ++--- Makefile | 4 ++-- 3 files changed, 6 insertions(+), 5 deletions(-) diff --git a/.devcontainer/Dockerfile b/.devcontainer/Dockerfile index 2195bc15..e0b9929f 100644 --- a/.devcontainer/Dockerfile +++ b/.devcontainer/Dockerfile @@ -120,3 +120,5 @@ ENV NO_AT_BRIDGE=1 RUN <> /etc/profile EOF + +ENV CHMOD_KVM=1 diff --git a/.devcontainer/devcontainer.json b/.devcontainer/devcontainer.json index 0946553d..1f1ff4cf 100644 --- a/.devcontainer/devcontainer.json +++ b/.devcontainer/devcontainer.json @@ -32,7 +32,7 @@ "type": "bind" }, { - "source": "${localEnv:XAUTHORITY}", + "source": "${env:XAUTHORITY}", "target": "/home/vscode/.Xauthority", "type": "bind" }, @@ -44,6 +44,5 @@ ], "runArgs": [ "--privileged" - ], - "postAttachCommand": "sudo chmod 666 /dev/kvm" + ] } diff --git a/Makefile b/Makefile index 2e9bb5c8..3448cc7e 100644 --- a/Makefile +++ b/Makefile @@ -354,12 +354,12 @@ vscode_debug: build_kernel build_userspace build_drivers build_image vscode_debu debug: vscode_debug -qemu: qemu_vdisk clean_logs +qemu: qemu_vdisk clean_logs check_chmod_kvm touch serial.log # x-terminal-emulator -e tail -f serial.log & $(QEMU) $(QEMU_UEFI_BIOS) -cpu host $(QEMUFLAGS) $(QEMUHWACCELERATION) $(QEMUMEMORY) $(QEMU_SMP) -qemubios: qemu_vdisk clean_logs +qemubios: qemu_vdisk clean_logs check_chmod_kvm $(QEMU) -cpu host $(QEMUFLAGS) $(QEMUHWACCELERATION) $(QEMUMEMORY) $(QEMU_SMP) run: build qemu