autostart fails

Discussions related to using VirtualBox on Windows hosts.
Post Reply
rpvirtualbox
Posts: 3
Joined: 5. Apr 2021, 14:31

autostart fails

Post by rpvirtualbox »

Followed the steps outlined under autostart-windows of docs-oracle-com

It is expected that the VM should run without having any user to login to the system

1. Create c:\virtualbox\virtualbox file with following data
default_policy = allow
“administrator” = {
allow = true
startup_delay = 120
}

2. added the VBOXAUTOSTART_CONFIG environment variable into system variables containing the path to above config file (c:\virtualbox\virtualbox)

3. Created c:\virtualbox\admin file with administrator password in it.

4. Ran this command => VBoxAutostartSvc install --user=administrator --password-file=c:\virtualbox\admin

5. Deleted c:\virtualbox\admin file

Dont see guest VM running after boot after the startup_delay.

Skimming thru event_logs (SYSTEM) show the error "The VirtualBox Autostart Service administrator@host-c8dpki8 service terminated with the following error: A device attached to the system is not functioning."

Also this error occurs during booting process & does not wait for the completion of start_up delay. Appreciate any help. Thanks
scottgus1
Site Moderator
Posts: 20965
Joined: 30. Dec 2009, 20:14
Primary OS: MS Windows 10
VBox Version: PUEL
Guest OSses: Windows, Linux

Re: autostart fails

Post by scottgus1 »

I am not sure the tutorial you followed is specifically for Virtualbox (especially since you could not post a link to it due to the no-links-for-the-first-day rule). But I would suggest trying the method in the Virtualbox manual: https://www.virtualbox.org/manual/ch09.html#autostart
Also see the 'vboxmanage modifyvm' setting: https://www.virtualbox.org/manual/ch08. ... -autostart
rpvirtualbox
Posts: 3
Joined: 5. Apr 2021, 14:31

Re: autostart fails

Post by rpvirtualbox »

Thanks scott! You are right, I was prevented from incl the documentation U R L due to first day rule.

Thanks for 'vboxmanage modifyvm' clue, it did fix the error I noticed in the event logs earlier, which I dont see anymore. Also I do see "The VBoxAutostartSvcec2amaz-c8dpki8administrator service entered the running state.'"

But the VM status continues to show "State: powered off" state when checked in the Virtualbox manager GUI or command "vboxmanage showvminfo VMname"

any clue ?
scottgus1
Site Moderator
Posts: 20965
Joined: 30. Dec 2009, 20:14
Primary OS: MS Windows 10
VBox Version: PUEL
Guest OSses: Windows, Linux

Re: autostart fails

Post by scottgus1 »

rpvirtualbox wrote:VM status continues to show "State: powered off"
This is probably because the VM is running under a different account than the logged-in account.

Virtualbox can only monitor VMs that are running under the VboxSVC service launched by the logged-on account. If a VM is launched under another account, that VM cannot be monitored by the logged-on VboxSVC service that feeds the main Virtualbox window or vboxmanage. I am not quite certain how to fix this issue for the auto-start service.

As a work-around, if you configure the VM to allow Virtualbox RDP, or make a time-stamped heartbeat file in a shared folder on the host, you could be aware if the VM is running.
rpvirtualbox
Posts: 3
Joined: 5. Apr 2021, 14:31

Re: autostart fails

Post by rpvirtualbox »

Thanks again Scott for being very useful. It's working now as expected.
scottgus1
Site Moderator
Posts: 20965
Joined: 30. Dec 2009, 20:14
Primary OS: MS Windows 10
VBox Version: PUEL
Guest OSses: Windows, Linux

Re: autostart fails

Post by scottgus1 »

Great! Glad you're up and running.
kevin1900000
Posts: 1
Joined: 6. Apr 2021, 20:44

Re: autostart fails

Post by kevin1900000 »

I'm running into a similar issue getting autostart set up on WIN10 - though this is almost certainly my own ignorance. I've followed the instructions in the Ch. 9 section and created a config file, and added the VBOXAUTOSTART_CONFIG environmental variable with the file path to the config file. I created a password file, and tried to run the cmd as administrator but I get this:

Code: Select all

C:\WINDOWS\system32>VBoxAutostartSvc install --user=XXXX [--password-file="C:\Users\XXXX\.VirtualBox\pwd.txt"]
'VBoxAutostartSvc' is not recognized as an internal or external command,
operable program or batch file.
Any ideas what I'm doing wrong?
scottgus1
Site Moderator
Posts: 20965
Joined: 30. Dec 2009, 20:14
Primary OS: MS Windows 10
VBox Version: PUEL
Guest OSses: Windows, Linux

Re: autostart fails

Post by scottgus1 »

Before running that command, run this to point Windows to where the command exists:

CD "C:\Program Files\Oracle\VirtualBox"
phill54
Posts: 1
Joined: 23. Apr 2021, 15:30

Re: autostart fails

Post by phill54 »

Hi,
I'm running into a related issue, bute couldn't fix it so far. I switched from MacOS to Windows a short while ago and went with WSL2 for the last couple of months. Now I'd like to switch to Virtualbox. So I'm probably doing smth wrong regarding the windows-settings.

Code: Select all

