Deluged Error when checking service status

General support for problems installing or using Deluge
Post Reply
zone4444
Member
Member
Posts: 16
Joined: Wed Aug 11, 2021 12:49 pm

Deluged Error when checking service status

Post by zone4444 »

Hello,

when I type: sudo systemctl status deluged.service
I get the following error(s):
Jan 14 17:37:21 ***********deluged[53808]: observer(event)
Jan 14 17:37:21 ***********deluged[53808]: File "/usr/lib/python3/dist-packages/twisted/logger/_legacy.py", line 93, in __call__
Jan 14 17:37:21 ***********deluged[53808]: self.legacyObserver(event)
Jan 14 17:37:21 ***********deluged[53808]: File "/usr/lib/python3/dist-packages/deluge/log.py", line 204, in emit
Jan 14 17:37:21 ***********deluged[53808]: getattr(LoggingLoggerClass, event_dict['log_level'].name)(
Jan 14 17:37:21 ***********deluged[53808]: File "/usr/lib/python3.8/logging/__init__.py", line 1493, in critical
Jan 14 17:37:21 ***********deluged[53808]: self._log(CRITICAL, msg, args, **kwargs)
Jan 14 17:37:21 ***********deluged[53808]: File "/usr/lib/python3.8/logging/__init__.py", line 1577, in _log
Jan 14 17:37:21 ***********deluged[53808]: fn, lno, func, sinfo = self.findCaller(stack_info, stacklevel)
Jan 14 17:37:21 ***********deluged[53808]: builtins.TypeError: findCaller() takes from 1 to 2 positional arguments but 3 were given
Also when I type: sudo systemctl status deluge-web.service
I get the following error(s):
Jan 14 17:40:59 ******** systemd[1]: Started Deluge Bittorrent Client Web Interface.
Jan 14 17:41:00 ******** deluge-web[53841]: Unable to initialize gettext/locale!
Jan 14 17:41:00 ******** deluge-web[53841]: 'ngettext'
Jan 14 17:41:00 ******** deluge-web[53841]: Traceback (most recent call last):
Jan 14 17:41:00 ******** deluge-web[53841]: File "/usr/lib/python3/dist-packages/deluge/i18n/util.py", line 118, in setup_translation
Jan 14 17:41:00 ******** deluge-web[53841]: builtins.__dict__['_n'] = builtins.__dict__['ngettext']
Jan 14 17:41:00 ******** deluge-web[53841]: KeyError: 'ngettext'
Any idea how to solve this please ?
mhertz
Moderator
Moderator
Posts: 1402
Joined: Wed Jan 22, 2014 5:05 am
Location: Denmark

Re: Deluged Error when checking service status

Post by mhertz »

Yes, upgrading deluge to 2.0.3+ fixes that. In mean time, if wanted, then i've posted this before to people:

Code: Select all

sudo find /usr -path *deluge/i18n/util.py -exec sed -i "s/names='ngettext'/names=['ngettext']/" {} \;
sudo find /usr -path *deluge/log.py -exec sudo sed -i 's/stack_info=False/*args, **kwargs/' {} \;
zone4444
Member
Member
Posts: 16
Joined: Wed Aug 11, 2021 12:49 pm

Re: Deluged Error when checking service status

Post by zone4444 »

Ok I executed the code above and when I try:

sudo systemctl start deluged.service I get:
Jan 14 18:43:40 ******** deluged[8866]: [Failure instance: Traceback: <class 'PermissionError'>: [Errno 13] Permission denied: '/home/deluge/.config/deluge/state/.safe_state_check'
Jan 14 18:43:40 ******** deluged[8866]: /usr/lib/python3/dist-packages/twisted/internet/base.py:1276:mainLoop
Jan 14 18:43:40 ******** deluged[8866]: /usr/lib/python3/dist-packages/twisted/internet/base.py:902:runUntilCurrent
Jan 14 18:43:40 ******** deluged[8866]: /usr/lib/python3/dist-packages/twisted/internet/defer.py:460:callback
Jan 14 18:43:40 ******** deluged[8866]: /usr/lib/python3/dist-packages/twisted/internet/defer.py:568:_startRunCallbacks
Jan 14 18:43:40 ******** deluged[8866]: --- <exception caught here> ---
Jan 14 18:43:40 ******** deluged[8866]: /usr/lib/python3/dist-packages/twisted/internet/defer.py:654:_runCallbacks
Jan 14 18:43:40 ******** deluged[8866]: /usr/lib/python3/dist-packages/twisted/internet/task.py:865:<lambda>
Jan 14 18:43:40 ******** deluged[8866]: /usr/lib/python3/dist-packages/deluge/core/torrentmanager.py:235:start
as for sudo systemctl start deluge-web.service I get:
Jan 14 18:43:40 ******** deluged[8866]: --- <exception caught here> ---
Jan 14 18:43:40 ******** deluged[8866]: /usr/lib/python3/dist-packages/twisted/internet/defer.py:654:_runCallbacks
Jan 14 18:43:40 ******** deluged[8866]: /usr/lib/python3/dist-packages/twisted/internet/task.py:865:<lambda>
Jan 14 18:43:40 ******** deluged[8866]: /usr/lib/python3/dist-packages/deluge/core/torrentmanager.py:235:start
Jan 14 18:43:40 ******** deluged[8866]: ]
Jan 14 18:47:20 ******** deluged[8866]: 18:47:20 [ERROR ][deluge.core.torrent :1293] Unable to save torrent file to: [Errno 13] Permission denied: '/home/deluge/.config/deluge/state/c1c5b61f7d829c3c9fe571b627cd68f8e1724368.torrent'
Jan 14 18:47:20 ******** deluged[8866]: 18:47:20 [ERROR ][deluge.core.torrentmanager :981 ] Unable to save torrents.state: [Errno 13] Permission denied: '/home/deluge/.config/deluge/state/torrents.state.tmp'
Jan 14 18:47:36 ******** deluged[8866]: 18:47:36 [ERROR ][deluge.core.torrent :1293] Unable to save torrent file to: [Errno 13] Permission denied: '/home/deluge/.config/deluge/state/d3b778ffc680075fa81a7dec870fed8f28158194.torrent'
Jan 14 18:47:36 ******** deluged[8866]: 18:47:36 [ERROR ][deluge.core.torrentmanager :981 ] Unable to save torrents.state: [Errno 13] Permission denied: '/home/deluge/.config/deluge/state/torrents.state.tmp'
Jan 14 18:47:37 ******** deluged[8866]: 18:47:37 [ERROR ][deluge.core.torrentmanager :1132] Unable to save torrents.fastresume: [Errno 13] Permission denied: '/home/deluge/.config/deluge/state/torrents.fastresume.tmp'
And when I restart the deluged service I lose all my listed torrents again.
mhertz
Moderator
Moderator
Posts: 1402
Joined: Wed Jan 22, 2014 5:05 am
Location: Denmark

Re: Deluged Error when checking service status

Post by mhertz »

Sorry, didn't noticed you had more issues than just the "regular" occurance of outdated deluge.

You have permission errors you need figure out. Your deluge user don't have write access to configured config-dir seemingly. How did you make the user and what's your systemd services looking? Honestly not the best at these things, but maybe others can jump in and help better.

Edit: 'systemctl cat deluged deluge-web'.
zone4444
Member
Member
Posts: 16
Joined: Wed Aug 11, 2021 12:49 pm

Re: Deluged Error when checking service status

Post by zone4444 »

No worries, appreciate any help I can get.

sudo nano /etc/systemd/system/deluged.service

Code: Select all

[Unit]
Description=Deluge Bittorrent Client Daemon
After=network-online.target

[Service]
Type=simple
User=deluge
Group=deluge
UMask=007
ExecStart=/usr/bin/deluged -d
Restart=on-failure

# Configures the time to wait before service is stopped forcefully.
TimeoutStopSec=60

[Install]
WantedBy=multi-user.target
sudo nano /etc/systemd/system/deluge-web.service

Code: Select all

[Unit]
Description=Deluge Bittorrent Client Web Interface
After=network-online.target

[Service]
Type=simple
User=deluge
Group=deluge
UMask=027
ExecStart=/usr/bin/deluge-web -d
Restart=on-failure
StartLimitBurst=2
StartLimitIntervalSec=150s

[Install]
WantedBy=multi-user.target
As for the deluged permissions error it seems it does have both read and write perms:
-rw-rw---- 1 deluge deluge ------ .safe_state_check
mhertz
Moderator
Moderator
Posts: 1402
Joined: Wed Jan 22, 2014 5:05 am
Location: Denmark

Re: Deluged Error when checking service status

Post by mhertz »

Ohh, they are almost vanilla then, I expected you had hardcoded another config dir or something, hence why I asked, as obviously file-permissions is on file-system.Can you test you have write access through e.g. 'sudo -u deluge chown /home/deluge/.config/deluge/test123'. Delete the file afterwards 'sudo rm /home/deluge/.config/deluge/test123
zone4444
Member
Member
Posts: 16
Joined: Wed Aug 11, 2021 12:49 pm

Re: Deluged Error when checking service status

Post by zone4444 »

Code: Select all

sudo -u deluge chown /home/deluge/.config/deluge/test123
chown: missing operand after ‘/home/deluge/.config/deluge/test123’
ofc because we haven't added the owner group:user, so I successfully tried

Code: Select all

sudo -u deluge touch /home/deluge/.config/deluge/test123
mhertz
Moderator
Moderator
Posts: 1402
Joined: Wed Jan 22, 2014 5:05 am
Location: Denmark

Re: Deluged Error when checking service status

Post by mhertz »

I'm an idiot, doh, thanks for fixing, indeed I meant touch and not chown, good catch :)

Probably wrong, but all I can think is that you have defined /home/deluge as home-dir for deluge - often in instructions it's /var/lib/deluge or /srv/deluge, where /var and /srv have traverse(execute) bit set, whereas /home doesn't, so I was thinking maybe that makes trouble, but just sounds strange when we don't have issues with our own users homedir, in same said parent-dir of /home - though I then thought maybe related to specifying deluge user as not having login. Anyway, probably way off(with 'chmod ogu+x /home'), but i'll do some quick tests in an ubuntu VM, if have time little later, and if find something i'll post back, but as said, honestly not the best at filepermissions and whatnot.

Edit: Hmm, my ubuntu VM had x traverse bit for all, on /home, but I cannot remember if messed with that myself during testing, as have diagnosed permission issues before for others here - on my real system, arch, there isn't such traverse bits set on /home, though is on /srv and /var, the usual suspects(normal used dirs, I mean). Anyway, probably off anyways, and as said, will post back if discovering something later - hope others can help you better - good luck :)
mhertz
Moderator
Moderator
Posts: 1402
Joined: Wed Jan 22, 2014 5:05 am
Location: Denmark

Re: Deluged Error when checking service status

Post by mhertz »

First, I made alot of mistakes/errors in this thread, and I sincerly apologize for that! Anyway, had little more time for debugging this now, and think I got it, and actually was related to that traverse bit not set. However, the notion of mine about /home folder missing such, was moronic at best, sorry. I don't know where that came from, but the issue I falsely remembered where my home-dir not having traverse bit, or write access of-course, for others than owner, neither read acces, but whatever, sorry again about that.

Now, I did some testing on an ubuntu VM, and by having the /home/deluge dir like you have i.e. with those perms, then will fail for deluged/deluge-web running propperly. Yes, the touch test worked, but cannot be used to test this apparently.

I could reproduce deluged breaking when traversing disabled on running users home-dir, here '/home/deluge', and fixed again after re-enabling it, so e.g. 'sudo chmod o+x /home/deluge', or 'og+x' etc.

Hope helps, and again sorry :)

Edit: The 'adduser' command will also btw add traverse bits upon the generated user-dir, so don't know how you ended up without, unless having made it manually previously, before the user-generation, or after if not having used '-d' switch.

Edit2: Regarding above, the man for useradd states only generating home-dir when not existing, if '-m' switch used, not even '-d'(/'--home') as i stated above - however the deluge docs doesn't specify this switch on listed example command-line, which I ran and just changed home-dir path to match yours(would be default anyway I see in hindsight, if no '-d'), so strange that dir generated regardless, but maybe man outdated(read online), and to lazy to retest in that VM now(and don't like "taint" real system). Not really important this, but just for completeness and to correct previous statement. Actually, not even a '--group' command(only in plural) , as used in deluge example, so must be outdated.
Post Reply