This is very similar to this question but it did not receive any answers.

I'm migrating from Lubuntu 14.04 to 16.04 and have a simple upstart script I need to convert to systemd. It starts Chrome in OpenBox as was sourced from : Converting an existing Ubuntu Desktop into a Chrome kiosk

It creates an upstart script which starts an X11 session with kiosk.sh:

start on (filesystem and stopped udevtrigger)
stop on runlevel [06]

emits starting-x

exec sudo -u $USER startx /etc/X11/Xsession /opt/kiosk.sh --

kiosk.sh then does the following to launch openbox and chrome:


xset -dpms
xset s off
openbox-session &

while true; do
    rm -rf ~/.{config,cache}/google-chrome/
    google-chrome --kiosk --no-first-run  'http://thepcspy.com'

What would the best approach be to achieve the same using systemd?


You can keep the kiosk.sh. Systemd is able to execute shell scripts. Create a file called "chromestart.service" inside "/etc/systemd/system/" and enter this contents:

Description=Start of Google Chrome on startup

ExecStart=startx /etc/X11/Xsession /opt/kiosk.sh
Group=ENTER GROUPNAME HERE (usually the same as username)


After saving this file, run this command to enable the service on startup:

systemctl enable chromestart.service

Also recommended would be to set the correct permissions:

sudo chown root:root /etc/systemd/system/chromestart.service
sudo chmod 755 /etc/systemd/system/chromestart.service

Now reboot.

  • Don't forget to either reboot or enter systemctl start chromestart.service – CubeDev Dec 26 '16 at 7:51
  • @RoryO'Siochain The answer has been updated regarding the script getting executed now includes startx. Sudo isn't needed because the user and group can be set in SystemD. – CubeDev Dec 26 '16 at 13:17
  • 1
    Apologies for the delay. Have been very busy! It turns out that your answer is correct but that 16.04 doesn't come with startx installed. sudo apt-get install xinit, then create ~/.xinitrc with exec openbox-session on the first line of the file. I'll write up a clearer answer but keep yours as accepted because it answers the question asked. – Rory O'Siochain Feb 15 '17 at 14:20

Your Answer

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

Not the answer you're looking for? Browse other questions tagged or ask your own question.