Manager "Show" button and gui console do not work when a VM is already running as a service.

Discussions related to using VirtualBox on Windows hosts.
Post Reply
KHunter102
Posts: 1
Joined: 17. Nov 2023, 05:06

Manager "Show" button and gui console do not work when a VM is already running as a service.

Post by KHunter102 »

I have a Windows 11 Pro host machine (7.0.12) with a couple of Ubuntu (22.04) guests. Extensions and Guest additions installed. On the host, I created a scheduled task to headless start a VM with the trigger "At startup" that way the VM is always available even without logging in.

The VM starts fine, but in doing so, I somehow lose all gui capabilities to other VMs while using the VirtualBox Manager. For example, I'll log on to the Win11, open VirtualBox manager and cannot start other VMs in gui mode nor does the "Show" button work on the already running VM.

The task in the scheduler is set to "run whether user is logged in or not" and is using the same profile that I am logged into the host with running the VirtualBox manager tool. The VirtualBox Manager tool does indicate "Running" on the VM, but the Show button just will not work. Other VMs will also not start in gui mode unless I totally disable the scheduled task and restart the host.

I have attached the export of my task if that helps.

Thoughts?
Attachments
Task.xml
Export of the task.
(3.95 KiB) Downloaded 251 times
thexixx
Posts: 7
Joined: 9. Jan 2024, 11:45

Re: Manager "Show" button and gui console do not work when a VM is already running as a service.

Post by thexixx »

Hello,

I have the same problem. Have version of Virtualbox 7.0.12 but had the same with 7.0.6. Just setup auto start of VMs using official way described here docs_oracle_com/en/virtualization/virtualbox/7.0/user/AdvancedTopics.html#autostart-windows. Did you manage to solve the issue? Thanks in advance!
scottgus1
Site Moderator
Posts: 20945
Joined: 30. Dec 2009, 20:14
Primary OS: MS Windows 10
VBox Version: PUEL
Guest OSses: Windows, Linux

Re: Manager "Show" button and gui console do not work when a VM is already running as a service.

Post by scottgus1 »

KHunter102, if you disable the Task and use Virtualbox's Autostart instead, does the setup start working correctly? https://www.virtualbox.org/manual/ch09.html#autostart
thexixx
Posts: 7
Joined: 9. Jan 2024, 11:45

Re: Manager "Show" button and gui console do not work when a VM is already running as a service.

Post by thexixx »

Seems this is something general to the case when VMs started by autostart (headless?) feature on Windows (I have Win11Pro). In my case I also tried 3rd party tool to autostart VMs and had the same problem - "Show" button not working. So, I did everything official way but the problem still there.
scottgus1
Site Moderator
Posts: 20945
Joined: 30. Dec 2009, 20:14
Primary OS: MS Windows 10
VBox Version: PUEL
Guest OSses: Windows, Linux

Re: Manager "Show" button and gui console do not work when a VM is already running as a service.

Post by scottgus1 »

The usual problem with starting a VM via autostart or a 3rd-party service app or Task Scheduler is that the VM itself often ends up getting started with a different user or system account than the logged-on user account, which makes the autostarted VM itself not respond to the Virtualbox GUI or vboxmanage. Other non-autostarted VMs are not interfered with.

KHunter102's report is different:
KHunter102 wrote: 17. Nov 2023, 05:13 I somehow lose all gui capabilities to other VMs while using the VirtualBox Manager. ... cannot start other VMs in gui mode nor does the "Show" button work on the already running VM.
I have never heard of an autostart VM blocking other VMs. This is unusual.
thexixx
Posts: 7
Joined: 9. Jan 2024, 11:45

Re: Manager "Show" button and gui console do not work when a VM is already running as a service.

Post by thexixx »

My autostart and "VirtualBox system service" services are set to log on under the same user as I logged in to Windows.
When I click "Show" button on auto-started VM (in running state) in VBox Manager UI nothing happens.

This VM is in Running state and working as expected. I see small Preview of the VM's GUI but it is not possible to bring "full" view of it with "Show" button.

If I stop the VM from VBox Manager and will start it again from VBox Manger then it still will not show the full version of the VMs GUI and "Show" button does nothing.
fth0
Volunteer
Posts: 5678
Joined: 14. Feb 2019, 03:06
Primary OS: Mac OS X other
VBox Version: PUEL
Guest OSses: Linux, Windows 10, ...
Location: Germany

