Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Transmission files are in the wrong place following failed upgrade #103

Closed
MCMic opened this issue Sep 29, 2023 · 14 comments · Fixed by #107
Closed

Transmission files are in the wrong place following failed upgrade #103

MCMic opened this issue Sep 29, 2023 · 14 comments · Fixed by #107

Comments

@MCMic
Copy link

MCMic commented Sep 29, 2023

Describe the bug

I tried to upgrade but it failed (see logs below).

Now transmission has been restored but has all torrents as errors because of missing data.
/home/yunohost.transmission/completed/ exists but is empty
/home/yunohost.app/transmission/completed contains the data but I am not sure the rights are correct (I can only list it as root, not as my user, maybe that’s expected.
Links in /home/<user>/Multimedia/Share/torrent/completed points to /home/yunohost.transmission/completed

How can I fix the situation, run the upgrade and recover access to the files?

Context

  • Hardware: Old laptop or computer
  • YunoHost version: 11.2.4
  • I have access to my server: Through SSH

Logs

https://paste.yunohost.org/raw/mofeyucele (I removed usernames and replaced with ***)

@ericgaspar
Copy link
Member

ericgaspar commented Sep 29, 2023

Permissions for the /home/yunohost.app/transmission folder should look like this

drwxrwxr-x+  5 debian-transmission www-data            4096 Sep 27 14:01 .
drwxr-xr-x  14 root                root                4096 Sep 29 09:01 ..
drwxrwxr-x+  2 debian-transmission www-data            4096 Sep 27 14:01 completed
drwxrwxr-x+  2 debian-transmission debian-transmission 4096 Sep 27 14:01 progress
drwxrwxr-x+  2 debian-transmission debian-transmission 4096 Sep 27 14:01 watched

Can you share your permissions?

@MCMic
Copy link
Author

MCMic commented Sep 29, 2023

$ sudo ls -lah /home/yunohost.app/transmission
total 48K
drwxrw-r--+  5 debian-transmission www-data            4,0K 14 oct.   2022 .
drwxr-xr-x  11 root                root                4,0K 29 sept. 10:48 ..
drwxrw-r--+ 30 debian-transmission www-data             28K 23 juil. 12:53 completed
-rwxrw-r--+  1 debian-transmission www-data               0 14 oct.   2022 .nomedia
drwxrw-r--+  4 debian-transmission debian-transmission 4,0K 28 sept. 21:45 progress
drwxrwxr-x+  2 debian-transmission debian-transmission 4,0K 20 déc.   2017 watched

@kazukyakayashi
Copy link

Same here :(

I found this in the journalctl, I found this in the journalctl, the configuration / torrent path was changed with the update ?

Oct 01 09:25:16 transmission-daemon[3693346]: [2023-10-01 09:25:16.823] watchdir Failed to open directory "/home/yunohost.transmission/watched" (2): No such file or directory (watchdir.c:358)

@kazukyakayashi
Copy link

I found this in the update logs 🤔

2023-10-01 07:50:05,599: INFO - [#########++++.......] > Adding multimedia directories...
2023-10-01 07:50:05,600: DEBUG - + rm /home/yunohost.multimedia/share/Torrents
2023-10-01 07:50:05,600: DEBUG - + rm '/home/yunohost.multimedia/share/Torrent to download'
2023-10-01 07:50:05,601: DEBUG - + ynh_multimedia_build_main_dir
2023-10-01 07:50:05,601: DEBUG - + groupadd -f multimedia
2023-10-01 07:50:05,604: DEBUG - + mkdir -p /home/yunohost.multimedia
2023-10-01 07:50:05,606: DEBUG - + mkdir -p /home/yunohost.multimedia/share
2023-10-01 07:50:05,607: DEBUG - + mkdir -p /home/yunohost.multimedia/share/Music
2023-10-01 07:50:05,608: DEBUG - + mkdir -p /home/yunohost.multimedia/share/Picture
2023-10-01 07:50:05,609: DEBUG - + mkdir -p /home/yunohost.multimedia/share/Video
2023-10-01 07:50:05,611: DEBUG - + mkdir -p /home/yunohost.multimedia/share/eBook
2023-10-01 07:50:05,613: DEBUG - ++ yunohost user list --output-as json
2023-10-01 07:50:05,613: DEBUG - ++ jq -r '.users | keys[]'
2023-10-01 07:50:05,815: DEBUG - + for user in $(yunohost user list --output-as json | jq -r '.users | keys[]')
2023-10-01 07:50:05,815: DEBUG - + mkdir -p /home/yunohost.multimedia/kazukyakayashi
2023-10-01 07:50:05,816: DEBUG - + mkdir -p /home/yunohost.multimedia/kazukyakayashi/Music
2023-10-01 07:50:05,819: DEBUG - + mkdir -p /home/yunohost.multimedia/kazukyakayashi/Picture
2023-10-01 07:50:05,820: DEBUG - + mkdir -p /home/yunohost.multimedia/kazukyakayashi/Video
2023-10-01 07:50:05,822: DEBUG - + mkdir -p /home/yunohost.multimedia/kazukyakayashi/eBook
2023-10-01 07:50:05,823: DEBUG - + ln -sfn /home/yunohost.multimedia/share /home/yunohost.multimedia/kazukyakayashi/Share

@MCMic
Copy link
Author

MCMic commented Oct 1, 2023

I think the upgrade is supposed to move the folder /home/yunohost.transmission to /home/yunohost.app/transmission.

Because it failed it restored previous config that still expects stuff in the former while it was move to the latter, something like that.

I fixed the rights to match what you showed @ericgaspar , afterwards can I safely attempt the upgrade again? Is there a risk that it will erase what’s in /home/yunohost.app/transmission?

@nahoj
Copy link

nahoj commented Oct 2, 2023

Hi, I'm also having issues since the upgrade that moved /home/yunohost.transmission to /home/yunohost.app/transmission: whenever a torrent starts receiving data, it stops with:

Error: Permission denied (/home/yunohost.app/transmission/completed/<my torrent>

I tried changing permissions in various ways, then I reset them to what @ericgaspar said. I notice there are ACLs, could something be wrong with them?

$ getfacl completed/mytorrent
# file: completed/mytorrent
# owner: debian-transmission
# group: www-data
user::rwx
group::rwx
group:multimedia:rwx
mask::rwx
other::r-x
default:user::rwx
default:group::rwx
default:group:multimedia:rwx
default:mask::rwx
default:other::r-x

I checked that transmission-daemon is running as debian-transmission.

In the settings, I updated download-dir from /home/yunohost.transmission/completed to /home/yunohost.app/transmission/completed and incomplete-dir and watch-dir likewise, after stopping the daemon.

I also changed umask from 18 to 2 as suggested here: https://askubuntu.com/a/221096

Nothing worked. What can I do?

Fun fact: after the upgrade I had a folder /home/yunohost.app/focalboard with owner=group= transmission. I removed it as I had already uninstalled Focalboard a while ago.

@kazukyakayashi
Copy link

I don't understand anything at all ... I went to see the configuration file that was changed according to the log of the update and it does not correspond to the current configuration of folder paths, it's nonsense ...

2023-10-01 07:50:04,927: INFO - [######+++...........] > Updating a configuration file...
2023-10-01 07:50:04,927: DEBUG - + ynh_systemd_action --service_name=transmission-daemon --action=stop
2023-10-01 07:50:04,983: DEBUG - + service_name=transmission-daemon
2023-10-01 07:50:04,983: DEBUG - + action=stop
2023-10-01 07:50:04,984: DEBUG - + line_match=
2023-10-01 07:50:04,984: DEBUG - + length=20
2023-10-01 07:50:04,984: DEBUG - + log_path=/var/log/transmission-daemon/transmission-daemon.log
2023-10-01 07:50:04,984: DEBUG - + timeout=300
2023-10-01 07:50:04,984: DEBUG - + '[' stop == stop ']'
2023-10-01 07:50:04,984: DEBUG - + systemctl is-active --quiet transmission-daemon
2023-10-01 07:50:04,986: DEBUG - + return 0
2023-10-01 07:50:04,986: DEBUG - + '[' / '!=' / ']'
2023-10-01 07:50:04,987: DEBUG - + path_less=/
2023-10-01 07:50:04,987: DEBUG - + chmod 400 /etc/transmission-daemon/settings.json
2023-10-01 07:50:04,987: DEBUG - + chown debian-transmission:debian-transmission /etc/transmission-daemon/settings.json

But in the configuration file we find /home/yunohost.transmission/[...] and not /home/yunohost.app/transmission/[...]. Same if I go and look in the default base directory /var/lib/transmission-daemon/info/settings.json which is not used anyway as it looks for the one in /etc/...

So I updated the lines in /etc/transmission-daemon/settings.json by replacing yunohost.transmission/ with yunohost.app/transmission then I updated the paths of my torrents one by one by adding yunohost.app/transmission in the path of my torrents. It seems to work again for me.

@nahoj
Copy link

nahoj commented Oct 2, 2023

It seems I solved my problem by uninstalling and reinstalling Transmission, and deleting /home/yunohost.app/transmission in the meantime.

@ericgaspar
Copy link
Member

ah yes... settings.json was not regenerated during update 🙄

@stilobique
Copy link

Hi, the last update 3.00~ynh3 solved the download issue.
All previous donwload isn't functional, delete it from the list (data are always locally store) and re-download.

Thanks @ericgaspar !

@MCMic
Copy link
Author

MCMic commented Oct 6, 2023

The upgrade worked this time and transmission is starting. Torrents are not finding their data and using "Set Location" does not seem to work. Maybe I still have a rights problem.

Also, the symlink in /home/<user>/Multimedia/Share/torrent/ still points to the old location. I do not remember how those links are managed, there are commands to update them, no?

@MCMic
Copy link
Author

MCMic commented Oct 6, 2023

Oh, managed to fix existing torrents.
After Set Location, Do not use verify local data but resume directly and it works. Still a bit cumbersome to set location on each torrent but at least it works.

@MCMic
Copy link
Author

MCMic commented Oct 6, 2023

For those with the same location problem, I used this in the end:

for i in (transmission-remote http://127.0.0.1:9091/torrent/transmission/rpc -l|grep Stopped|cut -d"*" -f1|awk '{$1=$1};1')
    transmission-remote http://127.0.0.1:9091/torrent/transmission/rpc -t $i --find (transmission-remote http://127.0.0.1:9091/torrent/transmission/rpc -t $i -i|grep Location:|cut -d":" -f2|awk '{$1=$1};1'|sed -e 's@yunohost.transmission@yunohost.app/transmission@')
end

It’s a fish script ( https://fishshell.com/ ) so you’ll have to adapt it for bash.
After running the script you have to resume all torrents.

I still have the problem with the multimedia share folder, otherwise all is good.

@Salamandar
Copy link
Member

Should be fixed. Thanks @MCMic for the tricks.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
6 participants