Guest restarting after issuing a shutdown

Peter Crowther peter.crowther at melandra.com
Fri Apr 1 16:41:56 UTC 2022


virt-install is expecting the installation process to need a reboot partway
through, so carefully restarts the guest on its first shutdown. Then it
gets out of the way. Either change what virt-install thinks it's installing
(not sure how, never done it), or write and enable a service during
installation that removes itself then shuts down the guest. First install
doesn't run the service, so restarts normally. Next boot starts the
service, which removes itself and forces a shutdown. Job done.

Cheers,

Peter

On Fri, 1 Apr 2022, 16:14 jonetsu, <jonetsu at teksavvy.com> wrote:

> Hello everyone,
>
> I create kvm machines using a bash script.  As expected from the
> script, the resulting virtual machines are performing as they should
> be.  The aspect that I do not get is at the end of the creation, when
> issuing a 'shutdown now' in the guest and expecting that it will shut
> down.  Instead it does shut down, but it is restarted immediately.
>
> The machines are created using an Arch Linux ISO file.  The bash script
> runs in three stages, the first stage is on the host. virt-install
> will show the regular Arch Linux installation interface.  The bash
> script is copied to the machine and its second stage is ran.  After
> that a chroot is done and the third phase of the script is executed.
> When everything is configured and installed, here is what happens,
> commands are prefixed '%', text output is as is, and comments in
> '()' :
>
> guest : % shutdown now
> host  :   Domain creation completed.
> host  :   Restarting guest.
> (virt-manager shows the guest restarting)
>
> host  : % virsh shutdown test02
> (nothing happens, guest still shown)
>
> host  : % virsh destroy test02
> host  :   Domain test02 destroyed
> (guest display closes)
>
> What I'm expecting is that, when the 'shutdown now' is issued in the
> guest, that it will effectively terminate the guest, 'virsh list --all'
> will not show it running, and there'll be no need to issue a 'virsh
> destroy'. I have no clue at the moment why virsh is restarting the
> guest after a shutdown was issued in the guest.  Looks like virsh did
> not get that it should terminate the guest and considers the shutdown
> as an error.
>
> Here are the versions involved :
>
> host : xubuntu 20.04 LTS
> libvirt 6.0.0-0ubuntu8.15
> virt-manager 1:2.2.1-3ubuntu2.1
> guest : archlinux 2022.03.01-x86_64
>
> Thanks !
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://listman.redhat.com/archives/libvirt-users/attachments/20220401/4808adcc/attachment.htm>


More information about the libvirt-users mailing list