跳过正文

VirtualBox6.x开机自启动

Tech VirtualBox
浮世絵空事
作者
浮世絵空事
所谓灵魂 几行代码

https://docs.oracle.com/en/virtualization/virtualbox/6.0/admin/autostart.html

编辑/etc/default/virtualbox

 # virtualbox defaults file
VBOXAUTOSTART_DB=/etc/vbox
VBOXAUTOSTART_CONFIG=/etc/vbox/autostart.cfg

创建文件/etc/vbox/autostart.cfg

# Default policy is to deny starting a VM, the other option is "allow".
default_policy = deny
# Create an entry for each user allowed to run autostart
username = {
  allow = true
}

修改权限,配置虚拟机自启动

sudo chgrp vboxusers /etc/vbox
sudo chmod 777 /etc/vbox
sudo usermod -a -G vboxusers $USER

# 这一步似乎可以省略
# VBoxManage setproperty autostartdbpath /etc/vbox
VBoxManage modifyvm <uuid|vmname> --autostart-enabled on