Seahub is crashing (cannot remove avatars)


I’ve a problem with the restart of my seafile server. The Migration from an older version works, but with the following error:

migrating avatars …
rm: cannot remove ‘/opt/seafile/seafile-pro-server-9.0.16/seahub/media/avatars’: Directory not empty
ln: failed to create symbolic link ‘/opt/seafile/seafile-pro-server-9.0.16/seahub/media/avatars’: File exists

If i now restart the container, seahub is crashing.

[04/25/2023 08:45:36][upgrade]: The container was recreated, start fix the media symlinks
rm: cannot remove ‘/opt/seafile/seafile-pro-server-9.0.16/seahub/media/avatars’: Directory not empty
[2023-04-25 08:45:36] Skip running because there is existing seafile-data folder.
Traceback (most recent call last):
File “/scripts/”, line 95, in
File “/scripts/”, line 61, in main
File “/scripts/”, line 95, in check_upgrade
File “/scripts/”, line 80, in fix_media_symlinks
call(‘rm -rf %s’ % avatars_dir)
File “/scripts/”, line 70, in call
return subprocess.check_call(*a, **kw)
File “/usr/lib/python3.8/”, line 364, in check_call
raise CalledProcessError(retcode, cmd)
subprocess.CalledProcessError: Command ‘rm -rf /opt/seafile/seafile-pro-server-9.0.16/seahub/media/avatars’ returned non-zero exit status 1.

If i downgrade now to an older version, or upgrade, seahub is starting fine with the above error, but not when i normally restart the container. How can i fix this?

I have the same issue, but I wasn’t upgrading. I simply upgraded my MariaDB container for a minor version upgrade. I’m running Seafile Server 9.0.9 Community.