linuxserver / docker-syncthing

GNU General Public License v3.0
293 stars 45 forks source link

Failed to create folder root directory mkdir /data1: read-only file system #80

Open panomitrius opened 1 month ago

panomitrius commented 1 month ago

Is there an existing issue for this?

Current Behavior

When adding a new synced folder to /data1/somepath - I get this error in Syncthing GUI:

Failed to create folder root directory mkdir /data1: read-only file system

Expected Behavior

That should work.

Steps To Reproduce

Setting up docker with default config and trying to sync a folder. creating files in /data1 from shell on docker container works fine, also as user abc.

Environment

- OS: Ubuntu 22.04.3 LTS
- How docker service was installed: package system

CPU architecture

x86-64

Docker creation

docker-compose 

version: "2.1"

volumes:
  syncthing.persistent:
    name: syncthing.persistent
    driver_opts:
      mountpoint: /media/bigdata/syncthing.persistent.image

services:
  syncthing:
    image: lscr.io/linuxserver/syncthing:latest
    container_name: syncthing
    hostname: flourish-syncthing
    environment:
      - PUID=1000
      - PGID=1000
      - TZ=Europe/Stockholm
    volumes:
      - './config:/config:rw'
      - type: volume
        source: syncthing.persistent
        target: /data1
    ports:
      - 8384:8384
      - 8106:8106/tcp
      - 8106:8106/udp
      - 21027:21027/udp
    restart: unless-stopped

Container logs

[migrations] started
[migrations] no migrations found
───────────────────────────────────────

      ██╗     ███████╗██╗ ██████╗
      ██║     ██╔════╝██║██╔═══██╗
      ██║     ███████╗██║██║   ██║
      ██║     ╚════██║██║██║   ██║
      ███████╗███████║██║╚██████╔╝
      ╚══════╝╚══════╝╚═╝ ╚═════╝

   Brought to you by linuxserver.io
───────────────────────────────────────

To support LSIO projects visit:
https://www.linuxserver.io/donate/

───────────────────────────────────────
GID/UID
───────────────────────────────────────

User UID:    1000
User GID:    1000
───────────────────────────────────────
Linuxserver.io version: v1.27.9-ls150
Build-date: 2024-07-13T01:49:21+00:00
───────────────────────────────────────

[custom-init] No custom files found, skipping...
[start] 2024/07/14 12:11:36 INFO: syncthing v1.27.9 "Gold Grasshopper" (go1.22.5 linux-amd64) root@buildkitsandbox 2024-07-13 01:50:26 UTC [noupgrade]
[ABHYS] 2024/07/14 12:11:36 INFO: My ID: ABHYSVV-ZTJMO22-BKOOKPT-LDE5IIQ-7NXFQ5V-AW4LRRY-JBN6IXF-MFFDXQG
[ABHYS] 2024/07/14 12:11:37 INFO: Single thread SHA256 performance is 307 MB/s using crypto/sha256 (305 MB/s using minio/sha256-simd).
[ABHYS] 2024/07/14 12:11:38 INFO: Hashing performance is 257.05 MB/s
[ABHYS] 2024/07/14 12:11:38 INFO: Overall send rate is unlimited, receive rate is unlimited
[ABHYS] 2024/07/14 12:11:38 INFO: Using discovery mechanism: IPv4 local broadcast discovery on port 21027
[ABHYS] 2024/07/14 12:11:38 INFO: Using discovery mechanism: IPv6 local multicast discovery on address [ff12::8384]:21027
[ABHYS] 2024/07/14 12:11:38 INFO: TCP listener ([::]:8106) starting
[ABHYS] 2024/07/14 12:11:38 INFO: Ready to synchronize "Seedvault" (1q9b0-iw3p9) (sendreceive)
[ABHYS] 2024/07/14 12:11:38 INFO: Ready to synchronize "Default Folder" (default) (sendreceive)
[ABHYS] 2024/07/14 12:11:38 INFO: GUI and API listening on [::]:8384
[ABHYS] 2024/07/14 12:11:38 INFO: Access the GUI via the following URL: http://127.0.0.1:8384/
[ABHYS] 2024/07/14 12:11:38 INFO: My name is "May You Flourish and Shine"
[ABHYS] 2024/07/14 12:11:38 INFO: Device ***** is "*****" at [dynamic]
[ABHYS] 2024/07/14 12:11:38 INFO: Device ***** is "*****" at [tcp://*****:22000]
*various folder messages, no errors*
Connection to localhost (127.0.0.1) 8384 port [tcp/*] succeeded!
[ls.io-init] done.
[ABHYS] 2024/07/14 12:11:38 INFO: Completed initial scan of sendreceive folder "Foton (telefonen)" (k2769-pl6fc)
[ABHYS] 2024/07/14 12:11:58 INFO: Detected 0 NAT services

*No error messages. When syncthing GUI gives the error message, nothing appears in docker logs.*
github-actions[bot] commented 1 month ago

Thanks for opening your first issue here! Be sure to follow the relevant issue templates, or risk having this issue marked as invalid.

Roxedus commented 1 month ago

Does user 1000 have permissions to write to /media/bigdata/syncthing.persistent.image? Error claims it doesn't.

panomitrius commented 1 month ago

Does user 1000 have permissions to write to /media/bigdata/syncthing.persistent.image? Error claims it doesn't.

Yea. I can create folders without any problem by sudo -u abc mkdir /data1/telefon-backups through the syncthing docker shell (after installing sudo in it).

I've also set permissions to (-R) 777 (to avoid any permissions issues) on /media/bigdata/syncthing.persistent.image

tdharris commented 1 month ago

I have a similar issue as well, it appears the container mounts the additional data volume(s) as container's root user and not the app user despite setting the puid and guid appropriately.. Works for me on another server so I'm not sure what it could be.. Though the working instance was created a long time ago and updated along the way while this problematic instance is new... Both are using the same image currently. I'm running docker as the same user that I have set puid and guid to in container env, host permission and ownership is appropriate. When shelled into the problematic container, I see ownership set to root for the mapped data volumes yet app's /config is a non-root user, abc:users . That explains the permission issue inside the container I would suspect. The older working container shows the data dir ownership within the container as abc user. For me, I do get an error from the log:

WARNING: Failed to create folder marker: mkdir /data/<redacted>/.stfolder: permission denied
...
INFO: Failed initial scan of sendreceive folder "<redacted>" (<redacted>)
WARNING: Error on folder "<redacted>" (<redacted>): folder marker missing (this indicates potential data loss, search docs/forum to get information about how to proceed)

results from shell within the container:

drwx------   4 abc  users 4.0K Jul 15 01:59 config
drwxrwxr-x   3 root root  4.0K Jul 14 23:38 data
panomitrius commented 1 month ago

Any ideas on this issue? All worked fine for me until recently when I wanted to sync a new folder. I haven't found a way to create new folders.

LinuxServer-CI commented 1 week ago

This issue has been automatically marked as stale because it has not had recent activity. This might be due to missing feedback from OP. It will be closed if no further activity occurs. Thank you for your contributions.