我遇到了 libvirtd 问题,即使我运行 systemctl start libvirtd.service,服务仍处于非活动状态。
我是 libvirt 和 kvm 的成员
的输出systemctl status libvirtd
是
libvirtd.service - Virtualization daemon
Loaded: loaded (/lib/systemd/system/libvirtd.service; enabled; vendor preset: enabled)
Active: inactive (dead) since Tue 2020-04-07 23:44:24 -04; 8s ago
Docs: man:libvirtd(8)
https://libvirt.org
Process: 19508 ExecStart=/usr/sbin/libvirtd $libvirtd_opts (code=exited, status=0/SUCCESS)
Main PID: 19508 (code=exited, status=0/SUCCESS)
当我运行其他命令时出现错误virsh list
error: failed to connect to the hypervisor
error: Failed to connect socket to '/var/run/libvirt/libvirt-sock': No such file or directory
该目录/var/run/libvirt/
不包含该文件libvirt-sock
,我认为这是主要问题,但我不知道解决方案。
ls /var/run/libvirt
network storage virtlockd-sock virtlogd-sock
我安装了 libvirt-daemon-system qemu-kvm libvirt-bin bridge-utils virt-manager qemu libvirt0。
我尝试过和systemctl enable libvirtd
,systemctl enable libvirtd
但是没有活动。
journalctl -f
当我运行时的输出systemctl restart libvirtd
abr 08 08:40:56 susan sudo[7195]: susan : TTY=pts/1 ; PWD=/home/susan ; USER=root ; COMMAND=/bin/systemctl restart libvirtd
abr 08 08:40:56 susan sudo[7195]: pam_unix(sudo:session): session opened for user root by (uid=0)
abr 08 08:40:56 susan systemd[1]: Starting Virtualization daemon...
abr 08 08:40:56 susan systemd[1]: Started Virtualization daemon.
abr 08 08:40:56 susan sudo[7195]: pam_unix(sudo:session): session closed for user root
abr 08 08:40:56 susan libvirtd[7198]: 2020-04-08 12:40:56.120+0000: 7225: info : libvirt version: 4.0.0, package: 1ubuntu8.15 (Guilherme G. Piccoli <[email protected]> Thu, 20 Feb 2020 13:07:33 -0300)
abr 08 08:40:56 susan libvirtd[7198]: 2020-04-08 12:40:56.120+0000: 7225: info : hostname: susan
abr 08 08:40:56 susan libvirtd[7198]: 2020-04-08 12:40:56.120+0000: 7225: error : virFirewallValidateBackend:193 : direct firewall backend requested, but /sbin/ebtables is not available: No existe el archivo o el directorio
abr 08 08:40:56 susan libvirtd[7198]: 2020-04-08 12:40:56.120+0000: 7225: error : virFirewallApply:916 : internal error: Failed to initialize a valid firewall backend
abr 08 08:40:56 susan libvirtd[7198]: 2020-04-08 12:40:56.128+0000: 7225: error : virConfParseValue:529 : configuration file syntax error: /etc/libvirt/qemu.conf:412: expecting a value
abr 08 08:40:56 susan libvirtd[7198]: 2020-04-08 12:40:56.128+0000: 7225: error : virStateInitialize:775 : Initialization of QEMU state driver failed: configuration file syntax error: /etc/libvirt/qemu.conf:412: expecting a value
abr 08 08:40:56 susan libvirtd[7198]: 2020-04-08 12:40:56.128+0000: 7225: error : daemonRunStateInit:849 : Driver state initialization failed
412 行etc/libvirt/qemu.conf
group=kvm
有解决这个问题的方法吗?谢谢!
答案1
您安装了 kvm 吗?要安装 libvirt 和 kvm,请尝试运行以下命令
sudo apt install qemu qemu-kvm libvirt-clients libvirt-daemon-system virtinst bridge-utils
sudo systemctl enable libvirtd
sudo systemctl start libvirtd
我注意到您的输出中缺少 ebtables。您可以通过运行以下命令来安装它们:
sudo apt install -y ebtables
然后重新启动服务。希望这对您有帮助。
答案2
请尝试以下步骤:
sudo setfacl -m user:$USER:rw /var/run/libvirt/libvirt-sock
退出会话并再次登录,
sudo systemctl enable libvirtd
sudo systemctl start libvirtd
答案3
有一次,我遇到了错误,因为 libvirt 的(至少)一部分在 systemd 中被“屏蔽”。因此,我必须找到所有部分 ( systemctl |grep virt
),检查它们是否被屏蔽 ( systemctl status ...
),然后取消屏蔽被屏蔽的部分 ( systemctl unmask ...
)。我还启用并启动了它们。