unix:virtualization:virtlib:winvirtuals
Differences
This shows you the differences between two versions of the page.
| — | unix:virtualization:virtlib:winvirtuals [2025/01/18 21:32] (current) – created - external edit 127.0.0.1 | ||
|---|---|---|---|
| Line 1: | Line 1: | ||
| + | ====== Windows Virtuals ====== | ||
| + | ===== Windows 11 ===== | ||
| + | |||
| + | Windows 11 requires TPM and Secure Boot. See [[microsoft_windows: | ||
| + | |||
| + | ===== Shutdown and Reboot don't work ===== | ||
| + | |||
| + | If you can not issue the command | ||
| + | <code bash> | ||
| + | where //domname// is a running domain, the problem may be that the QEMU guest agent is either not installed on your Windows virtual, or the configuration for the domain on your hypervisor is not set up. | ||
| + | |||
| + | This assumes you are using the QEMU guest agent which is installed by default when you use the virtio-win drivers. | ||
| + | |||
| + | First, verify that is the problem by issuing | ||
| + | <code bash> | ||
| + | where domname is, again, a running virtual. This forces virsh to try the shutdown only using the QEMU agent, and it will give you an error if it can not do so. On my tests, the error was: | ||
| + | < | ||
| + | which translates to //Your configuration file does not have the necessary information to do this.// | ||
| + | |||
| + | In this case, edit the configuration manually with the command | ||
| + | <code bash> | ||
| + | then find the line which reads </ | ||
| + | |||
| + | <code xml> | ||
| + | <channel type=' | ||
| + | <source mode=' | ||
| + | <target type=' | ||
| + | </ | ||
| + | </ | ||
| + | |||
| + | **NOTE** change //< | ||
| + | |||
| + | Save your changes. | ||
| + | |||
| + | Now, log into the virtual and manually shut it down (do not restart, shut down). Back on the hypervisor, start the virtual back up. | ||
| + | |||
| + | Now, running <code bash> | ||
| + | |||
| + | ===== virtual will not reboot ===== | ||
| + | |||
| + | I have found that some (not all) Windows virtuals will not restart/ | ||
| + | |||
| + | Since this causes many issues, we wrote a Perl script as a work around. The script simply checks to see if virtuals are up and, if not, starts them (with the virsh start command). In our case, we decided that this would occur either when doing maintenance on the machine, or overnight when the virtual decides to reboot itself, so a 10 minute, maximum, downtime was acceptable. | ||
| + | |||
| + | <code perl checkVirtuals> | ||
| + | #! / | ||
| + | |||
| + | use strict; | ||
| + | use warnings; | ||
| + | |||
| + | # list of virtuals which should be turned on if they | ||
| + | # are found to be down. This is the same as that returned | ||
| + | # by virsh list | ||
| + | my @servers = ( | ||
| + | ' | ||
| + | ' | ||
| + | ' | ||
| + | ); | ||
| + | |||
| + | # command to start a virtual | ||
| + | my $virsh = '/ | ||
| + | |||
| + | # get a list of running virtuals and put them into | ||
| + | # $output | ||
| + | my $output = `virsh list`; | ||
| + | |||
| + | # check each virtual we are monitoring | ||
| + | foreach my $server ( @servers ) { | ||
| + | if ( $output =~ m/$server/ ) { # the virtual is running | ||
| + | # remove the flag file | ||
| + | unlink "/ | ||
| + | } else { # virtual is not running | ||
| + | if ( -e "/ | ||
| + | print " | ||
| + | # so bring it back up | ||
| + | | ||
| + | # and remove the flag file | ||
| + | | ||
| + | } else { # just went down | ||
| + | # create a flag file so the next pass will start it back up | ||
| + | | ||
| + | } | ||
| + | } | ||
| + | } | ||
| + | |||
| + | 1; | ||
| + | </ | ||
| + | |||
| + | Every time this script is run, it will check each of the virtuals it is monitoring to see if it is up. The first time it finds one that is not up, it will create a flag file in /tmp, named // | ||
| + | |||
| + | When it finds it is down the second time, it will start it back up. | ||
| + | |||
| + | The following cron file, stored in /etc/cron.d (Devuan/ | ||
| + | |||
| + | <code crontab checkVirtuals.cron> | ||
| + | # Check status of virtuals on this machine and, restart any if down. | ||
| + | PATH=/ | ||
| + | # following may be changed to send failure reports to a different e-mail | ||
| + | # account | ||
| + | MAILTO=root | ||
| + | |||
| + | # check running virtuals every 5 minutes | ||
| + | |||
| + | # m h dom mon dow | ||
| + | */5 * * | ||
| + | |||
| + | # EOF | ||
| + | </ | ||
| + | |||
| + | Save this file to / | ||
| + | |||
| + | ===== Links ===== | ||
| + | * https:// | ||
| + | * https:// | ||
unix/virtualization/virtlib/winvirtuals.1683255218.txt.gz · Last modified: (external edit)
