我无法设置我的VirtualBox
客户机(例如,vm1)在重启后重新启动。
我遵循了以下建议:
- https://wdmbr.wordpress.com/2018/12/14/how-to-set-your-virtualbox-vm-to-automatically-startup/
- http://nathangiesbrecht.com/centos-7-virtualbox-vboxautostart-service-setup
- https://pgaskin.net/linux-tips/configuring-virtualbox-autostart/
(请参阅下面的所有步骤)
但是,重新启动后,vboxautostart-service,
我仍然看不到我的 VirtualBox 客户机运行!
将 vm1 guest 虚拟机设置为自动重启的步骤:
[qa@vestal ~]$ sudo vim /etc/default/virtualbox
[qa@vestal ~]$ cat /etc/default/virtualbox
VBOXAUTOSTART_DB=/etc/vbox
VBOXAUTOSTART_CONFIG=/etc/vbox/autostart.cfg
[qa@vestal ~]$ sudo vim /etc/vbox/autostart.cfg
[qa@vestal ~]$ cat /etc/vbox/autostart.cfg
default_policy = deny
# Create an entry for each user allowed to use autostart
qa = {
allow = true
}
[qa@vestal ~]$ sudo chgrp vboxusers /etc/vbox
[qa@vestal ~]$ sudo chmod 1775 /etc/vbox
[qa@vestal ~]$ sudo usermod -aG vboxusers qa
[qa@vestal ~]$ groups qa
qa : qa wheel vboxsf vboxusers
[qa@vestal ~]$ VBoxManage setproperty autostartdbpath /etc/vbox
[qa@vestal ~]$ VBoxManage modifyvm vm1 --autostart-enabled on
[qa@vestal ~]$ VBoxManage modifyvm vm1 --autostop-type savestate
[qa@vestal ~]$ vboxmanage showvminfo vm1 | grep Autostart
Autostart Enabled: enabled
Autostart Delay: 0
[qa@vestal ~]$ sudo service vboxautostart-service restart
Redirecting to /bin/systemctl restart vboxautostart-service.service
[qa@vestal ~]$ sudo systemctl enable vboxautostart-service
[qa@vestal ~]$ ls -ls /etc/vbox/qa.start
4 -rw------- 1 qa qa 1 Jun 17 16:28 /etc/vbox/qa.start
[qa@vestal ~]$ ls -ls /etc/vbox
total 12
4 -rw-r--r-- 1 root root 105 Jun 17 16:26 autostart.cfg
4 -rw------- 1 qa qa 1 Jun 17 16:28 qa.start
4 -rw------- 1 qa qa 1 Jun 17 16:28 qa.stop
[qa@vestal ~]$ sudo systemctl restart vboxautostart-service
[qa@vestal ~]$ sudo reboot
...
[qa@vestal ~]$ sudo systemctl status vboxautostart-service -l
● vboxautostart-service.service
Loaded: loaded (/usr/lib/virtualbox/vboxautostart-service.sh; enabled; vendor preset: disabled)
Active: active (exited) since Mon 2019-06-17 16:43:15 PDT; 2min 54s ago
Process: 3109 ExecStart=/usr/lib/virtualbox/vboxautostart-service.sh start (code=exited, status=0/SUCCESS)
Tasks: 0
Jun 17 16:43:12 vestal systemd[1]: Starting vboxautostart-service.service...
Jun 17 16:43:12 vestal vboxautostart-service.sh[3109]: vboxautostart-service.sh: Starting VirtualBox VMs configured for autostart.
Jun 17 16:43:13 vestal vboxautostart-service.sh[3117]: Starting VirtualBox VMs configured for autostart.
Jun 17 16:43:13 vestal su[3132]: (to qa) root on none
Jun 17 16:43:15 vestal systemd[1]: Started vboxautostart-service.service.
[qa@vestal ~]$ VBoxManage list runningvms
[qa@vestal ~]$
知道我做错了什么吗?
答案1
也许答案是将启动行放在重启过程中运行的系统初始化文件中。