Configure xvfb for Vivid (15.04) as a service using systemd

Vivid switched from upstart to systemd. I used to have xfvb configured to run as a service under updstart. That has now broken.

Under upstart, I had /etc/init/xvfb.conf:

description "Xvfb X Server"
start on (net-device-up and local-filesystems and runlevel [2345])
stop on runlevel [016]
exec /usr/bin/Xvfb :99 -screen 0 1024x768x24

and I could start it with sudo service xvfb start

Under 15.04, I now get this message when I try to use service to start xvfb:

Failed to start xvfb.service: Unit xvfb.service failed to load: No such file or directory.

What is the new way to configure xvfb to run as a service with systemd?

1

1 Answer

Under systemd you create /etc/systemd/system/xvfb.service

[Unit]
Description=X Virtual Frame Buffer Service
After=network.target
[Service]
ExecStart=/usr/bin/Xvfb :99 -screen 0 1024x768x24
[Install]
WantedBy=multi-user.target

And then run

sudo systemctl enable /etc/systemd/system/xvfb.service

At which point

sudo service xvfb start

will start it:

$ ps -elfwww | grep -i Xvfb
4 S root 7807 1 2 80 0 - 51102 poll_s 16:47 ? 00:00:00 /usr/bin/Xvfb :99 -screen 0 1024x768x24

and

sudo service xvfb stop

will kill it

3

Your Answer

Sign up or log in

Sign up using Google Sign up using Facebook Sign up using Email and Password

Post as a guest

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

You Might Also Like