我仔细遵循了这一点:如何在引导时自动启动虚拟机?
它“破坏”了 VirtualBox。我必须删除自动启动的东西并运行 VirtualBox 在错误消息中推荐的重新配置命令,以使 VirtualBox 再次工作。
创建文件 /etc/default/virtualbox
# virtualbox defaults file
VBOXAUTOSTART_DB=/etc/vbox
VBOXAUTOSTART_CONFIG=/etc/vbox/vbox.cfg
这是 /etc/vbox/vbox.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 1775 /etc/vbox
sudo usermod -a -G vboxusers USERNAME
阅读 /etc/vbox/vbox.cfg 似乎有问题
:~$ ls -l /etc/vbox
total 8
-rw------- 1 USERNAME USERNAME 1 Dec 14 01:37 USERNAME.start
-rw-r--r-- 1 root root 179 Dec 14 01:31 vbox.cfg
下一个:
VBoxManage setproperty autostartdbpath /etc/vbox
VBoxManage modifyvm <uuid|vmname> --autostart-enabled on
这在 /etc/vbox 目录中创建了 USERNAME.start 文件 - 尽管该文件似乎是空的。
然后错误:
● vboxautostart-service.service
Loaded: loaded (/usr/lib/virtualbox/vboxautostart-service.sh; enabled; vendor preset: enabled)
Active: failed (Result: exit-code) since Fri 2018-12-14 01:41:57 CST; 27s ago
Process: 4002 ExecStart=/usr/lib/virtualbox/vboxautostart-service.sh start (code=exited, status=2)
Dec 14 01:41:57 HOST systemd[1]: Starting vboxautostart-service.service...
Dec 14 01:41:57 HOST vboxautostart-service.sh[4002]: /usr/lib/virtualbox/vboxautostart-service.sh: 2:/etc/vbox/vbox.cfg: default_policy: not found
Dec 14 01:41:57 HOST vboxautostart-service.sh[4002]: /usr/lib/virtualbox/vboxautostart-service.sh: 4: /etc/vbox/vbox.cfg: USERNAME: not found
Dec 14 01:41:57 HOST vboxautostart-service.sh[4002]: /usr/lib/virtualbox/vboxautostart-service.sh: 5: /etc/vbox/vbox.cfg: allow: not found
Dec 14 01:41:57 HOST vboxautostart-service.sh[4002]: /usr/lib/virtualbox/vboxautostart-service.sh: 6: /etc/vbox/vbox.cfg: Syntax error: "}" unexpected
Dec 14 01:41:57 HOST systemd[1]: vboxautostart-service.service: Control process exited, code=exited status=2
Dec 14 01:41:57 HOST systemd[1]: vboxautostart-service.service: Failed with result 'exit-code'.
Dec 14 01:41:57 HOST systemd[1]: Failed to start vboxautostart-service.service.