You are not logged in.
Pages: 1
Topic closed
I'm trying to write a simple service file for VBoxHeadless (for my headless server).
│[Unit]
Description=Virtualbox Headless WinXP VM
[Service]
ExecStart=/usr/bin/VBoxHeadless --startvm WinXP
[Install]
WantedBy=multi-user.target
Somehow whenever I run it I get (from systemctl status) the following:-
% systemctl status vbox.service
vbox.service - Virtualbox Headless WinXP VM
Loaded: loaded (/etc/systemd/system/vbox.service; disabled)
Active: failed (Result: exit-code) since Fri, 24 Aug 2012 15:29:38 +0800; 2s ago
Process: 28938 ExecStart=/usr/bin/VBoxHeadless --startvm WinXP (code=exited, status=1/FAILURE)
CGroup: name=systemd:/system/vbox.service
This is the default Type=Simple, forking and oneshot does not seem to help. Any suggestions? Of course, just running /usr/bin/VBoxHeadless --startvm WinXP works...
One interesting point to note is that VBoxHeadless is merely a symlink to VBox (which can't be run by itself). Not sure how useful that is. It might make sense for me to use VBoxManage instead, but if possible I'd like to get it working using VBoxHeadless since as far as I can tell that does the 'right thing' (tm).
Last edited by ngoonee (2012-08-27 00:52:26)
Allan-Volunteer on the (topic being discussed) mailn lists. You never get the people who matters attention on the forums.
jasonwryan-Installing Arch is a measure of your literacy. Maintaining Arch is a measure of your diligence. Contributing to Arch is a measure of your competence.
Griemak-Bleeding edge, not bleeding flat. Edge denotes falls will occur from time to time. Bring your own parachute.
Offline
When I execute
% systemctl status vbox.service
there is a log at the bottom which I don't see in your output (in my case it tells about invalid machine name). Do you have systemd-journald running?
I guess that with this unit file VBoxHeadless is being executed as root user and therefore can't find virtual machine with the specified name. Adding "User=my_username" right below the "[Service]" line gives me the following result:
[root@archhost system]# systemctl status vbox
vbox.service - Virtualbox Headless WinXP VM
Loaded: loaded (/etc/systemd/system/vbox.service; disabled)
Active: active (running) since Fri, 24 Aug 2012 21:45:37 +0400; 12s ago
Main PID: 14515 (VBoxHeadless)
CGroup: name=systemd:/system/vbox.service
├ 14515 /usr/bin/VBoxHeadless --startvm winxp
├ 14518 /opt/VirtualBox/VBoxXPCOMIPCD
└ 14523 /opt/VirtualBox/VBoxSVC --auto-shutdown
Hope this helps.
Offline
In case Atragor's suggestion does not help. Try enabling some debugging in VirtualBox (I don't know how, never used it) and also do "systemctl status ..." as root to see the log messages (or add your user to the "adm" group).
Offline
Thanks, the user thing would probably be it (never thought of it that way, even though I'm used to using su with custom rc.d scripts....) Will confirm that on Monday when I get back to my server.
Allan-Volunteer on the (topic being discussed) mailn lists. You never get the people who matters attention on the forums.
jasonwryan-Installing Arch is a measure of your literacy. Maintaining Arch is a measure of your diligence. Contributing to Arch is a measure of your competence.
Griemak-Bleeding edge, not bleeding flat. Edge denotes falls will occur from time to time. Bring your own parachute.
Offline
That was exactly it, User=my_user worked. Thanks Atragor and tomegun.
Full vbox.service for future reference if anyone is interested (and myself via google 3 years from now):-
[Unit]
Description=Virtualbox Headless VM
[Service]
ExecStart=/usr/bin/VBoxHeadless --startvm VM_Name
ExecStop=/usr/bin/VBoxManage controlvm VM_Name poweroff
User=my_user
[Install]
WantedBy=muti-user.target
I assume Type by default is simple, didn't define it. Not sure if VBoxHeadless forks, doubt it since it steals my TTYs.
Allan-Volunteer on the (topic being discussed) mailn lists. You never get the people who matters attention on the forums.
jasonwryan-Installing Arch is a measure of your literacy. Maintaining Arch is a measure of your diligence. Contributing to Arch is a measure of your competence.
Griemak-Bleeding edge, not bleeding flat. Edge denotes falls will occur from time to time. Bring your own parachute.
Offline
Hmm that doesnt work for me...
I have placed a file called vbox.service under /lib/systemd/system/vbox.service with the following content
[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
If I start and stop it via
sudo systemctl start vbox and sudo systemctl stop vbox, everything works fine
Then i entered the following:
sudo systemctl enable vbox, but it wont start at boot
Here is the output
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 works fine
Any ideas, though?
Offline
Kind of a necrobump... might be better to start your own thread and link to this one.
In any case, I assume that trying to start it at boot is problematic without determining some kind of ordering (After=, Requires=, etc.)
Offline
Kind of a necrobump... might be better to start your own thread and link to this one.
Done
Offline
With that ^^^ , I will close this
Nothing is too wonderful to be true, if it be consistent with the laws of nature -- Michael Faraday
Sometimes it is the people no one can imagine anything of who do the things no one can imagine. -- Alan Turing
---
How to Ask Questions the Smart Way
Offline
Pages: 1
Topic closed