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

After a migration, scans do not update file locations if the media location was changed #5692

Closed
Brent-Chiono opened this issue Feb 28, 2025 · 1 comment
Labels
bug report Bug reports that are not yet verified

Comments

@Brent-Chiono
Copy link

Brent-Chiono commented Feb 28, 2025

Describe the bug
When migrating and changing file structure the rename detection code is not properly updating the DB with the new location for each image and scene

To Reproduce
Steps to reproduce the behavior:

  1. Perform a migration starting with media in /home/myuser/stashMedia
  2. Copy the generated and blog folders to the new server
  3. Copy media in /home/myuser/stashMedia on the older server to media in /media/stash on the new server
  4. chmod -R 777 /media/stash
  5. chown -R stash:stash /media/stash
  6. Install stash pointing to the generated and blobs folders and pointing to your media in /media/stash
  7. Stop the stash service.
  8. Move the db from the old to the new server
  9. Start the stash service again
  10. Run a scan
  11. Go to a media file and click on file info. The path will still be the same as the old server

Server (please complete the following information):

  • OS: Ubuntu 24.04 fully updated
  • Browser: NA
  • Version: NA

When running a scan it takes runs for less than a second. I have added new media and when I scan the new media folder it works properly.

Here are some logs I see:

25-02-28 16:15:13
Info    
Scan finished (48.353324ms)
2025-02-28 16:15:13
Info    
Finished adding files to queue. 0 files queued
2025-02-28 16:15:13
Error   
error processing "/media/stash/etc/video/": detecting folder move: walking filesystem for folder rename detection: checking for parent folder "/home/myuser/stashd/thegoods/downloaded/video/": lstat /home/myuser/stashd/thegoods/downloaded/video/: permission denied

When trying to play a video file I get this tracelog:
Error: exit status 1
2025-02-28 16:31:32
Debug   
[transcode] returning DASH manifest for scene 9603
2025-02-28 16:31:32
Trace   
SQL [71.401µs]: SELECT `files`.`id` AS `file_id`, `files`.`basename`, `files`.`zip_file_id`, `files`.`parent_folder_id`, `files`.`size`, `files`.`mod_time`, `files`.`created_at` AS `file_created_at`, `files`.`updated_at` AS `file_updated_at`, `folders`.`path` AS `parent_folder_path`, `files_fingerprints`.`type` AS `fingerprint_type`, `files_fingerprints`.`fingerprint`, `zip_files`.`basename` AS `zip_basename`, `zip_files_folders`.`path` AS `zip_folder_path`, `zip_files`.`size` AS `zip_size`, `video_files`.`file_id` AS `file_id_video`, `video_files`.`format` AS `video_format`, `video_files`.`width` AS `video_width`, `video_files`.`height` AS `video_height`, `video_files`.`duration`, `video_files`.`video_codec`, `video_files`.`audio_codec`, `video_files`.`frame_rate`, `video_files`.`bit_rate`, `video_files`.`interactive`, `video_files`.`interactive_speed`, `image_files`.`format` AS `image_format`, `image_files`.`width` AS `image_width`, `image_files`.`height` AS `image_height` FROM `files` INNER JOIN `folders` ON (`files`.`parent_folder_id` = `folders`.`id`) LEFT JOIN `files_fingerprints` ON (`files`.`id` = `files_fingerprints`.`file_id`) LEFT JOIN `video_files` ON (`files`.`id` = `video_files`.`file_id`) LEFT JOIN `image_files` ON (`files`.`id` = `image_files`.`file_id`) LEFT JOIN `files` AS `zip_files` ON (`files`.`zip_file_id` = `zip_files`.`id`) LEFT JOIN `folders` AS `zip_files_folders` ON (`zip_files`.`parent_folder_id` = `zip_files_folders`.`id`) WHERE (`files`.`id` = 38952), args: []
2025-02-28 16:31:32
Trace   
SQL [144.582µs]: SELECT `scenes`.*, `scenes_files`.`file_id` AS `primary_file_id`, `folders`.`path` AS `primary_file_folder_path`, `files`.`basename` AS `primary_file_basename`, `fingerprint_md5`.`fingerprint` AS `primary_file_checksum`, `fingerprint_oshash`.`fingerprint` AS `primary_file_oshash` FROM `scenes` LEFT JOIN `scenes_files` ON ((`scenes_files`.`scene_id` = `scenes`.`id`) AND (`scenes_files`.`primary` = 1)) LEFT JOIN `files` ON (`files`.`id` = `scenes_files`.`file_id`) LEFT JOIN `folders` ON (`folders`.`id` = `files`.`parent_folder_id`) LEFT JOIN `files_fingerprints` AS `fingerprint_md5` ON ((`fingerprint_md5`.`file_id` = `scenes_files`.`file_id`) AND (`fingerprint_md5`.`type` = 'md5')) LEFT JOIN `files_fingerprints` AS `fingerprint_oshash` ON ((`fingerprint_oshash`.`file_id` = `scenes_files`.`file_id`) AND (`fingerprint_oshash`.`type` = 'oshash')) WHERE (`scenes`.`id` = 9603), args: []
2025-02-28 16:31:31
Warning 
[transcode] error generating DASH manifest: FFProbe encountered an error with </home/myuser/stashd/thegoods/downloaded/video/Abby Winters/im_noemivid1_HD1080.mp4>.
Error JSON:
{
    "error": {
        "code": -13,
        "string": "Permission denied"
    }
}

So it looks like it is prob getting a list of files from the db then it goes to check if those files exist and when it checks it is getting permission denied instead of path does not exist. Regardless, the scan should be scanning my library and attempting to insert everything in the DB... but noticing the file has already been scanned and it just needs to update it's path. I think thats how this is working.

I have installed the newest version of ffmpeg and ffprobe

Version
v0.27.2
Build hash:
76648fe
Build time:
2024-10-15 22:17:23

Latest Version
v0.27.2
Build hash:
76648fe
Release date:
2024-10-15

@Brent-Chiono Brent-Chiono added the bug report Bug reports that are not yet verified label Feb 28, 2025
@github-project-automation github-project-automation bot moved this to To triage in Bug fixing Feb 28, 2025
@Brent-Chiono Brent-Chiono changed the title [Bug Report] Short Form Subject (50 Chars or less) After a migration, scans do not update file locations if the media location was changed Feb 28, 2025
@WithoutPants
Copy link
Collaborator

User states that after starting from scratch they are unable to reproduce. I tried reproducing this myself by copying a directory to a new location and removing read permissions from the old path. The scan treated the lack of permissions as a not found error and correctly moved the folder. This is something to keep an eye on, but nothing to be done right now.

@WithoutPants WithoutPants closed this as not planned Won't fix, can't repro, duplicate, stale Mar 3, 2025
@github-project-automation github-project-automation bot moved this from To triage to Done in Bug fixing Mar 3, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug report Bug reports that are not yet verified
Projects
Status: Done
Development

No branches or pull requests

2 participants