Page 1 of 1

Ubuntu Updates with Running VMs

Posted: 30. Apr 2020, 08:41
by e-tsik
Hi

I keep a VM running with Windows on my Linux boxes (I have 3) to be able to run Windows apps I want to run but there is no support for them on Linux or I just simply don't want the hassle of making them work with Wine. I'm also using the extension pack although I'm not sure what feature exactly I'm using requires the extpack. I've been using VirtualBox since about 5.0. So here is my user experience with VirtualBox:

- Every time I update and a new kernel arrives, the update fails. When I run apt upgrade manually I get this message:
vboxdrv.sh: Stopping VirtualBox services.
vboxdrv.sh: failed: Cannot unload module vboxnetflt.
run-parts: /etc/kernel/postinst.d/vboxdrv exited with return code 1
And then I have to shut down my Windows VM and start over.

- Then the VM won't run because I need to update the extpack. So I use the GUI which offers me to upgrade the extpack, an offer which I take although I know it's going to fail due to an NS_UNKNOWN_ERROR (from memory), but I'm taking it anyway because I then use the portion of the error message where it states the download path and I can use it to do
sudo vboxmanage extpack install --prelace <path>
which goes quite nicely.

- *EVERY* update to the VirtualBox package failes because of "Running VMs Found". So I shut down the Windows VM but it keeps telling me I have running VMs. So I manually shut down vboxdrv. It doesn't matter because it keeps telling me I have running VMs.
So what I do is I
vboxmanage modifyvm Windows --autostart-enabled off
reboot
Do the upgrade
vboxmanage modifyvm Windows --autostart-enabled off
vboxmanage startvm --type headless Windows

Am I the only one (actually the only 3) having these issues? Do you just accept this or do you have some other trick I'm not aware of?

Re: Ubuntu Updates with Running VMs

Posted: 30. Apr 2020, 23:22
by scottgus1
e-tsik wrote:When I run apt upgrade manually I get this message:
.....
And then I have to shut down my Windows VM and start over.
If you are trying to update Virtualbox-related files or the host OS itself while guests are running, then don't, it's a Bad Idea. It's like trying to swap the motherboard on a PC - while the PC is running....

Re: Ubuntu Updates with Running VMs

Posted: 1. May 2020, 16:51
by multiOS
As scottgus1 says, the solution is to use the normally recommended practice, which any decent OS will provide for/encourage: Prevent all system updates from being applied when critical processes are running.

Re: Ubuntu Updates with Running VMs

Posted: 7. Jun 2020, 08:53
by e-tsik
Hi Guys

Yes, I was wondering why I have to do this in the first place (shut down the machines). You're talking about not updating while critical stuff is running, so that's a great idea. Why is the update not "doing its thing" and then after the next machine starts up or a reboot occurs it will pick up the update?

Further excerpts from my text are from when my virtual machine IS shut down, and still I'm getting this message. i.e. I have shutdown the VM, and then I have to disable its autostart and the maybe if I also manually unload the vbox kernel modules THEN maybe the update will go through.

Re: Ubuntu Updates with Running VMs

Posted: 7. Jun 2020, 15:38
by scottgus1
Virtualbox uses a service while guests are running, and either the service will not exit until the guests are all shut down, or the guests will crash when the service is force-quit.

I am not proficient enough (or at all, really) in Linux to know how the autostart function of Virtualbox on Linux hosts works. If there is a service involved, then the above continues to apply.

If Linux updates files related to running services or apps by stopping the services and changing the files then restarting the services, then a program that needs those services might either crash or block the update until the program is not running.

If Linux can be set to run updates while the computer is rebooting, like Windows does, then the update will probably go through each time.

If the autostart guest interferes with updates, then you will need to disable the autostart and shut down the guest before trying to run updates.

Updates within the guest OS can be run while the guests are running.

Updates to the host OS should not be run while guests are running, unless updates to the host OS can be run queued up so they will leave the running system in place and take effect at next reboot a la Windows.

Updates to Virtualbox should not be run while guests are running.