■GNS3でQEMUを使用する際の「KVM kernel module: Permission denied」に対処する。
IOSvやASAv、CSR1000v、NX-OSv、EXOS、LEDE、VyOS等がQEMUコマンドを使用する。
■エラーの内容は以下。
$ grep -A 8 "Execution log" .config/GNS3/gns3_gui.log | tail -n 8
--
Execution log:
Could not access KVM kernel module: Permission denied
failed to initialize KVM: Permission denied
2018-11-06 00:33:42 ERROR node.py:433 error while starting EXOS22.4.1.4-1: Could not start QEMU console [Errno 111] Connect call failed ('127.0.0.1', 5001)
2018-11-06 00:33:42 CRITICAL __init__.py:1553 Could not start QEMU console [Errno 111] Connect call failed ('127.0.0.1', 5001)
■ログ中のEXOSは以下のURLから取得。
EXOS appliance
https://docs.gns3.com/appliances/exos.html
■権限が本当に無いのかを調査。
$ ls -l /dev/kvm
crw-rw----+ 1 root kvm 10, 232 11月 5 21:44 /dev/kvm
$ grep kvm /etc/group
kvm:x:126:
$ id | tr ',' '\n' | grep kvm
■確かにkvmグループに属していないので、グループを追加して再ログイン
$ export USER=$(whoami);sudo gpasswd -a $USER kvm;unset USER
ユーザ labunix をグループ kvm に追加
$ exit
$ id | tr ',' '\n' | grep kvm
126(kvm)
■GUIのセッションはxrdpなので、セッションを再起動して
念のためGUIからmate-terminalを開いて「id」コマンドで確認する。
$ sudo systemctl list-unit-files --type=service | awk '/enabled/&&($1 ~ /^x/)'
xrdp-sesman.service enabled
xrdp.service enabled
$ sudo systemctl restart xrdp-sesman.service
$ sudo systemctl restart xrdp.service
■これでQEMU経由で、とりあえずIOSvが起動出来るようになった。
Cisco IOS Software, vios_l2 Software (vios_l2-ADVENTERPRISEK9-M), Version 15.0(TTC_20140605)FLO_DSGS7, EARLY DEPLOYMENT DEVELOPMENT BUILD, synced to V152_3_0_88_PI4
Cisco IOSv () processor (revision 1.0) with 574713K/209920K bytes of memory.