You are not logged in.

#1 2015-08-01 20:53:38

graysky
Wiki Maintainer
From: :wq
Registered: 2008-12-01
Posts: 10,734
Website

Cannot get systemd to trigger a user session

I created /home/facade/.config/systemd/user/test.service which is shown below.  I also enabled it via `systemctl --user enable test`.  I can run it manually via `systemctl --user start test` and it works fine, but it does not run automatically.  What am I missing?

[Unit]
Description=test
RequiresMountsFor=/home/

[Service]
ExecStart=/home/facade/bin/test

[Install]
WantedBy=default.target

Offline

#2 2015-08-01 20:59:19

karol
Archivist
Registered: 2009-05-06
Posts: 25,440

Re: Cannot get systemd to trigger a user session

Check the status and the logs / journal to see why isn't it starting on its own.
I have a /usr/lib/systemd/user/redshift.service and it works:

$ systemctl --user status redshift
● redshift.service - Redshift display colour temperature adjustment
   Loaded: loaded (/usr/lib/systemd/user/redshift.service; enabled; vendor preset: enabled)
   Active: active (running) since Fri 2015-07-24 13:07:16 CEST; 1 weeks 1 days ago

<snip>

Offline

#3 2015-08-02 10:05:46

graysky
Wiki Maintainer
From: :wq
Registered: 2008-12-01
Posts: 10,734
Website

Re: Cannot get systemd to trigger a user session

All I get is 'inactive (dead)'. for the status.

Offline

#4 2015-08-02 17:27:17

kar
Member
From: Berlin
Registered: 2013-01-30
Posts: 19

Re: Cannot get systemd to trigger a user session

I'm not sure, but maybe I have the same problem, but I can't start my service with `systemctl --user start test`.

I hope somebody can help us/me? Or it's better to open a new topic for my problem?

I'm trying to start akonadi automatic with this service-file:

[Unit]
Description=Start Akonadi

[Service]
ExecStart=/usr/bin/akonadictl start

[Install]
WantedBy=default.target 

The "akonadi.service" is in my home directory: "~/.config/systemd/user/"

If I enable the service, there is no problem, but after trying to start this one or after a reboot there is an error:

~ % systemctl --user status akonadi
● akonadi.service - Akonadi beim Login starten
   Loaded: loaded (/home/kar/.config/systemd/user/akonadi.service; enabled; vendor preset: enabled)
   Active: failed (Result: exit-code) since So 2015-08-02 18:31:11 CEST; 1min 33s ago
  Process: 1341 ExecStart=/usr/bin/akonadictl start (code=exited, status=255)
 Main PID: 1341 (code=exited, status=255)

Aug 02 18:31:08 myhost systemd[1337]: Started Akonadi beim Login starten.
Aug 02 18:31:11 myhost systemd[1337]: akonadi.service: Main process exited, code=exited, status=255/n/a
Aug 02 18:31:11 myhost systemd[1337]: akonadi.service: Unit entered failed state.
Aug 02 18:31:11 myhost systemd[1337]: akonadi.service: Failed with result 'exit-code'.

journalctl:

