Update behavior

Here you can provide suggestions on how to improve the product, website, etc.
Post Reply
glytch
Posts: 2
Joined: 5. Jul 2020, 04:28

Update behavior

Post by glytch »

Hello.

The OS I am running VirtualBox under automatically downloads and installs updates, usually while I am asleep. I have no desire to change this behavior, BUT it's quite problematic that all of my VMs pause.

I'd like to suggest that, after an update, the autostart service be restarted, thus resuming my VMs...
scottgus1
Site Moderator
Posts: 20965
Joined: 30. Dec 2009, 20:14
Primary OS: MS Windows 10
VBox Version: PUEL
Guest OSses: Windows, Linux

Re: Update behavior

Post by scottgus1 »

You might be able to do this now, with a startup script that either launches all VMs, all VMs that are in a particular state, or all VMs with a particular extradata or guestproperty key, or a combination of the above. It may be a bit trickier if you only want this script running after the computer has restarted from automatic updates, you'll have to find out how to trigger that. But you could allow it to run after every start, perhaps with a small delay to allow you to stop the script if desired and handle the VMs yourself.

See these vboxmanage commands:
startvm: https://www.virtualbox.org/manual/ch08. ... ge-startvm
showvminfo: https://www.virtualbox.org/manual/ch08. ... showvminfo
getextradata/setextradata: https://www.virtualbox.org/manual/ch08. ... -extradata
guestproperty: https://www.virtualbox.org/manual/ch08. ... stproperty

'showvminfo' piped through 'grep' or 'find', or redirected into a text file then through 'find', can pick up on the "State" line for VMs that are paused, save-stated, running, or powered off.

'startvm' restarts paused or save-stated VMS as well as powered-off VMs.

Here's a Windows-centric way to test against all VMs without a pre-set list:
"Dynamic Windows CMD to run Vboxmanage on all guests"
viewtopic.php?f=1&t=61861
The concept should be convertible to Linux scripts.
glytch
Posts: 2
Joined: 5. Jul 2020, 04:28

Re: Update behavior

Post by glytch »

The host is CentOS 7, and the host isn't being rebooted. yum is updating VirtualBox itself... understandably, if you update VirtualBox, the VMs that are running in it need to stop... that's fine... I just need them to resume once the update is done.
scottgus1
Site Moderator
Posts: 20965
Joined: 30. Dec 2009, 20:14
Primary OS: MS Windows 10
VBox Version: PUEL
Guest OSses: Windows, Linux

Re: Update behavior

Post by scottgus1 »

glytch wrote:yum is updating VirtualBox itself... understandably, if you update VirtualBox, the VMs that are running in it need to stop
Ah. Honestly, I'd stop that setup super right away. Letting automatic updates update running software is a recipe for disaster. Updates do break stuff at times, and anything with a computer can go wrong. I never let automatic updates happen on essential systems, rather, I carefully consider when and what to update, and shut down things like the programs that are going to be updated, after I do the backups to be able to recover if the update goes south.

That said, if the yum updater is launched via some cron script or such, that script can launch the VM start script.
multiOS
Volunteer
Posts: 800
Joined: 14. Sep 2019, 16:51
Primary OS: Mac OS X other
VBox Version: PUEL
Guest OSses: WIN11,10, 7, Linux (various)
Location: United Kingdom

Re: Update behavior

Post by multiOS »

Can't see your suggestion getting very far when the VirtualBox User Manual states very clearly:
2.3.3.4 Updating and Uninstalling Oracle VM VirtualBox
Before updating or uninstalling Oracle VM VirtualBox, you must terminate any virtual machines which are currently running and exit the Oracle VM VirtualBox or VBoxSVC applications. To update Oracle VM VirtualBox, simply run the installer of the updated version. To uninstall Oracle VM VirtualBox, run the installer as follows:
Your update method is, in effect simply switching off ('crashing') any running VM with no protection for any unsaved work, or for what else it might be doing at the time.

(scotgus1 beat to this with a similar observation.)
scottgus1
Site Moderator
Posts: 20965
Joined: 30. Dec 2009, 20:14
Primary OS: MS Windows 10
VBox Version: PUEL
Guest OSses: Windows, Linux

Re: Update behavior

Post by scottgus1 »

One other thing I might say, 'paused' guests are quite possibly save-stated guests, since Virtualbox cannot turn off while guests remain running on 'pause'. Often it is reported in the forum that a version change of Virtualbox prevents save-stated guests from starting and requiring discard of the saved state, which puts the guest in the same state MultiOS speaks of, unmercifully powered off without graceful shutdown.

If when you go to manually restart the guests they are listed as Powered Off or Aborted in the main Virtualbox window, then they were killed, not paused.

Your host PC's update process is quite likely crashing your guests, opening a strong possibility of data corruption.
Post Reply