Ubuntu – Could not access KVM kernel module GNS3

kvmnetworking

i have a fresh ubuntu 18.04 install.
I am trying to run cisco virl images on GNS3.
When i start the image it throws me an error

"QEMU process has stopped, return code: 1
Start QEMU with /usr/bin/qemu-system-x86_64 -name CiscoIOSvL215.2.4055-1 -m 768M -smp cpus=1 -enable-kvm -machine smm=off -boot order=c -drive file=/home/aj/GNS3/projects/switchinstall/project-files/qemu/2a28d664-2c5b-4cb5-bca0-dc3c7b28999a/hda_disk.qcow2,if=virtio,index=0,media=disk -uuid 2a28d664-2c5b-4cb5-bca0-dc3c7b28999a -serial telnet:127.0.0.1:5001,server,nowait -monitor tcp:127.0.0.1:42319,server,nowait -net none -device e1000,mac=0c:7d:d6:99:9a:00,netdev=gns3-0 -netdev socket,id=gns3-0,udp=127.0.0.1:10001,localaddr=127.0.0.1:10000 -device e1000,mac=0c:7d:d6:99:9a:01,netdev=gns3-1 -netdev socket,id=gns3-1,udp=127.0.0.1:10003,localaddr=127.0.0.1:10002 -device e1000,mac=0c:7d:d6:99:9a:02,netdev=gns3-2 -netdev socket,id=gns3-2,udp=127.0.0.1:10005,localaddr=127.0.0.1:10004 -device e1000,mac=0c:7d:d6:99:9a:03,netdev=gns3-3 -netdev socket,id=gns3-3,udp=127.0.0.1:10007,localaddr=127.0.0.1:10006 -device e1000,mac=0c:7d:d6:99:9a:04,netdev=gns3-4 -netdev socket,id=gns3-4,udp=127.0.0.1:10009,localaddr=127.0.0.1:10008 -device e1000,mac=0c:7d:d6:99:9a:05,netdev=gns3-5 -netdev socket,id=gns3-5,udp=127.0.0.1:10011,localaddr=127.0.0.1:10010 -device e1000,mac=0c:7d:d6:99:9a:06,netdev=gns3-6 -netdev socket,id=gns3-6,udp=127.0.0.1:10013,localaddr=127.0.0.1:10012 -device e1000,mac=0c:7d:d6:99:9a:07,netdev=gns3-7 -netdev socket,id=gns3-7,udp=127.0.0.1:10015,localaddr=127.0.0.1:10014 -device e1000,mac=0c:7d:d6:99:9a:08,netdev=gns3-8 -netdev socket,id=gns3-8,udp=127.0.0.1:10017,localaddr=127.0.0.1:10016 -device e1000,mac=0c:7d:d6:99:9a:09,netdev=gns3-9 -netdev socket,id=gns3-9,udp=127.0.0.1:10019,localaddr=127.0.0.1:10018 -device e1000,mac=0c:7d:d6:99:9a:0a,netdev=gns3-10 -netdev socket,id=gns3-10,udp=127.0.0.1:10021,localaddr=127.0.0.1:10020 -device e1000,mac=0c:7d:d6:99:9a:0b,netdev=gns3-11 -netdev socket,id=gns3-11,udp=127.0.0.1:10023,localaddr=127.0.0.1:10022 -device e1000,mac=0c:7d:d6:99:9a:0c,netdev=gns3-12 -netdev socket,id=gns3-12,udp=127.0.0.1:10025,localaddr=127.0.0.1:10024 -device e1000,mac=0c:7d:d6:99:9a:0d,netdev=gns3-13 -netdev socket,id=gns3-13,udp=127.0.0.1:10027,localaddr=127.0.0.1:10026 -device e1000,mac=0c:7d:d6:99:9a:0e,netdev=gns3-14 -netdev socket,id=gns3-14,udp=127.0.0.1:10029,localaddr=127.0.0.1:10028 -device e1000,mac=0c:7d:d6:99:9a:0f,netdev=gns3-15 -netdev socket,id=gns3-15,udp=127.0.0.1:10031,localaddr=127.0.0.1:10030 -nographic

Execution log:
Could not access KVM kernel module: Permission denied
qemu-system-x86_64: failed to initialize KVM: Permission denied

error while starting CiscoIOSvL215.2.4055-1: Could not start QEMU console [Errno 111] Connect call failed ('127.0.0.1', 5001)

Could not start QEMU console [Errno 111] Connect call failed ('127.0.0.1', 5001)"

But when i run as super user in terminal it works fine.

infact gns3 creates a file in ~/.conf/GNS3/run_as_root and after exiting the active connection it can only be started if i run as root or remove that file.

I am sure its related to permissions and privileges .

Newbie here and will appreciate an sort of guidance.

Thank you.

Best Answer

As your normal user:

sudo usermod -aG kvm $(whoami) && sudo reboot
Related Question