Aug 02 18:31:11 myhost systemd[1337]: akonadi.service: Main process exited, code=exited, status=255/n/a
Aug 02 18:31:11 myhost sddm[519]: Auth: sddm-helper exited successfully
Aug 02 18:31:11 myhost systemd[1337]: akonadi.service: Unit entered failed state.
Aug 02 18:31:11 myhost sddm[519]: Greeter stopped.
Aug 02 18:31:11 myhost systemd[1337]: akonadi.service: Failed with result 'exit-code'.
Aug 02 18:31:12 myhost akonadictl[1341]: D-Bus session bus is not available!
Aug 02 18:31:12 myhost akonadictl[1341]: "[
Aug 02 18:31:12 myhost akonadictl[1341]: 0: /usr/bin/akonadictl(_Z11akBacktracev+0x4a) [0x41962a]
Aug 02 18:31:12 myhost akonadictl[1341]: 1: /usr/bin/akonadictl() [0x4198e8]
Aug 02 18:31:12 myhost akonadictl[1341]: 2: /usr/lib/libc.so.6(+0x335b0) [0x7fa3de4215b0]
Aug 02 18:31:12 myhost akonadictl[1341]: 3: /usr/lib/libc.so.6(gsignal+0x38) [0x7fa3de421528]
Aug 02 18:31:12 myhost akonadictl[1341]: 4: /usr/lib/libc.so.6(abort+0x16a) [0x7fa3de42293a]
Aug 02 18:31:12 myhost akonadictl[1341]: 5: /usr/lib/libQtCore.so.4(_Z17qt_message_output9QtMsgTypePKc+0x8d) [0x7fa3df4e851d]
Aug 02 18:31:12 myhost akonadictl[1341]: 6: /usr/bin/akonadictl(_ZN15FileDebugStream9writeDataEPKcx+0xad) [0x41897d]
Aug 02 18:31:12 myhost akonadictl[1341]: 7: /usr/lib/libQtCore.so.4(_ZN9QIODevice5writeEPKcx+0xa7) [0x7fa3df58b157]
Aug 02 18:31:12 myhost akonadictl[1341]: 8: /usr/lib/libQtCore.so.4(+0x131ee6) [0x7fa3df598ee6]
Aug 02 18:31:12 myhost akonadictl[1341]: 9: /usr/lib/libQtCore.so.4(_ZN11QTextStreamD1Ev+0x31) [0x7fa3df5a2961]
Aug 02 18:31:12 myhost akonadictl[1341]: 10: /usr/bin/akonadictl(_ZN13AkApplication4initEv+0xe7) [0x411d17]
Aug 02 18:31:12 myhost akonadictl[1341]: 11: /usr/bin/akonadictl(main+0x9b) [0x40b58b]
Aug 02 18:31:12 myhost akonadictl[1341]: 12: /usr/lib/libc.so.6(__libc_start_main+0xf0) [0x7fa3de40e790]
Aug 02 18:31:12 myhost akonadictl[1341]: 13: /usr/bin/akonadictl(_start+0x29) [0x40e149]
Aug 02 18:31:12 myhost akonadictl[1341]: ]
Aug 02 18:31:12 myhost akonadictl[1341]: "

Offline

#5 2015-08-02 18:05:50

dcdriving
Member
From: United Kingdom
Registered: 2015-01-20
Posts: 70

Re: Cannot get systemd to trigger a user session

Surely the only issue can be the executable (/home/facade/bin/test) depending on a service which has not yet fully started?

I can make the original post work simply by replicating exactly what you have done with no problem and the service runs on boot.  The service runs a one line script which just touches a file to prove it executed and nothing more.  I tried this before as I had issues in the past with a similar problem related to trying to get netctl with a broadcom card to run after the system had fully booted up but it kept trying to run (and randomly failing) before the network was up as it activated when the network target was started, not completed.  I went round in circles for a while, exhausted google, gave up and installed wicd which worked every time.  (Restarting the netctl service after boot always worked.)

Offline

#6 2015-08-02 18:12:26

firecat53
Member
From: Lake Stevens, WA, USA
Registered: 2007-05-14
Posts: 1,542
Website

Re: Cannot get systemd to trigger a user session

@graysky - forgive me if I'm asking the obvious...but it might help others in troubleshooting as well smile

  1. Is the symlink actually present in /home/facade/.config/systemd/user/default.target.wants for test.service?
  2. Is the 'Type=' correct for the ~/bin/test executable (forking, simple, etc?)
  3. Have you tried it without the 'RequiresMountsFor' line? It's my understanding that a user unit cannot have dependencies on a system unit and vice versa. According to the man page, RequiresMountsFor adds dependencies for a mount unit for /home, which I believe would be a system unit. Thus a possible failure to launch during login?

Scott

Offline

#7 2015-08-13 07:42:57

graysky
Wiki Maintainer
From: :wq
Registered: 2008-12-01
Posts: 10,734
Website

Re: Cannot get systemd to trigger a user session

Starting a fresh thread with a real service to keep things clean and since my simple script example has been rolled into a cronjob: https://bbs.archlinux.org/viewtopic.php?pid=1552903

I suspect the same underlying problem is affect both my threads though.

Last edited by graysky (2015-08-13 07:43:54)

Offline

Board footer

Powered by FluxBB