You are not logged in.

#1 2014-08-30 10:11:32

simonwjackson
Member
Registered: 2014-08-30
Posts: 3

[SOLVED] Issues with rTorrent and systemd

Hello all,

I am trying to run rTorrent as a service that will startup with the system, and restart if an error occurs.
I have followed the instructions here: https://wiki.archlinux.org/index.php/RT … _or_screen

I tried with both tmux and screen but i am getting similar errors on each:

systemctl start rt@$USER

Job for rt@root.service failed. See 'systemctl status rt@root.service' and 'journalctl -xn' for details.

systemctl status -l rt@root.service

* rt@root.service - rTorrent
   Loaded: loaded (/etc/systemd/system/rt@.service; enabled)
   Active: failed (Result: start-limit) since Sat 2014-08-30 12:03:49 CEST; 1min 43s ago
  Process: 2201 ExecStart=/usr/bin/tmux new-session -s rt -n rtorrent -d rtorrent (code=exited, status=1/FAILURE)

Aug 30 12:03:49 alarmpi systemd[1]: rt@root.service: control process exited, code=exited status=1
Aug 30 12:03:49 alarmpi systemd[1]: Failed to start rTorrent.
Aug 30 12:03:49 alarmpi systemd[1]: Unit rt@root.service entered failed state.
Aug 30 12:03:49 alarmpi tmux[2201]: duplicate session: rt
Aug 30 12:03:49 alarmpi systemd[1]: rt@root.service holdoff time over, scheduling restart.
Aug 30 12:03:49 alarmpi systemd[1]: Stopping rTorrent...
Aug 30 12:03:49 alarmpi systemd[1]: Starting rTorrent...
Aug 30 12:03:49 alarmpi systemd[1]: rt@root.service start request repeated too quickly, refusing to start.
Aug 30 12:03:49 alarmpi systemd[1]: Failed to start rTorrent.
Aug 30 12:03:49 alarmpi systemd[1]: Unit rt@root.service entered failed state.

journalctl -xn

-- Logs begin at Thu 1970-01-01 01:00:04 CET, end at Sat 2014-08-30 12:05:18 CEST. --
Aug 30 12:03:49 alarmpi systemd[1]: Stopping rTorrent...
-- Subject: Unit rt@root.service has begun shutting down
-- Defined-By: systemd
-- Support: http://lists.freedesktop.org/mailman/listinfo/systemd-devel
--
-- Unit rt@root.service has begun shutting down.
Aug 30 12:03:49 alarmpi systemd[1]: Starting rTorrent...
-- Subject: Unit rt@root.service has begun with start-up
-- Defined-By: systemd
-- Support: http://lists.freedesktop.org/mailman/listinfo/systemd-devel
--
-- Unit rt@root.service has begun starting up.
Aug 30 12:03:49 alarmpi systemd[1]: rt@root.service start request repeated too quickly, refusing to s
Aug 30 12:03:49 alarmpi systemd[1]: Failed to start rTorrent.
-- Subject: Unit rt@root.service has failed
-- Defined-By: systemd
-- Support: http://lists.freedesktop.org/mailman/listinfo/systemd-devel
--
-- Unit rt@root.service has failed.
--
-- The result is failed.
Aug 30 12:03:49 alarmpi systemd[1]: Unit rt@root.service entered failed state.
Aug 30 12:05:18 alarmpi systemd[1]: Job dev-disk-by\x2duuid-b028ec3e\x2dc99e\x2d4429\x2db399\x2da34ac
Aug 30 12:05:18 alarmpi systemd[1]: Timed out waiting for device dev-disk-by\x2duuid-b028ec3e\x2dc99e
-- Subject: Unit dev-disk-by\x2duuid-b028ec3e\x2dc99e\x2d4429\x2db399\x2da34accdb29fc.device has fail
-- Defined-By: systemd
-- Support: http://lists.freedesktop.org/mailman/listinfo/systemd-devel
--
-- Unit dev-disk-by\x2duuid-b028ec3e\x2dc99e\x2d4429\x2db399\x2da34accdb29fc.device has failed.
--
-- The result is timeout.
Aug 30 12:05:18 alarmpi systemd[1]: Dependency failed for /dev/disk/by-uuid/b028ec3e-c99e-4429-b399-a
-- Subject: Unit dev-disk-by\x2duuid-b028ec3e\x2dc99e\x2d4429\x2db399\x2da34accdb29fc.swap has failed
-- Defined-By: systemd
-- Support: http://lists.freedesktop.org/mailman/listinfo/systemd-devel
--
-- Unit dev-disk-by\x2duuid-b028ec3e\x2dc99e\x2d4429\x2db399\x2da34accdb29fc.swap has failed.
--
-- The result is dependency.

cat /etc/systemd/system/rt@.service

[Unit]
Description=rTorrent
Requires=network.target local-fs.target

[Service]
Type=forking
KillMode=none
User=%I
ExecStart=/usr/bin/tmux new-session -s rt -n rtorrent -d rtorrent
ExecStop=/usr/bin/tmux send-keys -t rt:rtorrent C-q
WorkingDirectory=/home/%I/
Restart=on-failure

[Install]
WantedBy=multi-user.target

Last edited by simonwjackson (2014-08-30 10:57:04)

Offline

#2 2014-08-30 10:17:24

jasonwryan
Anarchist
From: .nz
Registered: 2009-05-09
Posts: 30,424
Website

Re: [SOLVED] Issues with rTorrent and systemd

Is your user really called root, and does /home/root/ exist?


Arch + dwm   •   Mercurial repos  •   Surfraw

Registered Linux User #482438

Offline

#3 2014-08-30 10:59:37

simonwjackson
Member
Registered: 2014-08-30
Posts: 3

Re: [SOLVED] Issues with rTorrent and systemd

