I have run in to an issue, running version 5.2 on Ubuntu 16.04. I can get it to start only one VM on boot by autostart. The second runs if we manually start it. I used the following :
1. Configuration files
/etc/default/virtualbox
sudo nano /etc/default/virtualbox then add:
VBOXAUTOSTART_DB=/etc/vbox
VBOXAUTOSTART_CONFIG=/etc/vbox/autostart.cfg
/etc/vbox/autostart.cfg
sudo nano /etc/vbox/autostart.cfg then add:
default_policy = deny
# Create an entry for each user allowed to use autostart
myusername = {
allow = true
}
sudo chgrp vboxusers /etc/vbox
sudo chmod 1775 /etc/vbox
Then, for each allowed username: sudo usermod -aG vboxusers USERNAME, then log out and in for it to apply.
2. Choose VMs to automatically start and stop
The first time a user configures autostart, the command: VBoxManage setproperty autostartdbpath /etc/vbox needs to be run.
Note: The autostart options are stored in the /etc/vbox file, and the VM itself. If moving the vm, the options may need to be set again.
VBoxManage modifyvm <uuid|vmname> --autostart-enabled <on|off>
You can also: VBoxManage modifyvm <uuid|vmname> --autostop-type <disabled|savestate|poweroff|acpishutdown>
3. Restart VirtualBox autostart service
sudo service vboxautostart-service restart
I have over the years done this multiple ways for varying OS's. I have even scripted a few. This looked straight forward. It only starts 1 VM and leaves the other off it shutsdown the 1 VM properly also.
Anyone have this working properly and did I miss something?
Autostart will not start multiple VM's on boot.
Re: Autostart will not start multiple VM's on boot.
I know that the thread it's a bit old but I've found a solution, so maybe it would be useful for someone...
I've just run into the same problem.
Ubuntu Server 16.04 LTS with VirtualBox 5.2.10r122088.
When there are two or more machines marked to start during host boot then only the first one is being started.
I found that the startup procedure is using "vboxautostart-service.sh" script (located in my system in /usr/lib/virtualbox)
The startup method code:
The problem is in that line:
Output from "binary" (VBoxAutostart) is being redirected to /dev/null...even stderr, so that's the reason why we cannot found errors anywhere in VBox logs. Great...
So, I've replaced that /dev/null with some file and during startup I've got:
Simply putting a sleep 10 right after the line with "start daemon" fixes the problem.
Not sure if that is a good solution, probably not, I would say it's a workaround but at least it works.
Is there any chance that it would be fixed in a right way?
I've just run into the same problem.
Ubuntu Server 16.04 LTS with VirtualBox 5.2.10r122088.
When there are two or more machines marked to start during host boot then only the first one is being started.
I found that the startup procedure is using "vboxautostart-service.sh" script (located in my system in /usr/lib/virtualbox)
The startup method code:
Code: Select all
start() {
[ -z "$VBOXAUTOSTART_DB" ] && exit 0
[ -z "$VBOXAUTOSTART_CONFIG" ] && exit 0
begin_msg "Starting VirtualBox VMs configured for autostart" console;
vboxdrvrunning || {
fail_msg "VirtualBox kernel module not loaded!"
exit 0
}
PARAMS="--background --start --config $VBOXAUTOSTART_CONFIG"
# prevent inheriting this setting to VBoxSVC
unset VBOX_RELEASE_LOG_DEST
for user in `ls $VBOXAUTOSTART_DB/*.start`
do
start_daemon `basename $user | sed -ne "s/\(.*\).start/\1/p"` $binary $PARAMS > /dev/null 2>&1
done
return $RETVAL
}
Code: Select all
start_daemon `basename $user | sed -ne "s/\(.*\).start/\1/p"` $binary $PARAMS > /dev/null 2>&1
So, I've replaced that /dev/null with some file and during startup I've got:
So, if I understand correctly, the VBoxAutostart is running (in background) for some time booting up the first VM. Somewhere there is a check which doesn't allow to run VBoxAutostart multiple times at once, but the for loop doesn't wait for VBoxAutostart to complete and invokes it again and again for remaining VMs.VBoxAutostart is already running
Simply putting a sleep 10 right after the line with "start daemon" fixes the problem.
Code: Select all
for user in `ls $VBOXAUTOSTART_DB/*.start`
do
start_daemon `basename $user | sed -ne "s/\(.*\).start/\1/p"` $binary $PARAMS > /dev/null 2>&1
sleep 10
done
Is there any chance that it would be fixed in a right way?
-
- Site Moderator
- Posts: 27329
- Joined: 22. Oct 2010, 11:03
- Primary OS: Mac OS X other
- VBox Version: PUEL
- Guest OSses: Win(*>98), Linux*, OSX>10.5
- Location: Greece
Re: Autostart will not start multiple VM's on boot.
It always gives me a smile when a new user/first post is about an advice, rather than a question
You could subscribe to the developer's mailing list, or go over to IRC at [url]irc://irc.freenode.net/#vbox-dev[/url] and send your improvements, or just point them to this post.krzystar wrote:Is there any chance that it would be fixed in a right way?
Do NOT send me Personal Messages (PMs) for troubleshooting, they are simply deleted.
Do NOT reply with the "QUOTE" button, please use the "POST REPLY", at the bottom of the form.
If you obfuscate any information requested, I will obfuscate my response. These are virtual UUIDs, not real ones.
Do NOT reply with the "QUOTE" button, please use the "POST REPLY", at the bottom of the form.
If you obfuscate any information requested, I will obfuscate my response. These are virtual UUIDs, not real ones.
Re: Autostart will not start multiple VM's on boot.
@krzystar, the "right way" to deal with this problem appears to be by adding the "startup_delay" parameter in your "/etc/vbox/autostart.cfg" file. For example:
Where the value of startup_delay is seconds (in this example, ten seconds). The VBoxAutostart binary contains a copy of this string, so I assume it is using it to implement a delay between each invocation of itself, which appears to have the same effect as what you did in the script. Adding this startup_delay parameter to my autostart.cfg file fixed the problem for me. I would prefer that Oracle provided a solution that actually checked for the prior invocation of VBoxAutostart to be complete, depending on delays is always dicey and not an rugged solution.
Code: Select all
default_policy = deny
xmnboy = {
allow = true
startup_delay = 10
}
-
- Posts: 1
- Joined: 13. Sep 2021, 17:01
Re: Autostart will not start multiple VM's on boot.
I know this is a very , very old thread, but there is still the same issue.,
Wondering if there was a fix/workaround/solution ...
Did lookup a lot, and didn't find any.,
This still an issue., could any one point me in the right directions?-
tks in advance.,
Wondering if there was a fix/workaround/solution ...
Did lookup a lot, and didn't find any.,
This still an issue., could any one point me in the right directions?-
tks in advance.,