You are not logged in.
Pages: 1
Hello:
I use a headless VirtualBox VM to run a stripped down Devuan Chimaera with Pi-hole + unbound.
Has worked without issues but these days I am having some issues with it coming on-line.
eg: stalling
To spin up the VM, I use its own start-up service to which I can add a delay but for some reason (another topic) sometimes it does not work. so I thought about being consistent with Devuan and having this VM (only one needed at boot) start-up via [sysvinit].
A search on the web got me this:
#!/bin/sh
### BEGIN INIT INFO
# Provides: vbox-autostart
# Required-Start: $local_fs $syslog $network vboxdrv
# Required-Stop: $local_fs $syslog $network vboxdrv
# Default-Start: 2 3 4 5
# Default-Stop: 0 1 6
# Short-Description: Autostart VirtualBox VMs on Devuan SysVinit
### END INIT INFO
case "$1" in
start)
echo "Starting VirtualBox VMs for user $VM_USER..."
for VM in $VMS; do
echo "Booting $VM..."
su - $VM_USER -c "/usr/bin/VBoxManage startvm \"$VM\" --type headless"
done
;;
stop)
echo "Stopping VirtualBox VMs gracefully..."
for VM in $VMS; do
echo "Sending ACPI shutdown to $VM..."
su - $VM_USER -c "/usr/bin/VBoxManage controlvm \"$VM\" acpipowerbutton"
done
# Give the VMs a few seconds to flush disk cache and turn off
echo "Waiting for VMs to close..."
sleep 10
;;
restart)
$0 stop
$0 start
;;
status)
echo "Currently running VMs:"
su - $VM_USER -c "/usr/bin/VBoxManage list runningvms"
;;
*)
echo
exit 1
;;
esac
exit 0The rest is the making the script executable and registering it, which I recall having done at some time with some script.
As root: chmod +x /etc/init.d/vbox-autostart and update-rc.d vbox-autostart defaults 99 10
I have no trust in this AI thing and don't want to screw up anything so I'd appreciate some input.
eg: the [99 10] at the end of the [update-rc.d] line.
I only need to make sure the network is up for the VM to start so that Conky can fetch my IPv4 address.
Does that not get taken care of with the [Required-start] line in the script?
Shouldn't Conky have its own script (?) to make sure it does not start before the VM is upand not depend on a delay?
Best,
A.
Offline
chmod +x /etc/init.d/vbox-autostart looks OK.
Try man update-rc.d to see what the second command will do. I'd try update-rc.d -n vbox-autostart defaults 99 10 first (the -n means just say what it would do).
Offline
The numbers are just the start and kill sequence numbers, where/when in the process you want them to start/stop, as some things depend on other things already being started. So the 99 indicates you want it to start after everything else when booting, and kill early in the shutdown process.
The start/stop run-levels are now contained in the LSB info at the top of the script rather than in the update-rc.d command like they used to back in the day, thus "defaults" means use the lsb data.
Last edited by greenjeans (Yesterday 17:28:25)
https://sourceforge.net/projects/vuu-do/ Vuu-do GNU/Linux, Devuan-based Openbox systems.
Devuan 6 mate-mini iso, pure Devuan, 100% no-vuu-do. Now with Xlibre as well.
Please donate to support Devuan and init freedom! https://devuan.org/os/donate
https://devuanusers.com/ Apps source : https://git.devuan.org/greenjeans
Offline
Hello:
chmod +x /etc/init.d/vbox-autostart looks OK.
... man update-rc.d to see ...
Yes, I knew what those numbers were for but I did not want to go too far with the delay in starting.
eg: it could be that [99] is too much, maybe [44] would be enough.
99 indicates you want it to start after everything else ...
... kill early in the shutdown process.
Right.
... taken care of with the [Required-start] line in the script?
... start/stop run-levels are now contained in the LSB info ...
I see.
So [99] and [10] not needed?
Good to know.
And what about Conky ...
A [sysvinit] script to make sure it starts (with no delays) only if the network is up or stay as it is with a delay that does not always work?
Any one have a [sysvinit] script for Conky?
Thanks you both for your input.
Best,
A.
Offline
I see.
So [99] and [10] not needed?
Good to know.
Maybe yes, maybe no, if no number is specified the system defaults to giving it a priority of 20, which may not work for you.
Never used an init script for conky before, I start it from the openbox autostart file, and in fact I just moved the nm-applet there too out of /etc/xdg/autostart, and set it to start before conky. Xdg also has an autostart config file if you make one but I never did.
Last edited by greenjeans (Yesterday 18:14:50)
https://sourceforge.net/projects/vuu-do/ Vuu-do GNU/Linux, Devuan-based Openbox systems.
Devuan 6 mate-mini iso, pure Devuan, 100% no-vuu-do. Now with Xlibre as well.
Please donate to support Devuan and init freedom! https://devuan.org/os/donate
https://devuanusers.com/ Apps source : https://git.devuan.org/greenjeans
Offline
I don't mess with init scripts. I have a vague memory of making desktop buttons to start specific virtual machines with some vbox command that I don't remember. You could probably start it with a command right after user autologin after all necessary services are running.
(Warning. This was so long ago, I might be remembering something with vmware.)
Offline
Pages: 1