Skip to content

Media symlink-script tries to remove files from immutable volume #463

@joachimtingvold

Description

@joachimtingvold

Similar to #334, I was having problems upgrading to 11.0.19, and subsequently to 12.0.14. Getting the following error;

*** Running /etc/my_init.d/01_create_data_links.sh...
rm: cannot remove '/var/log': Directory not empty
*** Booting runit daemon...
*** Runit started as PID 20
*** Running /scripts/enterpoint.sh...
2025-08-08 21:30:14 Nginx ready
2025-08-08 21:30:14 This is an idle script (infinite loop) to keep container running.
[2025-08-08 21:30:14] Skip running setup-seafile-mysql.py because there is existing seafile-data folder.
[08/08/2025 21:30:14][upgrade]: The container was recreated, start fix the media symlinks
mv: not replacing '/shared/seafile/seahub-data/avatars/default-non-register.jpg'
mv: not replacing '/shared/seafile/seahub-data/avatars/default.png'
mv: not replacing '/shared/seafile/seahub-data/avatars/groups'
rm: cannot remove '/opt/seafile/seafile-pro-server-12.0.14/seahub/media/avatars': Directory not empty
Traceback (most recent call last):
  File "/scripts/start.py", line 94, in <module>
    main()
  File "/scripts/start.py", line 61, in main
    check_upgrade()
  File "/scripts/upgrade.py", line 120, in check_upgrade
    fix_media_symlinks()
  File "/scripts/upgrade.py", line 105, in fix_media_symlinks
    call('rm -rf %s' % avatars_dir)
  File "/scripts/utils.py", line 70, in call
    return subprocess.check_call(*a, **kw)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3.12/subprocess.py", line 413, in check_call
    raise CalledProcessError(retcode, cmd)
subprocess.CalledProcessError: Command 'rm -rf /opt/seafile/seafile-pro-server-12.0.14/seahub/media/avatars' returned non-zero exit status 1.

After looking at it, it seems this happened after I switched storage driver from fuse-overlayfs to overlay2 in Docker. I assume those volumes are immutable or something, which causes the logic to "remove" these folders to fail (since they're part of the immutable storage).

I could probably solve this by doing something along the lines below, but I feel thats a "hack". You should fix your "symlink script" to not attempt removing/altering things on the immutable storage.

services:
  seafile:
    […]
    volumes:
      - /foo/bar/baz:/opt/seafile/seafile-server-latest/seahub/media/avatars

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions