Longa história curta ... você precisa escrever seu próprio script init.d para rodar em nível de execução 0 (parada) e / ou 6 (reinicialização) e talvez executar nível 1 (modo de usuário único, típico para situações de recuperação).
Por exemplo, em /etc/init.d/virtualbox, crie algo assim:
#!/bin/sh
### BEGIN INIT INFO
# Provides: virtualbox_start_and_stop
# Required-Start: $local_fs $network
# Required-Stop: $local_fs
# Default-Start: 2 3 4 5
# Default-Stop: 0 1 6
# Short-Description:
# Description: Start virtualbox on boot, and shutdown safely on shutdown/reboot.
### END INIT INFO
case "$1" in
start)
echo "Starting Virtualbox "
# Do whatever to start or resume your virtualbox instances.
# Perhaps look for a txt file someplace with VMs that need to be restarted or resumed... then start 'em.
;;
stop)
echo "Stopping Virtualbox"
# Do something to either shutdown or savestate your virtualbox instances.
# maybe also save the instances that should be resumed into a txt file someplace for the start method above.
;;
*)
echo "Usage: /etc/init.d/virtualbox {start|stop}"
exit 1
;;
esac
exit 0
Verifique se é executável ( chmod +x /etc/init.d/virtualbox )
e, em seguida, execute update-rc.d virtualbox defaults para criar todos os links simbólicos apropriados nos locais corretos para iniciar / parar corretamente.