haiwen / seafile-docker

A Docker image for Seafile server
Other
536 stars 180 forks source link

[Bug]Seafile installation on NFS mounted drive("Invalid cross-device link") #380

Closed mjkent closed 3 months ago

mjkent commented 4 months ago

I am installing Seafile using the default docker compose.

I've mapped the MySQL container data to store on my host mounted NFS drive, as well as Seafile. MySQL starts up correctly(and all my other docker containers).

Here is the volume mapping:

  seafile:
    image: seafileltd/seafile-mc:latest
    container_name: seafile
    ports:
      - "8084:80"
#     - "443:443"  # If https is enabled, cancel the comment.
    volumes:
      - /mnt/media/seafile:/shared   # Requested, specifies the path to Seafile data persistent store.

SeaFile throws this error: https://github.com/haiwen/seafile-docker/blob/504639793b7b0626bc4ffbc8cf49537665cf038c/scripts/scripts_11.0/bootstrap.py#L222

seafile            | Traceback (most recent call last):
seafile            |   File "/usr/lib/python3.10/shutil.py", line 816, in move
seafile            |     os.rename(src, real_dst)
seafile            | OSError: [Errno 18] Invalid cross-device link: '/opt/seafile/conf' -> '/shared/seafile/conf'
seafile            |
seafile            | During handling of the above exception, another exception occurred:
seafile            |
seafile            | Traceback (most recent call last):
seafile            |   File "/scripts/start.py", line 95, in <module>
seafile            |     main()
seafile            |   File "/scripts/start.py", line 59, in main
seafile            |     init_seafile_server()
seafile            |   File "/scripts/bootstrap.py", line 222, in init_seafile_server
seafile            |     shutil.move(src, shared_seafiledir)
seafile            |   File "/usr/lib/python3.10/shutil.py", line 832, in move
seafile            |     copytree(src, real_dst, copy_function=copy_function,
seafile            |   File "/usr/lib/python3.10/shutil.py", line 559, in copytree
seafile            |     return _copytree(entries=entries, src=src, dst=dst, symlinks=symlinks,
seafile            |   File "/usr/lib/python3.10/shutil.py", line 513, in _copytree
seafile            |     raise Error(errors)
seafile            | shutil.Error: [('/opt/seafile/conf/ccnet.conf', '/shared/seafile/conf/ccnet.conf', "[Errno 1] Operation not permitted: '/shared/seafile/conf/ccnet.conf'"), ('/opt/seafile/conf/seafdav.conf', '/shared/seafile/conf/seafdav.conf', "[Errno 1] Operation not permitted: '/shared/seafile/conf/seafdav.conf'"), ('/opt/seafile/conf/gunicorn.conf.py', '/shared/seafile/conf/gunicorn.conf.py', "[Errno 1] Operation not permitted: '/shared/seafile/conf/gunicorn.conf.py'"), ('/opt/seafile/conf/seafevents.conf', '/shared/seafile/conf/seafevents.conf', "[Errno 1] Operation not permitted: '/shared/seafile/conf/seafevents.conf'"), ('/opt/seafile/conf/seafile.conf', '/shared/seafile/conf/seafile.conf', "[Errno 1] Operation not permitted: '/shared/seafile/conf/seafile.conf'"), ('/opt/seafile/conf/seahub_settings.py', '/shared/seafile/conf/seahub_settings.py', "[Errno 1] Operation not permitted: '/shared/seafile/conf/seahub_settings.py'"), ('/opt/seafile/conf', '/shared/seafile/conf', "[Errno 1] Operation not permitted: '/shared/seafile/conf'")]

Mount info(with some redaction):

overlay on / type overlay (rw,relatime,lowerdir=/var/lib/docker/overlay2/l/IH42HDFZD7ABCDE:/var/lib/docker/overlay2/l/V2Q3GABCDE:/var/lib/docker/overlay2/l/6DZ6VWGE7CP6FNABCDE:/var/lib/docker/overlay2/l/5VDXAABCDE:/var/lib/docker/overlay2/l/W4WP7TKLKZABCDE:/var/lib/docker/overlay2/l/IYNDSF5NBEHDBXPABCDE:/var/lib/docker/overlay2/l/QSQ2ARFPGL26KH5NABCDE:/var/lib/docker/overlay2/l/SLECJUXUWABCDE:/var/lib/docker/overlay2/l/DTV6BWVWXZABCDE:/var/lib/docker/overlay2/l/XSVE2LIGILKEABCDE:/var/lib/docker/overlay2/l/2SDZO5YH2ABCDE:/var/lib/docker/overlay2/l/CN624EOUNABCDE:/var/lib/docker/overlay2/l/3MFHEN5AHFABCDE:/var/lib/docker/overlay2/l/N45X6LFPCWRABCDE:/var/lib/docker/overlay2/l/6HQWRETLFABCDE:/var/lib/docker/overlay2/l/KNDM2TMYF7EABCDE:/var/lib/docker/overlay2/l/5T2J2Z4KXTO2XLPEX3PD4TUA2C,upperdir=/var/lib/docker/overlay2/3cc252864c6c347742e28fd33c89a75aa50d992f4b0d0baa47652a8df750fe69/diff,workdir=/var/lib/docker/overlay2/3cc252864c6c347742e28fd33c89a75aa50d992f4b0d0baa47652a8df750fe69/work,nouserxattr)
proc on /proc type proc (rw,nosuid,nodev,noexec,relatime)
tmpfs on /dev type tmpfs (rw,nosuid,size=65536k,mode=755,inode64)
devpts on /dev/pts type devpts (rw,nosuid,noexec,relatime,gid=5,mode=620,ptmxmode=666)
sysfs on /sys type sysfs (ro,nosuid,nodev,noexec,relatime)
cgroup on /sys/fs/cgroup type cgroup2 (ro,nosuid,nodev,noexec,relatime,nsdelegate,memory_recursiveprot)
mqueue on /dev/mqueue type mqueue (rw,nosuid,nodev,noexec,relatime)
shm on /dev/shm type tmpfs (rw,nosuid,nodev,noexec,relatime,size=65536k,inode64)
192.168.100.242:/mnt/data/media/seafile on /shared type nfs4 (rw,relatime,vers=4.2,rsize=1048576,wsize=1048576,namlen=255,hard,proto=tcp,timeo=600,retrans=2,sec=sys,clientaddr=10.10.100.240,local_lock=none,addr=10.10.100.242)
/dev/mapper/ubuntu--vg-ubuntu--lv on /etc/resolv.conf type ext4 (rw,relatime)
/dev/mapper/ubuntu--vg-ubuntu--lv on /etc/hostname type ext4 (rw,relatime)
/dev/mapper/ubuntu--vg-ubuntu--lv on /etc/hosts type ext4 (rw,relatime)
proc on /proc/bus type proc (ro,nosuid,nodev,noexec,relatime)
proc on /proc/fs type proc (ro,nosuid,nodev,noexec,relatime)
proc on /proc/irq type proc (ro,nosuid,nodev,noexec,relatime)
proc on /proc/sys type proc (ro,nosuid,nodev,noexec,relatime)
proc on /proc/sysrq-trigger type proc (ro,nosuid,nodev,noexec,relatime)
tmpfs on /proc/asound type tmpfs (ro,relatime,inode64)
tmpfs on /proc/acpi type tmpfs (ro,relatime,inode64)
tmpfs on /proc/kcore type tmpfs (rw,nosuid,size=65536k,mode=755,inode64)
tmpfs on /proc/keys type tmpfs (rw,nosuid,size=65536k,mode=755,inode64)
tmpfs on /proc/timer_list type tmpfs (rw,nosuid,size=65536k,mode=755,inode64)
tmpfs on /proc/scsi type tmpfs (ro,relatime,inode64)
tmpfs on /sys/firmware type tmpfs (ro,relatime,inode64)
SkywalkerSpace commented 3 months ago

Thanks for helping us resolve the issue. The reason is: os.rename only works if source and destination are on the same file system. So use mv instead of shutil.move (which contains os.rename).