sudo deb http://download.virtualbox.org/virtualbox/debian stretch contrib
wget https://www.virtualbox.org/download/oracle_vbox_2016.asc sudo apt-key add oracle_vbox_2016.asc wget https://www.virtualbox.org/download/oracle_vbox.asc sudo apt-key add oracle_vbox.asc
sudo apt-get update sudo apt-get install virtualbox-6.0
sudo virtualbox
deb http://ftp.debian.org/debian stretch-backports main contrib
sudo apt update sudo apt install virtualbox-guest-dkms virtualbox-guest-x11 linux-headers-$(uname -r)
There are several options to autostart (and autostop) virtual machines. For a server environment with a Debian host the 1. option through rc.local is preferrable.
runuser -l <user> -c "vboxmanage startvm <vm-name> --type headless"
runuser -l <user> -c "ssh <vm-name> 'sudo systemctl poweroff </dev/null &>/dev/null &'" while [ "`runuser -l <user> -c 'vboxmanage list runningvms'`" != "" ] do echo waiting for VMs to shutdown sleep 5 done
sudo visudo <user> ALL=(root) NOPASSWD: /sbin/systemctl poweroff
VBoxManage startvm <VM name>
sudo vim /etc/default/virtualbox VBOXAUTOSTART_DB=/etc/vbox VBOXAUTOSTART_CONFIG=/etc/vbox/autostart.cfg sudo vim /etc/vbox/autostart.cfg default_policy = deny # Create an entry for each user allowed to use autostart username = { allow = true startup_delay = 10 } sudo chgrp vboxusers /etc/vbox sudo chmod 1775 /etc/vbox sudo usermod -aG vboxusers username
VBoxManage setproperty autostartdbpath /etc/vbox # first time a user configures autostart only VBoxManage modifyvm <vmname> --autostart-enabled <on|off> VBoxManage modifyvm <vmname> --autostop-type <disabled|savestate|poweroff|acpishutdown>
sudo service vboxautostart-service restart
vboxmanage startvm MachineName
vboxmanage controlvm MachineName acpipowerbutton
In xfce desktop, make sure the action on Power Button is set in Settings –> Power Manager
Set different timeouts to the shutdown command used by NUT. For example, set +0 for the clients, and +1 for the host.
One of the following commands:
VBoxManage list runningvms vboxmanage list vms --long | grep -e "Name:" -e "State:"
audo apt update sudo apt upgrade
sudo apt update sudo apt install virtualbox-6.1
sudo vboxmanage extpack uninstall "Oracle VM VirtualBox Extension Pack"
wget https://download.virtualbox.org/virtualbox/6.1.30/Oracle_VM_VirtualBox_Extension_Pack-6.1.30.vbox-extpack sudo vboxmanage extpack install Oracle_VM_VirtualBox_Extension_Pack-6.1.30.vbox-extpack
vboxmanage startvm "<vm_name>" --type headless
sudo apt-mark hold virtualbox-6.1
sudo apt-mark unhold virtualbox-6.1