How to Install and Autostart XScreenSaver on Ubuntu 18.04, Ubuntu 19.04

XScreensaver is a screen saver and locker for the X11 display server. Ubuntu ships with the gnome-screensaver, but it never worked out of the box. This tutorial shows you how to install XScreenSaver on Ubuntu 18.04/Ubuntu 19.04 and how to autostart it at boot time.

Install XScreenSaver on Ubuntu 18.04, Ubuntu 19.04

XScreensaver is included in Ubuntu software repository, so you can easily install it by running the following command in a terminal window.

sudo apt install xscreensaver

To check your XScreenSaver version, execute the following command:

xscreensaver --help

install xscreensaver on ubuntu 18.04 19.04

Now you can start XScreenSaver program from the Unity Dash or your preferred application launcher.

xscreensaver ubuntu

Upon first start, the program will ask you to start the XScreenSaver daemon. Click OK to start the daemon. By default, a randomly screensaver will be displayed after 10 minutes inactivity.

xscreensaver daemon ubuntu 18.04

How to Get XScreenSaver Autostart at boot time

Since Ubuntu comes with gnome-screensaver, which is a fork of XScreenSaver, we need to remove gnome-screensaver in order to autostart XScreenSaver at boot time.

sudo apt remove gnome-screensaver

Then open startup applications.

ubuntu startup applications

Add a new startup entry like below. Enter xscreensaver -nosplash in command field.

xscreensaver ubuntu autostart

Reboot your computer and XScreenSaver daemon should be automatically started when you login. If you open XScreenSaver program again, it won’t tell you to start the daemon because the daemon has already been started.

Autostart with Systemd service

Alternatively, you can get XScreenSaver autostart at boot time with Systemd, which is used by Ubuntu since 15.04 (Willy Werewolf).

First, execute the following command to create a directory for storing Systemd service file of individual users.

mkdir -p ~/.config/systemd/user/

Then create xscreensaver.service file with a command line text editor such as Nano

nano ~/.config/systemd/user/xscreensaver.service

Copy and paste the following text into the fie.

ExecStart=/usr/bin/xscreensaver -nosplash

To save the file in Nano text editor, press CTRL+ O, then press Enter to confirm. Press CTRL+X to exit. Finally, enable this service so that XScreenSaver will be automatically started at boot time.

systemctl --user enable xscreensaver

Wrapping Up

I hope this tutorial helpd you install and autostart XScreenSaver on Ubuntu 18.04 and Ubuntu 19.04 desktop. As always, if you found this post useful, then subscribe to our free newsletter to get more tips and tricks. Take care 🙂

Rate this tutorial
[Total: 0 Average: 0]

Leave a Comment

  • Comments with links are moderated by admin before published.
  • Your email address will not be published.
  • Use <pre> ... </pre> HTML tag to quote the output from your terminal/console.
  • Please use the community ( for questions unrelated to this article.
  • If you ask me more than 5 questions, I expect you to make a donation, or I would stop answering your questions.