You are not logged in.
Hello, i am trying to create a service for slock, so it starts on wake.
$ pwd
/etc/systemd/system
$ cat slock.service
[Unit]
Description=slock on wake
After=sleep.target
[Service]
User=%I
ExecStart=/usr/bin/slock
[Install]
WantedBy=sleep.targetWhen enabled, the service starts on boot as expected. When i close the lid, the laptop goes to sleep as expected. On wake, no slock.
$ systemctl --failed
UNIT LOAD ACTIVE SUB DESCRIPTION
● slock.service loaded failed failed slock on wake
LOAD = Reflects whether the unit definition was properly loaded.
ACTIVE = The high-level unit activation state, i.e. generalization of SUB.
SUB = The low-level unit activation state, values depend on unit type.
1 loaded units listed. Pass --all to see loaded but inactive units, too.
To show all installed unit files use 'systemctl list-unit-files'.
$ systemctl status slock.service
● slock.service - slock on wake
Loaded: loaded (/etc/systemd/system/slock.service; enabled; vendor preset: disabled)
Active: failed (Result: core-dump) since Tue 2016-03-08 16:03:51 EST; 16s ago
Process: 4922 ExecStart=/usr/bin/slock (code=dumped, signal=SEGV)
Main PID: 4922 (code=dumped, signal=SEGV)
Mar 08 16:03:51 T420 systemd[1]: Started slock on wake.
Mar 08 16:03:51 T420 systemd[1]: slock.service: Main process exited, code=dumped, status=11/SEGV
Mar 08 16:03:51 T420 systemd[1]: slock.service: Unit entered failed state.
Mar 08 16:03:51 T420 systemd[1]: slock.service: Failed with result 'core-dump'.I get status 11/SEGV ??
I followed the note on the wiki page not to start slock before sleep.target
see here : https://wiki.archlinux.org/index.php/Po … leep_hooks
What am i doing wrong?
Thanks.
ThinkPad P16s AMD / KDE
Offline
What is %I in your service file?
"UNIX is simple and coherent" - Dennis Ritchie; "GNU's Not Unix" - Richard Stallman
Offline
What is %I in your service file?
I don't know. This was present in the example file, i have no clue what's its use. Many example uses %I and i can't find what it means.
I changed the line "User=%I" to "User=myuser" and the service still fails.
Thanks for helping, i really appreciate the efforts.
EDIT : This thread : https://bbs.archlinux.org/viewtopic.php?id=191838
also uses %I and somehow made it work but copying the exact same example even with %I and removing the "Type=forking" is not working as expected
Last edited by Quardah (2016-03-08 21:56:00)
ThinkPad P16s AMD / KDE
Offline
My question was meant to direct you to the documentation which would tell you exactly what the %I variable is for and where it comes from.
man systemd.unit
\%IThe first line will open the proper manual page. The second line typed while the man page is open will bring you to the exact line with the information you need. With this information, compare your service file's name and invocation with that in the examples you've drawn from.
"UNIX is simple and coherent" - Dennis Ritchie; "GNU's Not Unix" - Richard Stallman
Offline
My question was meant to direct you to the documentation which would tell you exactly what the %I variable is for and where it comes from.
man systemd.unit \%IThe first line will open the proper manual page. The second line typed while the man page is open will bring you to the exact line with the information you need. With this information, compare your service file's name and invocation with that in the examples you've drawn from.
Ok i understand.
Now i can launch the service (now labelled slock@myuser.service) but it does not work.
$ cat slock@.service
[Unit]
Description=slock on wake
After=suspend.target
[Service]
User=%I
ExecStart=/usr/bin/slock
[Install]
WantedBy=suspend.targetShould i change suspend for sleep? Or should i change "After" for "Before" (but the wiki says otherwise)?
Thanks.
ThinkPad P16s AMD / KDE
Offline
You're supposed to replace the '%I' with your user name.
So,
User=QuardahSee Trilbys post below.
Last edited by nyn (2016-03-09 19:35:25)
Offline
No nyn, you're supposed to read the manual page I referred to. You *could* replace the %I with your user name, and start it as whatever.service, but the examples properly use the %I and are started as whatever@username.service.
"UNIX is simple and coherent" - Dennis Ritchie; "GNU's Not Unix" - Richard Stallman
Offline