KVM guest halt 使主机 kvm 退出

KVM guest halt 使主机 kvm 退出

我在 kvm 中运行 Linux。当我halt在客户机中以 root 身份发出命令时,客户机最终会停止并显示内核日志消息System halted.。但是,kvm主机进程仍在运行。是否可以让它在停止时退出?

这看起来像是一个相关的讨论:http://comments.gmane.org/gmane.comp.emulators.kvm.devel/107972

这是一个相关的讨论,但它是关于从主机停止客人,但不是从内部停止:http://ubuntuforums.org/showthread.php?t=1066940

类似的错误报告,但没有任何有意义的回应:https://bugs.launchpad.net/ubuntu/+source/linux/+bug/967049

我的内核没有编译 ACPI,因此我添加了支持,但它仍然不会停止。这是我在启动时得到的结果:

[    0.311211] ACPI: PCI Interrupt Link [LNKC] enabled at IRQ 11
[    0.312637] virtio-pci 0000:00:03.0: PCI INT A -> Link[LNKC] -> GSI 11 (level, high) -> IRQ 11
[    0.315049] ACPI: PCI Interrupt Link [LNKD] enabled at IRQ 10
[    0.316472] virtio-pci 0000:00:04.0: PCI INT A -> Link[LNKD] -> GSI 10 (level, high) -> IRQ 10
[    0.318858] ACPI: PCI Interrupt Link [LNKA] enabled at IRQ 10
[    0.320254] virtio-pci 0000:00:05.0: PCI INT A -> Link[LNKA] -> GSI 10 (level, high) -> IRQ 10

ACPI 内核配置:

CONFIG_ACPI=y
# CONFIG_ACPI_PROCFS is not set
# CONFIG_ACPI_PROCFS_POWER is not set
# CONFIG_ACPI_EC_DEBUGFS is not set
# CONFIG_ACPI_PROC_EVENT is not set
# CONFIG_ACPI_AC is not set
# CONFIG_ACPI_BATTERY is not set
CONFIG_ACPI_BUTTON=y
# CONFIG_ACPI_FAN is not set
# CONFIG_ACPI_DOCK is not set
# CONFIG_ACPI_PROCESSOR is not set
CONFIG_ACPI_CUSTOM_DSDT_FILE=""
# CONFIG_ACPI_CUSTOM_DSDT is not set
CONFIG_ACPI_BLACKLIST_YEAR=0
# CONFIG_ACPI_DEBUG is not set
# CONFIG_ACPI_PCI_SLOT is not set
# CONFIG_ACPI_CONTAINER is not set
# CONFIG_ACPI_SBS is not set
# CONFIG_ACPI_HED is not set
# CONFIG_ACPI_CUSTOM_METHOD is not set
# CONFIG_ACPI_APEI is not set
CONFIG_PNPACPI=y
# CONFIG_THINKPAD_ACPI is not set
# CONFIG_ACPI_WMI is not set
# CONFIG_ACPI_ASUS is not set
# CONFIG_ACPI_CMPC is not set

更新:poweroff适用于启用 ACPI 的内核(例如使用上述内核配置)。halt仍然不起作用。

答案1

尝试运行halt -p

-p关机后通知主机关闭电源。

具体来说,手册页指出halt

-p, --poweroff
       Instructs the halt command to instead behave as poweroff.

答案2

您是否尝试过使用:

 # shutdown -h now

有时 ACPI 守护进程没有运行,您可能也想检查一下。

相关内容