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

Folder "logs" can not be created, if a symlink with same name exists. #1367

Closed
gitttt54 opened this issue Apr 7, 2023 · 7 comments
Closed
Assignees
Labels
bug Bug is with Plex Meta Manager

Comments

@gitttt54
Copy link

gitttt54 commented Apr 7, 2023

Version Number

1.18.3-nightly170 (Docker)

What branch are you on?

nightly

Describe the Bug

Coming from here: #1350

I'm not sure, this is really a bug, but -to be honest- I would like to have a nicer handling. So let me explain:

I'm trying to "move" the PMM logs folder to /tmp because they don't need to be permanent IMHO.

I stopped the container, deleted the old logs folder, created a symlink, restarted the container and started PMM:

root@UnRaid:~# docker exec -it pmm python plex_meta_manager.py --run -c config/config.yml --no-missing -is
Traceback (most recent call last):
  File "//plex_meta_manager.py", line 129, in <module>
    logger = MyLogger("Plex Meta Manager", default_dir, screen_width, divider[0], ignore_ghost, test or debug, trace)
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/modules/logs.py", line 53, in __init__
    os.makedirs(self.log_dir, exist_ok=True)
  File "<frozen os>", line 225, in makedirs
FileExistsError: [Errno 17] File exists: '/config/logs'

I guess, the message tells me, that PMM can not create its logs folder, because something (the symlink?) is in the way.

There is a workaround, to tell the docker container config to use that /tmp path directly, like -v '/tmp/pmm.logs/':'/config/logs':'rw' , and then create a symlink, say logs2 which points to /tmp/pmm.logs , but PMM still creates its own logs folder.
So there is an empty logs folder and the user needs to use the symlinked logs2.
Not exactly nice/transparent.

So my request would be:
Can we have the option to let PMM use the symlink instead of quitting with an error?

Thank you.

@gitttt54 gitttt54 added bug Bug is with Plex Meta Manager status:not-yet-viewed I haven't reviewed the Feature or Bug yet labels Apr 7, 2023
@chazlarson
Copy link
Contributor

chazlarson commented Apr 7, 2023

Is this only a problem when running in docker, or does the native run also show it? Is this perhaps a docker-specific thing unrelated to PMM?

@gitttt54
Copy link
Author

gitttt54 commented Apr 9, 2023

Is this only a problem when running in docker, or does the native run also show it? Is this perhaps a docker-specific thing unrelated to PMM?

I have no idea, but I would be happy to test this, IF I knew how...

(I only got PMM installed via the unraid "docker manager" and can't see how to run it native)

@gitttt54 gitttt54 changed the title Folder "logs" cat not be created, if a symlink with same name exists. Folder "logs" can not be created, if a symlink with same name exists. Aug 29, 2023
@meisnate12
Copy link
Member

@gitttt54 is this still an issue?

@gitttt54
Copy link
Author

gitttt54 commented Jan 8, 2024

@gitttt54 is this still an issue?

Unfortunately, yes, there is no difference since my initial post:

I just reproduced it via:

I stopped the container, deleted the old logs folder, created a symlink, restarted the container and started PMM:

Traceback (most recent call last):
  File "//plex_meta_manager.py", line 168, in <module>
    logger = MyLogger("Plex Meta Manager", default_dir, run_args["width"], run_args["divider"][0], run_args["ignore-ghost"],
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/modules/logs.py", line 54, in __init__
    os.makedirs(self.log_dir, exist_ok=True)
  File "<frozen os>", line 225, in makedirs
FileExistsError: [Errno 17] File exists: '/config/logs'

I reverted the changes (removed link and created a log folder) and it worked flawlessly.

@MrDynamo
Copy link

MrDynamo commented Feb 29, 2024

I noticed that you are using pmm.logs as the folder for symlink. Perhaps PMM is seeing the .logs and thinks it's a file rather than directory, causing the error?

Do you have any change in behavior if you use '/tmp/pmm/logs'?

@meisnate12
Copy link
Member

@gitttt54 can you test with the latest nightly i think i figured out a fix

@meisnate12 meisnate12 removed the status:not-yet-viewed I haven't reviewed the Feature or Bug yet label May 16, 2024
@gitttt54
Copy link
Author

gitttt54 commented May 16, 2024

@gitttt54 can you test with the latest nightly i think i figured out a fix

atm, I can‘t test. It‘ll take a month at least I think.
I‘ll reply again, when test is done.

EDIT: works great! thank you!

EDIT EDIT:

it runs smoothy, with this:

docker exec -it kometa python kometa.py -r -c /config/config_WL.yml

but not with this:
docker run --rm -v /mnt/user/appdata/kometa:/config --name kometa kometateam/kometa:latest python kometa.py --run -c /config/config_WL.yml

Traceback (most recent call last):
  File "//kometa.py", line 200, in <module>
    logger = MyLogger("Kometa", default_dir, run_args["width"], run_args["divider"][0], run_args["ignore-ghost"],
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/modules/logs.py", line 55, in __init__
    os.makedirs(self.log_dir, exist_ok=True)
  File "<frozen os>", line 225, in makedirs
FileExistsError: [Errno 17] File exists: '/config/logs'

Dunno, what the problem is here...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Bug is with Plex Meta Manager
Projects
None yet
Development

No branches or pull requests

4 participants