updating the user in the service file worked. Thanks!

/etc/systemd/system/rt@.service

[Unit]
Description=rTorrent
Requires=network.target local-fs.target

[Service]
Type=forking
KillMode=none
User=root
ExecStart=/usr/bin/tmux new-session -s rt -n rtorrent -d rtorrent
ExecStop=/usr/bin/tmux send-keys -t rt:rtorrent C-q
WorkingDirectory=/root/
Restart=on-failure

[Install]
WantedBy=multi-user.target

Offline

#4 2014-08-30 12:27:39

tomk
Forum Fellow
From: Ireland
Registered: 2004-07-21
Posts: 9,839

Re: [SOLVED] Issues with rTorrent and systemd

FYI running rtorrent as root is the height of madness.

Offline

#5 2014-11-17 14:14:58

jakub
Member
Registered: 2013-09-14
Posts: 151

Re: [SOLVED] Issues with rTorrent and systemd

I'm experiencing similar problem. But in my case I don't want to run it as root but as regular user.

journalctl

lis 17 14:36:04 t61 systemd[1]: rt@kuba.service holdoff time over, scheduling restart.
lis 17 14:36:04 t61 systemd[1]: Stopping rTorrent...
lis 17 14:36:04 t61 systemd[1]: Starting rTorrent...
lis 17 14:36:04 t61 systemd[1]: start request repeated too quickly for rt@kuba.service
lis 17 14:36:04 t61 systemd[1]: Failed to start rTorrent.
lis 17 14:36:04 t61 systemd[1]: Unit rt@kuba.service entered failed state.
lis 17 14:36:04 t61 systemd[1]: rt@kuba.service failed.

systemctl status rt@kuba

● rt@kuba.service - rTorrent
   Loaded: loaded (/etc/systemd/system/rt@.service; enabled)
   Active: failed (Result: start-limit) since pon 2014-11-17 14:40:42 CET; 27min ago
 Main PID: 1111 (code=exited, status=0/SUCCESS)

lis 17 14:40:42 t61 systemd[1]: Unit rt@kuba.service entered failed state.
lis 17 14:40:42 t61 systemd[1]: rt@kuba.service failed.
lis 17 14:40:42 t61 systemd[1]: rt@kuba.service holdoff time over, scheduling restart.
lis 17 14:40:42 t61 systemd[1]: Stopping rTorrent...
lis 17 14:40:42 t61 systemd[1]: Starting rTorrent...
lis 17 14:40:42 t61 systemd[1]: start request repeated too quickly for rt@kuba.service
lis 17 14:40:42 t61 systemd[1]: Failed to start rTorrent.
lis 17 14:40:42 t61 systemd[1]: Unit rt@kuba.service entered failed state.
lis 17 14:40:42 t61 systemd[1]: rt@kuba.service failed.

Update: my rt service started after restart. But anyway it would be good to know how to fix my configuration to avoid such problems in future.

Last edited by jakub (2014-11-17 14:25:05)

Offline

#6 2014-11-17 17:01:22

TheSaint
Member
From: my computer
Registered: 2007-08-19
Posts: 1,523

Re: [SOLVED] Issues with rTorrent and systemd

I think that the service should wait when the user has logged in.


do it good first, it will be faster than do it twice the saint wink

Offline

#7 2014-11-17 17:16:34

jakub
Member
Registered: 2013-09-14
Posts: 151

Re: [SOLVED] Issues with rTorrent and systemd

I'm not sure as I also couldn't start this service being already logged in. I had to restart my machine.

Offline

#8 2014-11-18 08:43:32

TheSaint
Member
From: my computer
Registered: 2007-08-19
Posts: 1,523

Re: [SOLVED] Issues with rTorrent and systemd

Rebooting was not that much necessary.

# systemctl daemon-reload

could suffice


do it good first, it will be faster than do it twice the saint wink

Offline

#9 2014-11-19 15:20:37

jakub
Member
Registered: 2013-09-14
Posts: 151

Re: [SOLVED] Issues with rTorrent and systemd

TheSaint wrote:

Rebooting was not that much necessary.

# systemctl daemon-reload

could suffice

Thx for the hint! Is should be useful as I still have some issues starting rTorrent - sometimes the service starts sometimes not. For me it shouldn't be marked as solved wink

Last edited by jakub (2014-11-19 15:31:17)

Offline

#10 2015-04-06 13:38:09

cngn
Member
Registered: 2010-03-20
Posts: 65

Re: [SOLVED] Issues with rTorrent and systemd

jakub wrote:

Thx for the hint! Is should be useful as I still have some issues starting rTorrent - sometimes the service starts sometimes not. For me it shouldn't be marked as solved wink

systemd does not have a way of knowing when the rtorrent process exits. systemd treats the service as stopped right after its ExecStop= exits, but rtorrent may need additional 3-5 seconds to shutdown. When the entire system shuts down in 2 seconds, then the rtorrent process is killed with rtorrent.lock file left on the filesystem. This will cause the rt.service to fail on the next boot.

Quick fix

journalctl -u rt@user
...
Apr 06 15:20:10 arch systemd[1]: Stopping rTorrent...
Apr 06 15:20:10 arch bash[12123]: rtorrent still running...
Apr 06 15:20:11 arch bash[12123]: rtorrent still running...
Apr 06 15:20:11 arch bash[12123]: rtorrent still running...
Apr 06 15:20:12 arch bash[12123]: rtorrent still running...
Apr 06 15:20:12 arch bash[12123]: rtorrent still running...
Apr 06 15:20:13 arch bash[12123]: rtorrent still running...
Apr 06 15:20:13 arch systemd[1]: Stopped rTorrent.
...

Last edited by cngn (2015-04-06 13:42:39)

Offline

Board footer

Powered by FluxBB