PS C:\Windows\System32> VBoxManage.exe --version
6.1.18r142142
I followed the instructions from chapter 9 (ch09.html#autostart). So this is my very basic autostart-config for virtualbox:

Code: Select all

PS C:\> type C:\Users\phill54\.VirtualBox\autostart.properties
# Default policy is to deny starting a VM, the other option is "allow".
default_policy = allow

# Bob is allowed to start virtual machines but starting them
# will be delayed for 10 seconds
phill54 = {
    allow = true
    startup_delay = 10
}
"phill54" is also the account I use for login.

I made sure the env-variable points to the config file above.

Code: Select all

C:\Users\phill54>echo %VBOXAUTOSTART_CONFIG%
C:\Users\phill54\.VirtualBox\autostart.properties
I even made a password-file (but also tried it without interactive password) when adding the service

Code: Select all

PS C:\Windows\system32> VBoxAutostartSvc install --user=phill54 --password-file="C:\Users\phill54\.VirtualBox\autostart.pw"
Successfully created the VBoxAutostartSvcphill54-desktopphill54 service.
Currently I have two VMs

Code: Select all

PS C:\Windows\system32> VBoxManage.exe list vms
"Ubuntu2004" {83974d50-XXXX-XXXX-XXXX-3108f0a8bd8a}
"Ubuntu" {a28df8f1-XXXX-XXXX-XXXX-14d389bc64b9}
PS C:\Windows\system32> VBoxManage.exe list runningvms
PS C:\Windows\system32>
I enabled autostart for on of those VMs

Code: Select all

PS C:\Windows\system32> VBoxManage modifyvm 83974d50-9903-4236-a662-3108f0a8bd8a --autostart-enabled on
PS C:\Windows\system32>
Then i checked the config:

Code: Select all

PS C:\Windows\system32> VBoxManage.exe showvminfo Ubuntu2004
Name:                        Ubuntu2004
Groups:                      /
Guest OS:                    Ubuntu (64-bit)
UUID:                        83974d50-XXXX-XXXX-XXXX-3108f0a8bd8a
Config file:                 C:\Users\phill54\VirtualBox VMs\Ubuntu2004\Ubuntu2004.vbox
Snapshot folder:             C:\Users\phill54\VirtualBox VMs\Ubuntu2004\Snapshots
Log folder:                  C:\Users\phill54\VirtualBox VMs\Ubuntu2004\Logs
...
State:                       powered off
...
Autostart Enabled:           enabled
Autostart Delay:             0
...
I expected everything to work fine.
After reboot, the service hadn't started:
services list entry
services list entry
windows-service-list-entry.png (2.36 KiB) Viewed 4452 times
So I right-clicked and tried to start it manually
windows-service-list-entry-running
windows-service-list-entry-running
windows-service-list-entry-running.png (2.62 KiB) Viewed 4452 times
By now I really thought I'd get there somehow, but when I checked if the machine was running (VBoxManage list runningvms) the result was empty.
Since I read that the machine might be running in a separated space, the status might not show the correct state. As I had set up a ssh-server inside the machine that should be available on a network interface, i tried to connect, but the ssh-client times out. The desktop-gui also approves, that the machine is not running.

When I manually start the machine, the status is shown correct and ssh-connection works.

Since this windows, I don't know where to start debugging this...
I'd really appreciate a hint. Thanks!
LiteCross91
Posts: 3
Joined: 25. Jan 2024, 18:38

Re: autostart fails

Post by LiteCross91 »

rpvirtualbox wrote: 5. Apr 2021, 14:46 Followed the steps outlined under autostart-windows of docs-oracle-com

It is expected that the VM should run without having any user to login to the system

1. Create c:\virtualbox\virtualbox file with following data
default_policy = allow
“administrator” = {
allow = true
startup_delay = 120
}

2. added the VBOXAUTOSTART_CONFIG environment variable into system variables containing the path to above config file (c:\virtualbox\virtualbox)

3. Created c:\virtualbox\admin file with administrator password in it.

4. Ran this command => VBoxAutostartSvc install --user=administrator --password-file=c:\virtualbox\admin

5. Deleted c:\virtualbox\admin file

Dont see guest VM running after boot after the startup_delay.

Skimming thru event_logs (SYSTEM) show the error "The VirtualBox Autostart Service administrator@host-c8dpki8 service terminated with the following error: A device attached to the system is not functioning."

Also this error occurs during booting process & does not wait for the completion of start_up delay. Appreciate any help. Thanks
I found the solution:

"... in autostart.properties, there must be an empty newline at the end of the file. –
SebiF
Apr 6, 2023 at 9:14 "
Last edited by LiteCross91 on 25. Jan 2024, 18:39, edited 1 time in total.
LiteCross91
Posts: 3
Joined: 25. Jan 2024, 18:38

Re: autostart fails

Post by LiteCross91 »

So it's important for the service to run that there is an empty line at the end of the config file.
However, with Virtualbox 7.x, the Show button does not work after reboot.
On version 6.1.50 it works fine.

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.
scottgus1
Site Moderator
Posts: 20965
Joined: 30. Dec 2009, 20:14
Primary OS: MS Windows 10
VBox Version: PUEL
Guest OSses: Windows, Linux

Re: autostart fails

Post by scottgus1 »

LiteCross91 wrote: 25. Jan 2024, 19:44 with Virtualbox 7.x, the Show button does not work after reboot.
On version 6.1.50 it works fine.
This should be reported on the Bugtracker, especially since 6.1 is not longer getting developed. Any supporting info and logs from the VMs, using working 6.1.50 and failing 7.0.14, will be of use on the ticket.
LiteCross91
Posts: 3
Joined: 25. Jan 2024, 18:38

Re: autostart fails

Post by LiteCross91 »

scottgus1 wrote: 25. Jan 2024, 19:57
LiteCross91 wrote: 25. Jan 2024, 19:44 with Virtualbox 7.x, the Show button does not work after reboot.
On version 6.1.50 it works fine.
This should be reported on the Bugtracker, especially since 6.1 is not longer getting developed. Any supporting info and logs from the VMs, using working 6.1.50 and failing 7.0.14, will be of use on the ticket.
Ticket has opened:
https://www.virtualbox.org/ticket/21973
Post Reply