Tuesday, November 22, 2011

A trivial systemd unit script: vboxservice.service

In a VirtualBox guest, VBoxService (which is for example responsible for setting the time after a host suspend/resume) is not started on boot. I thought about writing a simple init script to doit (editing the vboxadd init script seemed like a bad idea, since it might get overwritten on updates).
Then I decided to try the "native systemd" way.
Executive summary: it is much easier than with old style SysV init:

# cat /etc/systemd/system/vboxservice.service
[Unit]
Description=VirtualBox guest services

[Service]
ExecStart=/usr/bin/VBoxService -f

[Install]
WantedBy=default.target

Activate with systemctl enable vboxservice.service.

1 comment:

  1. Also

    [Unit]
    ...
    ConditionVirtualization=oracle

    Comes handy to ensure it is never started in a non virtualbox guest.

    ReplyDelete