Re: Manager "Show" button and gui console do not work when a VM is already running as a service.

Post by fth0 »

Please reproduce the issue, describe what you did and provide a zip file with the contents of the VirtualBox global configuration folder (C:\Users\<username>\.VirtualBox).
thexixx
Posts: 7
Joined: 9. Jan 2024, 11:45

Re: Manager "Show" button and gui console do not work when a VM is already running as a service.

Post by thexixx »

fth0 wrote: 11. Jan 2024, 01:48 Please reproduce the issue, describe what you did and provide a zip file with the contents of the VirtualBox global configuration folder (C:\Users\<username>\.VirtualBox).
1. Set VM to autostart following documentation for Windows https://www.virtualbox.org/manual/ch09.html#autostart
2. Restart Windows
3. Open VirtualBox Manager
4. See VM is in a Running state. VM's preview GUI is visible and updating.
5. Click "Show" button to see/open VM's GUI
6. Nothing happened

.VirtualBox folder archive attached.
Attachments
VirtualBox.zip
C:\Users\<username>\.VirtualBox
(44.77 KiB) Downloaded 261 times
fth0
Volunteer
Posts: 5678
Joined: 14. Feb 2019, 03:06
Primary OS: Mac OS X other
VBox Version: PUEL
Guest OSses: Linux, Windows 10, ...
Location: Germany

Re: Manager "Show" button and gui console do not work when a VM is already running as a service.

Post by fth0 »

VBoxAutostart.log.1 and VBoxSVC.log.1 wrote:
2024-01-10T20:32:44.201670500Z
==============================

00:00:00.040521 VBoxAutostartSvc: service start
00:00:10.484994 VBoxSVC: Launched VM: Ubuntu_vpn_ca
00:00:15.102348 VBoxSVC: Launched VM: Ubuntu
00:00:19.690239 VBoxSVC: Launched VM: Home_Assystant_VM
00:00:24.253322 VBoxAutostartSvc: service end

00:00:27.975620 VBoxSVC: Deleting file 'C:\Users\thexixx\VirtualBox VMs\Ubuntu_vpn_ca\Logs\VBoxHardening.log' failed: VERR_SHARING_VIOLATION
00:00:27.975653 VBoxSVC: {Error deleting hardening log file 'C:\Users\thexixx\VirtualBox VMs\Ubuntu_vpn_ca\Logs\VBoxHardening.log' (VERR_SHARING_VIOLATION)}
00:00:27.982396 VBoxSVC: {Failed to start the machine 'Ubuntu_vpn_ca'. Process creation failed}, preserve=false aResultDetail=0

00:01:06.656603 VBoxSVC: Deleting file 'F:\home_assistant\Home_Assystant_VM\Logs\VBoxHardening.log' failed: VERR_SHARING_VIOLATION
00:01:06.656631 VBoxSVC: {Error deleting hardening log file 'F:\home_assistant\Home_Assystant_VM\Logs\VBoxHardening.log' (VERR_SHARING_VIOLATION)}
00:01:06.662421 VBoxSVC: Failed to start the machine 'Home_Assystant_VM'. Process creation failed}

00:09:26.341467 VBoxSVC: Saving settings file "C:\Users\thexixx\VirtualBox VMs\Ubuntu_vpn_ca\Ubuntu_vpn_ca.vbox" with version "1.19-windows"
00:09:34.720661 VBoxSVC: {Failed to start the machine 'Ubuntu_vpn_ca'. Process creation failed}
00:09:47.770373 VBoxSVC: {Failed to start the machine 'Ubuntu_vpn_ca'. Process creation failed}

00:10:16.683821 VBoxSVC: Saving settings file "C:\Users\thexixx\VirtualBox VMs\Ubuntu\Ubuntu.vbox" with version "1.19-windows"
00:10:28.409241 VBoxSVC: {Failed to start the machine 'Ubuntu'. Process creation failed}
I've chosen the second last log files (*) and extracted and shortened a few interesting log messages to indicate the major events. When you tried to change the VM mode from headless to separate (via the Show button), VirtualBox tried to delete the old VBoxHardening.log file to create a new one, and for some "sharing violation" reason Windows denied the file access.

