fix(devcontainer): qemu cannot access /dev/kvm "failed to initialize kvm: Permission denied"

Signed-off-by: EnderIce2 <enderice2@protonmail.com>
This commit is contained in:
EnderIce2 2025-03-25 15:18:43 +00:00
parent d251d9d03f
commit 34bd348f25
Signed by: enderice2
GPG Key ID: FEB6B8A8507BA62E
3 changed files with 6 additions and 5 deletions

View File

@ -120,3 +120,5 @@ ENV NO_AT_BRIDGE=1
RUN <<EOF RUN <<EOF
echo PATH=$PATH:/workspaces/Fennix/cross/bin >> /etc/profile echo PATH=$PATH:/workspaces/Fennix/cross/bin >> /etc/profile
EOF EOF
ENV CHMOD_KVM=1

View File

@ -32,7 +32,7 @@
"type": "bind" "type": "bind"
}, },
{ {
"source": "${localEnv:XAUTHORITY}", "source": "${env:XAUTHORITY}",
"target": "/home/vscode/.Xauthority", "target": "/home/vscode/.Xauthority",
"type": "bind" "type": "bind"
}, },
@ -44,6 +44,5 @@
], ],
"runArgs": [ "runArgs": [
"--privileged" "--privileged"
], ]
"postAttachCommand": "sudo chmod 666 /dev/kvm"
} }

View File

@ -354,12 +354,12 @@ vscode_debug: build_kernel build_userspace build_drivers build_image vscode_debu
debug: vscode_debug debug: vscode_debug
qemu: qemu_vdisk clean_logs qemu: qemu_vdisk clean_logs check_chmod_kvm
touch serial.log touch serial.log
# x-terminal-emulator -e tail -f serial.log & # x-terminal-emulator -e tail -f serial.log &
$(QEMU) $(QEMU_UEFI_BIOS) -cpu host $(QEMUFLAGS) $(QEMUHWACCELERATION) $(QEMUMEMORY) $(QEMU_SMP) $(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) $(QEMU) -cpu host $(QEMUFLAGS) $(QEMUHWACCELERATION) $(QEMUMEMORY) $(QEMU_SMP)
run: build qemu run: build qemu