Virtualbox headless : not starting via systemd

标签 virtualbox archlinux systemd

已经尝试过 this Topic但没有解决它

我在/lib/systemd/system/vbox.service 下放置了一个名为 vbox.service 的文件,其中包含以下内容:

[Unit]
Description=Virtualbox Headless VM

[Service]
ExecStart=/usr/bin/VBoxHeadless --startvm 4decf7c1-7eda-461c-92aa-835d2405a22e
ExecStop=/usr/bin/VBoxManage controlvm 4decf7c1-7eda-461c-92aa-835d2405a22e poweroff
User=my_user

[Install]
WantedBy=muti-user.target

如果我通过以下方式启动和停止它 sudo systemctl start vboxsudo systemctl stop vbox ,一切正常 然后我输入以下内容: sudo systemctl enable vbox ,但它不会在启动时启动 这是输出

sudo systemctl status vbox
vbox.service - Virtualbox Headless VM
      Loaded: loaded (/usr/lib/systemd/system/vbox.service; enabled)
      Active: inactive (dead)
      CGroup: name=systemd:/system/vbox.service

Jan 05 02:38:59 exia pulseaudio[1428]: [pulseaudio] main.c: Daemon startup failed.
Jan 05 02:40:08 exia systemd[1]: Started Virtualbox Headless VM.
Jan 05 02:42:02 exia systemd[1]: Stopping Virtualbox Headless VM...
Jan 05 02:42:02 exia VBoxManage[1546]: 0%...10%...20%...30%...40%...50%...60%...70%...80%...90%...100%
Jan 05 02:42:02 exia VBoxHeadless[1375]: Oracle VM VirtualBox Headless Interface 4.2.6_OSE
Jan 05 02:42:02 exia VBoxHeadless[1375]: (C) 2008-2012 Oracle Corporation
Jan 05 02:42:02 exia VBoxHeadless[1375]: All rights reserved.
Jan 05 02:42:02 exia VBoxHeadless[1375]: VRDE server is listening on port 3389.
Jan 05 02:42:02 exia VBoxHeadless[1375]: VRDE server is inactive.
Jan 05 02:42:02 exia systemd[1]: Stopped Virtualbox Headless VM.
/usr/bin/VBoxHeadless --startvm 4decf7c1-7eda-461c-92aa-835d2405a22e 工作正常 不过有什么想法吗?

最佳答案

This page on the Arch Linux wiki包含一个稍微灵活的 systemd.service 文件和一些可能是关键的附加选项。

该页面还提到 VirtualBox 4.2 有一个内置的自动启动机制,可能会工作得更好。

/etc/systemd/system/<a href="https://stackoverflow.com/cdn-cgi/l/email-protection" class="__cf_email__" data-cfemail="e99f8b86919f849a8c9b9f808a8ca9c79a8c9b9f808a8c" rel="noreferrer noopener nofollow">[email protected]</a>

[Unit]
Description=VBox Virtual Machine %i Service
Requires=systemd-modules-load.service
After=systemd-modules-load.service

[Service]
User=user
Group=vboxusers
ExecStart=/usr/bin/VBoxHeadless -s %i
ExecStop=/usr/bin/VBoxManage controlvm %i savestate

[Install]
WantedBy=multi-user.target

关于Virtualbox headless : not starting via systemd,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/14171481/

相关文章:

odbc - unixodbc 驱动程序管理器在安装时无法打开指定的库

python - 从 windows 浏览器访问 ubuntu 虚拟机主机

windows - Laravel 家园 : Provisioning failing on Windows 8

linux - chmod 不适用于 virtualbox 共享文件夹

php - Archlinux::pacman phpmyadmin 返回 404

ruby - 使用 ruby​​-install/ruby-build 在 Archlinux 上安装 Ruby 2.1.x 和 2.3.x 时出现 OpenSSL 错误

linux - Android 平台工具 : "A stop job is running for Session 2 of UserX",,我必须等待 90 秒才能断电

linux - 尝试在 systemd 下运行访问 X 服务器的服务

python - systemd中pyenv下的jupyter笔记本仅提供系统python

networking - vagrant中如何设置公网网关