Configure xvfb for Vivid (15.04) as a service using systemd
5,191
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
Related videos on Youtube
Author by
Stephen Ostermiller
Contact Me Website GitHub Facebook LinkedIn
Updated on September 18, 2022Comments
-
Stephen Ostermiller over 1 year
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?
-
JdeBP almost 9 yearsSee also superuser.com/questions/319040 .
-
-
JdeBP almost 9 yearsYou could also point out what
sudo systemctl status xvfb.service
will show. Also note that you could templatize on the display name and havexvfb@:99.service
instead. -
Stephen Ostermiller almost 9 yearsYour answer here superuser.com/a/912648/183672 gives the complete example without the hardcoded :99 that allows multiple screens to be started as a service.
-
mihaic about 7 yearsYou could also add
Restart=always
andRestartSec=3
under [Service] to make Xvfb restart in case it went down for some reason.