LoginSignup
1
0

More than 1 year has passed since last update.

virsh-install時にpermission deniedとなる場合

Posted at

kvmにおいてvirsh-installを行った場合、permission deniedが出力される場合がある

インストールを完了できません: '内部エラー: process exited while connecting to monitor: 2016-05-05T08:57:02.803493Z
qemu-system-x86_64: -drive file=/var/lib/libvirt/images/winxp.raw,format=raw,if=none,id=drive-ide0-0-0:
Could not open '/var/lib/libvirt/images/winxp.raw': Permission denied'

isoをrootディレクトリに置いてはいけない

ubuntuならば、一般ユーザーを作成して、その配下にisoを配置しなければならない。

QEMUの設定

/etc/libvirt/qemu.confを、以下のように3行編集する。

#       user = "qemu"   # A user named "qemu"
#       user = "+0"     # Super user (uid=0)
#       user = "100"    # A user named "100" or a user with uid=100
#
user = "ユーザー名" ←「ユーザー名」は普段使う一般ユーザーのユーザー名に変える。

# The group for QEMU processes run by the system instance. It can be
# specified in a similar way to user.
group="libvirt" ←グループをlibvirtに変える。

# Whether libvirt should dynamically change file ownership
# to match the configured user/group above. Defaults to 1.
# Set to 0 to disable file ownership changes.
dynamic_ownership = 1 ←コメントアウトを解除。
...

libvirtの設定

# nano /etc/libvirt/libvirtd.conf
...
unix_sock_group = "libvirt"
...
unix_sock_ro_perms = "0777"  # set to 0770 to deny non-group libvirt users
...
unix_sock_rw_perms = "0770"
...
auth_unix_ro = "none"
...
auth_unix_rw = "none"
...

ユーザー周りの権限も設定

sudo usermod -G -a kvm "username"
sudo usermod -G -a libvirtd "username"

libvirtdデーモンを起動する。

# systemctl start libvirtd.service
# systemctl enable libvirtd.service
参考サイト

https://www.archlinux.site/2016/05/virt-managerroot.html
https://www.dedoimedo.com/computers/kvm-permission-denied.html

1
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
1
0