Failed to create folder marker on /mnt permission denied

Hi, I currently have a Pi with a dual nvme board with both disks mounted to /mnt, however, when creating a new Syncthing folder on /mnt/nvme1/syncthing I get the following error:

2025-03-29 08:19:32 My name is "pi5"
2025-03-29 08:19:38 No stored folder metadata for "zfrhu-nuzkp-2djjd2-f2j829fj"; recalculating
2025-03-29 08:19:38 Failed to create folder marker: mkdir /mnt/nvme1/syncthing/.stfolder: permission denied
2025-03-29 08:19:38 Ready to synchronize "syncpi" (zfrhu-nuzkp-2djjd2-f2j829fj) (sendreceive)
2025-03-29 08:19:38 Unpaused folder "syncpi" (zfrhu-nuzkp-2djjd2-f2j829fj) (sendreceive)
2025-03-29 08:19:38 Failed initial scan of sendreceive folder "syncpi" (zfrhu-nuzkp-2djjd2-f2j829fj)
2025-03-29 08:19:38 Error on folder "syncpi" (zfrhu-nuzkp-2djjd2-f2j829fj): folder marker missing (this indicates potential data loss, search docs/forum to get information about how to proceed)

Some extra details that’ll hopefully help solving this:

Output of ls -l /mnt/nvme1/syncthing:

total 0

Output of cat /etc/fstab:

/dev/nvme0n1p1	/mnt/nvme1	ext4	defaults,noatime	0	0
/dev/nvme1n1p1	/mnt/nvme2	ext4	defaults,noatime	0	0

Output of systemctl status syncthing:

Unit syncthing.service could not be found.

Output of systemctl --user status syncthing:

Ă— syncthing.service - Syncthing - Open Source Continuous File Synchronization
     Loaded: loaded (/usr/lib/systemd/user/syncthing.service; enabled; preset: enabled)
     Active: failed (Result: exit-code) since Sat 2025-03-29 08:09:20 GMT; 18min ago
   Duration: 20ms
       Docs: man:syncthing(1)
    Process: 1917 ExecStart=/usr/bin/syncthing serve --no-browser --no-restart --logflags=0 (code=exited, status=1/FAILURE)
   Main PID: 1917 (code=exited, status=1/FAILURE)
        CPU: 22ms

Mar 29 08:09:20 pi5 systemd[1503]: syncthing.service: Scheduled restart job, restart counter is at 4.
Mar 29 08:09:20 pi5 systemd[1503]: Stopped syncthing.service - Syncthing - Open Source Continuous File Synchronization.
Mar 29 08:09:20 pi5 systemd[1503]: syncthing.service: Start request repeated too quickly.
Mar 29 08:09:20 pi5 systemd[1503]: syncthing.service: Failed with result 'exit-code'.
Mar 29 08:09:20 pi5 systemd[1503]: Failed to start syncthing.service - Syncthing - Open Source Continuous File Synchronization.

Happy to fully purge the install and start from the beginning if that makes any recommended steps easier to apply. Thanks

A failure to create a folder marker almost always means that the user running the Syncthing process does not have the rights to create the folder in the directory. Reinstalling Syncthing won’t help.

What user owns the Syncthing process?

Output of ps -ef | grep syncthing:

pi          7606       1  0 08:19 ?        00:00:00 /usr/bin/syncthing serve --no-browser --no-restart --logflags=0
pi          7615    7606  0 08:19 ?        00:00:11 /usr/bin/syncthing serve --no-browser --no-restart --logflags=0
pi        114709  114677  0 12:22 pts/3    00:00:00 grep --color=auto syncthing

My suggestion would be to try this for troubleshooting (assuming your logged-in user can use sudo):

sudo su pi
touch /mnt/nvme1/syncthing/test.test
ls /mnt/nvme1/syncthing/test.test

Output for touch /mnt/nvme1/syncthing/test.test:

touch: cannot touch '/mnt/nvme1/syncthing/test.test': Permission denied

Output for ls /mnt/nvme1/syncthing/test.test:

ls: cannot access '/mnt/nvme1/syncthing/test.test': No such file or directory

Edit: Tried both commands above with sudo and got this result for sudo ls /mnt/nvme1/syncthing/test.test:

/mnt/nvme1/syncthing/test.test

This is the expected result if the user pi doesn’t have write access to that directory.

Could you please recommend a way to give it write access?

First, please try this:

ls -ld /mnt/nvme1/syncthing

This will show the directory’s owner and group that have access. You’ll want that information for whatever you decide to do next.

Here are some options:

  • To give every user on the system read/write access to that directory. I would not normally do that unless I was the only person who ever logged into the device, and I only did so securely. If you don’t have any security concerns with this, one way to do that is sudo chmod 755 /mnt/nvme1/syncthing/ – this changes the directory’s access rights to “the owner has full read, write and execute, the group members have read/write, and every other user has read/write.”
  • You can make the “pi” user a member of the group that has read/write access. That would look like sudo usermod -a -G "groupname" pi – be sure to replace “groupname” with the actual group shown by ls -ld /mnt/nvme1/syncthing. This will only work if the group has read and write access to the directory, of course.
  • You can make the “pi” user the owner of the directory. That would look like sudo chown pi /mnt/nvme1/syncthing.
  • You can run Syncthing as the user that owns that directory.

EDITED for clarity.

1 Like

I have been corrected on Option One!

For group members and other users to read/write: 766

But while it works fine on files, 766 on a directory isn’t enough for group members and other users to access the contents, so it needs to be 777 if read/write is required.

For read-only access to directory contents, 711 (drwx–x–x) on a directory is enough, but then group members and other users must know the exact path to a file because they cannot get a directory listing without read permissions.

I apologize for the error! And thanks to the forum member who PM’d me the correction!

EDITED: Corrected a small part of the correction.

2 Likes

This seems to have done it for me. Thanks a lot for the help! :smiley:

1 Like