You are not logged in.

#1 2013-01-17 13:31:20

cr0cK
Member
Registered: 2013-01-17
Posts: 2

Can't start xscreensaver with systemd

Hi folks,

I just switched on systemd, everything is working well and as a test, I wanted to add xscreesaver daemon to systemd.
So i created a /usr/lib/systemd/system/xscreensaver.service file :

[Unit]
Description=XScreensaver daemon

[Service]
ExecStart=xscreensaver -nosplash

[Install]
WantedBy=multi-user.target

Then :

# sudo systemctl enable xscreensaver.service
ln -s '/usr/lib/systemd/system/xscreensaver.service' '/etc/systemd/system/multi-user.target.wants/xscreensaver.service'

# sudo systemctl daemon-reload

But something is wrong:

# sudo systemctl status xscreensaver.service
xscreensaver.service - XScreensaver daemon
	  Loaded: error (Reason: Invalid argument)
	  Active: inactive (dead)
	  CGroup: name=systemd:/system/xscreensaver.service

Also, trying to start the daemon myself does not work:

# sudo systemctl start screensaver.service
Failed to issue method call: Unit screensaver.service failed to load: No such file or directory. See system logs and 'systemctl status screensaver.service' for details.

And there is nothing about xscreensaver in journalctl.

Has I missed something?

Thx for your help.

Last edited by cr0cK (2013-01-17 23:53:58)

Offline

#2 2013-01-17 14:28:14

WorMzy
Administrator
From: Scotland
Registered: 2010-06-16
Posts: 12,411
Website

Re: Can't start xscreensaver with systemd

Why are you running your screensaver as a system daemon/service?

It should be run as your user, after X is started.


Sakura:-
Mobo: MSI MAG X570S TORPEDO MAX // Processor: AMD Ryzen 9 5950X @4.9GHz // GFX: AMD Radeon RX 5700 XT // RAM: 32GB (4x 8GB) Corsair DDR4 (@ 3000MHz) // Storage: 1x 3TB HDD, 6x 1TB SSD, 2x 120GB SSD, 1x 275GB M2 SSD

Making lemonade from lemons since 2015.

Offline

#3 2013-01-17 14:33:37

cr0cK
Member
Registered: 2013-01-17
Posts: 2

Re: Can't start xscreensaver with systemd

You're right but I thought this job could be handled by systemd. I'm wrong ?

Offline

#4 2013-01-17 14:47:41

WorMzy
Administrator
From: Scotland
Registered: 2010-06-16
Posts: 12,411
Website

Re: Can't start xscreensaver with systemd

You might be able to get it to run as a service if you run a systemd instance as your user.

https://wiki.archlinux.org/index.php/Systemd/User

Can't guarantee that it'll work as expected though.

You'd be better off starting it as the wiki recommends.

https://wiki.archlinux.org/index.php/Xs … creenSaver


Sakura:-
Mobo: MSI MAG X570S TORPEDO MAX // Processor: AMD Ryzen 9 5950X @4.9GHz // GFX: AMD Radeon RX 5700 XT // RAM: 32GB (4x 8GB) Corsair DDR4 (@ 3000MHz) // Storage: 1x 3TB HDD, 6x 1TB SSD, 2x 120GB SSD, 1x 275GB M2 SSD

Making lemonade from lemons since 2015.

Offline

#5 2013-01-17 16:11:14

chris_l
Member
Registered: 2010-12-01
Posts: 390

Re: Can't start xscreensaver with systemd

WorMzy wrote:

You might be able to get it to run as a service if you run a systemd instance as your user.

https://wiki.archlinux.org/index.php/Systemd/User

Can't guarantee that it'll work as expected though.

Well, I can guarantee you that it does, because I do it.
Here is my (really simple) systemd unit:

[Unit]
Description=XScreensaver

[Service]
ExecStart=/usr/bin/xscreensaver -no-splash

[Install]
WantedBy=default.target

Don't forget to follow the link WorMzy gave you, to use systemd user session; it wont work other way.

And btw, when you create personalized services files (ones created by you, instead of being provided by a package), you should not store them on /usr/lib/systemd/system, but on /etc/systemd/system instead. But user service files (like the one for xscreensaver) goes into $HOME/.config/systemd/user. Again read the link.

Last edited by chris_l (2013-01-17 16:14:52)


"open source is about choice"
No.
Open source is about opening the source code complying with this conditions, period. The ability to choose among several packages is just a nice side effect.

Offline

#6 2015-06-08 03:09:16

yugiohfan2011
Member
From: Waco, TX
Registered: 2010-12-18
Posts: 20
Website

Re: Can't start xscreensaver with systemd

I had a similar problem, although on a different Linux distro, but it works for me too.

Please don't forget to mark this as "solved" so that other users can learn from this.


Brandon Taylor

Offline

#7 2015-06-08 07:01:28

WorMzy
Administrator
From: Scotland
Registered: 2010-06-16
Posts: 12,411
Website

Re: Can't start xscreensaver with systemd

yugiohfan2011, please don't necrobump.

https://wiki.archlinux.org/index.php/Fo … bumping.22

Closing.


Sakura:-
Mobo: MSI MAG X570S TORPEDO MAX // Processor: AMD Ryzen 9 5950X @4.9GHz // GFX: AMD Radeon RX 5700 XT // RAM: 32GB (4x 8GB) Corsair DDR4 (@ 3000MHz) // Storage: 1x 3TB HDD, 6x 1TB SSD, 2x 120GB SSD, 1x 275GB M2 SSD

Making lemonade from lemons since 2015.

Offline

Board footer

Powered by FluxBB