Open SmolPatches opened 6 months ago
I think I am having the same or a similar issue. Here is my error:
building Nix...
building the system configuration...
activating the configuration...
setting up /etc...
reloading user units for liam-server...
restarting sysinit-reactivation.target
warning: the following units failed: deluged.service
× deluged.service - Deluge BitTorrent Daemon
Loaded: loaded (/etc/systemd/system/deluged.service; enabled; preset: enabled)
Active: failed (Result: exit-code) since Wed 2024-06-19 18:10:42 AEST; 197ms ago
Duration: 1.205s
Process: 122177 ExecStartPre=/nix/store/lbfbbmvndvlsr7ylrpzmycmfvq0icnhi-unit-script-deluged-pre-start/bin/deluged-pre-start (code=exited, status=1/FAILURE)
IP: 0B in, 0B out
CPU: 4ms
Jun 19 18:10:42 nixos-server systemd[1]: Starting Deluge BitTorrent Daemon...
Jun 19 18:10:42 nixos-server deluged-pre-start[122178]: cp: cannot create regular file '/var/lib/deluge/.config/deluge/core.conf': Permission denied
Jun 19 18:10:42 nixos-server systemd[1]: deluged.service: Control process exited, code=exited, status=1/FAILURE
Jun 19 18:10:42 nixos-server systemd[1]: deluged.service: Failed with result 'exit-code'.
Jun 19 18:10:42 nixos-server systemd[1]: Failed to start Deluge BitTorrent Daemon.
warning: error(s) occurred while switching to the new configuration
And here is the relevant snippet of my configuration.nix:
# configure deluge
services.deluge = {
enable = true;
web.enable = true;
declarative = true; # applies config, openFirewall, authFile options
config = {
max_active_seeding = 100;
max_active_downloading = 100;
max_active_limit = 200;
};
authFile = "/run/keys/deluge-auth";
user = "liam-server";
};
It's important to note that I don't know what I'm doing -- I apologise if this is not a helpful contribution.
The Deluge documentation says
There should always be a 'localclient' entry for use by the UIs running locally by your user.
It seems that if the auth file does not contain a 'localclient' entry, deluge will attempt to add it, but since files created with builtins.toFile
are readonly, this fails. By manually adding the 'localclient' entry to the auth file, the deluge service works again.
authFile = let deluge_auth_file = (builtins.toFile "auth" ''
localclient:password321:10
nixxy:password123:5
''); in deluge_auth_file;
liamwb's issue seems to be a different one.
The Deluge documentation says
There should always be a 'localclient' entry for use by the UIs running locally by your user.
It seems that if the auth file does not contain a 'localclient' entry, deluge will attempt to add it, but since files created with
builtins.toFile
are readonly, this fails. By manually adding the 'localclient' entry to the auth file, the deluge service works again.authFile = let deluge_auth_file = (builtins.toFile "auth" '' localclient:password321:10 nixxy:password123:5 ''); in deluge_auth_file;
liamwb's issue seems to be a different one.
Thanks alot, your recommendation helped! Now the original issue is remedied, I now I have a similar issue to liamwb's where the service cannot write to /var/lib/deluge/.config cannot be written to due permission errors.
deluged.service - Deluge BitTorrent Daemon
Loaded: loaded (/etc/systemd/system/deluged.service; enabled; preset: enabled)
Active: active (running) since Wed 2024-07-03 22:42:22 EDT; 23h ago
Main PID: 1013 (..deluged-wrapp)
IP: 0B in, 0B out
IO: 32.1M read, 12.0K written
Tasks: 5 (limit: 17855)
Memory: 74.9M
CPU: 2min 25.395s
CGroup: /system.slice/deluged.service
└─1013 /nix/store/y0v7086iqc3gwir0vf67jwy31aqk3zpx-python3-3.11.8/bin/python3.11 /nix/store/bazg52ja240d6psfx19y0hdpr7rj3g07->
Jul 03 22:42:23 homelab deluged[1013]: current.result = callback( # type: ignore[misc]
Jul 03 22:42:23 homelab deluged[1013]: File "/nix/store/czds2hrgxh9x3m9p1r4yzp1f5zzhpsi1-python3.11-twisted-23.8.0/lib/python3.11/site-p>
Jul 03 22:42:23 homelab deluged[1013]: return callable(*args, **kw)
Jul 03 22:42:23 homelab deluged[1013]: File "/nix/store/bazg52ja240d6psfx19y0hdpr7rj3g07-python3.11-deluge-gtk-2.1.1/lib/python3.11/site>
Jul 03 22:42:23 homelab deluged[1013]: self.__load_auth_file()
Jul 03 22:42:23 homelab deluged[1013]: File "/nix/store/bazg52ja240d6psfx19y0hdpr7rj3g07-python3.11-deluge-gtk-2.1.1/lib/python3.11/site>
Jul 03 22:42:23 homelab deluged[1013]: create_localclient_account(True)
Jul 03 22:42:23 homelab deluged[1013]: File "/nix/store/bazg52ja240d6psfx19y0hdpr7rj3g07-python3.11-deluge-gtk-2.1.1/lib/python3.11/site>
Jul 03 22:42:23 homelab deluged[1013]: with open(auth_file, 'a' if append else 'w', encoding='utf8') as _file:
Jul 03 22:42:23 homelab deluged[1013]: builtins.OSError: [Errno 30] Read-only file system: '/var/lib/deluge/.config/deluge/auth'
To fix it, I created a folder /home/deluge
and set this in configuration.nix
, deluge.dataDir = "/home/deluge"
. After that everything worked. Let me know @liamwb if this helps you too.
Describe the bug
services.deluge fails to create a working systemd service for delugeweb and deluged while nixos-rebuild succeeds.
Steps To Reproduce
Steps to reproduce the behavior:
nixos-rebuild switch
Expected behavior
Given a proper nixos configuration, a running systemd service that actively listens for incoming connections to the main daemon and the webui was expected. Rebuilds completed successfully yet the systemd services continue to fail.
Screenshots
journalctl -u deluged
journalctl -u delugeweb
systemctl status deluge
systemctl status delugeweb
Additional context
configuration.nix
Note:
Metadata
Please run
nix-shell -p nix-info --run "nix-info -m"
and paste the result.Add a :+1: reaction to issues you find important.