I don't really know how the VirtualBox Autostart mechanism works internally or how Windows handles simultaneous sessions by the same user (for example when I switch forth and back between using my laptop directly and via RDP, where the processes and screen contents stay the same), so ATM I have no concrete suggestion how to investigate further ...

(*) If you really restarted the Windows host, you either did it before I asked you to reproduce the issue (do you have a time machine? ;)) or your host's clock was using a wrong time, because even the newest log files started around 20:44 UTC.
thexixx
Posts: 7
Joined: 9. Jan 2024, 11:45

Re: Manager "Show" button and gui console do not work when a VM is already running as a service.

Post by thexixx »

Well. I know what is the problem. But I do not know how to solve it.

When Windows starts it also starts the following processes:
1. VBoxSVC.exe -Under this process the headless VMs are starting
2. VBoxSDS.exe - I do not know what is it but description is VirtualBox Global Interface

So, if you open VirtualBox Manager GUI and click "SHOW" on running in background VM then there are at least two scenarios:

1. After Windows restart
The process of VM's GUI (VirtualBocVM.exe) will spawn under VBoxSDS process and the VM GUI is not visible to the user. It is Running in the background. See screenshot "vm-gui-1"

2. If manually stop VM and then manually Start the Service which will start Headless VM (one which has been setup according to documentation), then VM's GUI will spawn under VBoxSVC.exe process. The same parent where headless VM is running. And in this case VM's GUI will be visible for the user. See screenshot "vm-gui-2"

I tried to run VirtualBox manager as administrator but it still didn't work.
Attachments
In this case VM' GUI is NOT visible to the user
In this case VM' GUI is NOT visible to the user
vm-gui-1.jpg (21.12 KiB) Viewed 2162 times
In this case VM' GUI is visible to the user
In this case VM' GUI is visible to the user
vm-gui-2.jpg (25.19 KiB) Viewed 2162 times
fth0
Volunteer
Posts: 5678
Joined: 14. Feb 2019, 03:06
Primary OS: Mac OS X other
VBox Version: PUEL
Guest OSses: Linux, Windows 10, ...
Location: Germany

Re: Manager "Show" button and gui console do not work when a VM is already running as a service.

Post by fth0 »

AFAIK, VBoxSDS.exe is part of the trick to make VBoxSVC.exe accessible to multiple simultaneous user sessions of the same user. But I don't understand the details, so I think it's time for you to create a ticket in the Bugtracker.
thexixx
Posts: 7
Joined: 9. Jan 2024, 11:45

Re: Manager "Show" button and gui console do not work when a VM is already running as a service.

Post by thexixx »

OK. I spent a little bit more time.

You do not need to restart Windows to reproduce the issue. The rule is the following: If you start "Virtualbox Manager" before you will start "Virtualbox Autostart Service", then "Show" button will work because VirtualboxVM.exe process will spawn under VBoxSVS.exe.
If you start the "Virtualbox Autostart Service" and then "Virtualbox Manager", then "Show" button will not work as it will spawn under VBoxSDS.exe process.

I've tried to force bring VirtualboxVM.exe window to front using Process Explorer, thinking that it is just hidden but in case the process under VBoxSDS.exe it even not creating a visible window form, so it is not possible.

I noticed also that VBoxSVC.exe running under the User account and VBoxSDS.exe under the Local System and tried to run "Virtualbox Manager" under the Local System but it didn't solve the problem.

I've tried different VBox versions: 7.0.0, 7.0.97 (dev snapshot) it is the same.

The solution here is to use VBox v.6.1.16 and later, as there will be auto start service implementation for Windows. I installed 6.1.50 and all works as expected.

I think that part with Autostart Service has been rewritten, as Autostart Service naming changed and it starts longer in v.6 than in v.7

This is minor issue, I do not think it will be fixed soon but I will issue the ticket anyway.
fth0
Volunteer
Posts: 5678
Joined: 14. Feb 2019, 03:06
Primary OS: Mac OS X other
VBox Version: PUEL
Guest OSses: Linux, Windows 10, ...
Location: Germany

Re: Manager "Show" button and gui console do not work when a VM is already running as a service.

Post by fth0 »

Thanks for the additional report. This information might be interesting to the VirtualBox developers, too. When creating a ticket, either write a concise summary of your findings or link to this forum thread. The former would be better IMHO. ;)
Post Reply