2025-10-27 09:49:42: Failed to create folder root directory (folder.label=“Test it” folder.id=drbhr-auiwu folder.type=sendreceive error=“mkdir /home/markr: permission denied” log.pkg=model)
2025-10-27 09:49:42: Failed initial scan (error=“folder path missing” folder.label=“Test it” folder.id=drbhr-auiwu folder.type=sendreceive log.pkg=model)
Linux system running current version of Cinnamon . I receive this message when I try and create a shared folder. It reports the same error no matter which computer the share is originated. I opened up permissions completely and still receive the error. I have other instances running on a laptop that work fine. I have spent a day and a half working with it and don’t know where to turn. Any ideas would be welcomed.
Syncthing Troubleshooting Log - Moon System
Date: October 26, 2025 System: Linux Mint (Moon laptop) Issue: Failed to create folder root directory - “mkdir /home/markr: permission denied”
Problem Description
Syncthing consistently fails to sync folders with error:
Failed to create folder root directory (error="mkdir /home/markr: permission denied")
Failed initial scan (error="folder path missing")
Key Observation: Same configuration works perfectly on MooToo laptop, but fails on Moon.
Initial Investigation
1. Error Analysis
- Error shows Syncthing attempting to create
/home/markrinstead of the configured subdirectory - Multiple folder IDs tested:
yjup3-9gtde,6mwvn-myofx,9pvyr-sytv7,iztaj-rrniy,keyp6-wusra,dapy6-ovoo7,hjsxj-envqs,mo274-d2cc6 - Error persisted regardless of folder ID or configuration
2. Configuration Verification
- Config XML always showed correct paths (e.g.,
/home/markr/Documents,/home/markr/Sync) - API queries confirmed correct path configuration
- Web UI displayed correct paths
Troubleshooting Steps Attempted
1. Path Configuration Changes
Paths Tested:
/home/markr/Documents- Failed/home/markr/SyncDocuments- Failed/home/markr/Sync- Failed/home/markr/Documents/Sync- Failed/tmp/synctest- (Not fully tested)
Actions:
- Changed folder paths via config file edits
- Changed paths via API PATCH requests
- Changed paths via web UI
Result: All subdirectory paths under /home/markr triggered the same error
2. Syncthing Database Cleanup
Databases Removed:
rm -rf ~/syncthing/index-v0.14.0.db
rm -rf ~/syncthing/config/config/index-v2
rm -rf ~/.local/state/syncthing/index-v0.14.0.db
Result: Error persisted after database regeneration
3. Marker File Creation
Created .stfolder marker directories:
mkdir -p /home/markr/Documents/.stfolder
mkdir -p /home/markr/Documents/Sync
Result: No effect on error
4. Syncthing Version Changes
Original Version: v1.27.2-ds4 (Debian package)
- Suspected as buggy Debian-specific build
- Removed Debian package
Upgrade to Official Release:
sudo apt remove syncthing
sudo curl -L -o /etc/apt/keyrings/syncthing-archive-keyring.gpg https://syncthing.net/release-key.gpg
echo "deb [signed-by=/etc/apt/keyrings/syncthing-archive-keyring.gpg] https://apt.syncthing.net/ syncthing stable" | sudo tee /etc/apt/sources.list.d/syncthing.list
sudo apt update
sudo apt install syncthing
New Version: v1.30.0 (official)
Result: Same error persisted with official release
5. AppArmor Investigation
Discovery: Syncthing was running under docker-default AppArmor profile
sudo aa-status | grep syncthing
# Output: /usr/bin/syncthing (PID) docker-default
Attempted Fixes:
- Created systemd override to disable AppArmor:
mkdir -p ~/.config/systemd/user/syncthing.service.d/
cat > ~/.config/systemd/user/syncthing.service.d/override.conf << EOF
[Service]
AppArmorProfile=
EOF
- Reloaded systemd and restarted:
systemctl --user daemon-reload
systemctl --user restart syncthing
Verification:
cat /proc/$(pgrep -f "syncthing serve")/attr/current
# Output: unconfined
Result: AppArmor was successfully removed, but error persisted
6. Permissions Testing
Original Permissions:
ls -ld /home/markr
# drwxr-x--- (750)
Permission Change Test:
sudo chmod 755 /home/markr
Result: Error still occurred even with open permissions
Restored Original:
sudo chmod 750 /home/markr
7. Symlink Workaround Attempt
mv /home/markr/Documents /home/markr/Documents_real
ln -s Documents_real /home/markr/Documents
Result: No effect on error
Reverted:
rm /home/markr/Documents
mv /home/markr/Documents_real /home/markr/Documents
8. Complete Reinstallation
Steps:
- Stopped Syncthing service
- Removed all Syncthing data:
rm -rf ~/syncthing
rm -rf ~/.config/syncthing
rm -rf ~/.local/share/syncthing
rm -rf ~/.local/state/syncthing
- Reinstalled Syncthing package:
sudo apt reinstall syncthing
- Started fresh with new configuration
Result: Error persisted even with completely fresh installation
9. Binary Path Issues
Problem Discovered: /bin/syncthing phantom binary
- Process showed
/bin/syncthinginstead of/usr/bin/syncthing - Binary didn’t actually exist at that path
Resolution:
sudo apt reinstall syncthing
Result: Correct binary path restored, but error persisted
System Information
Permissions Verification
ls -ldn /home/markr
# drwxr-x--- 24 1000 1000 4096 Oct 26 07:54 /home/markr
id
# uid=1000(markr) gid=1000(markr) groups=1000(markr),4(adm),24(cdrom),27(sudo),30(dip),46(plugdev),100(users),105(lpadmin),125(sambashare),127(docker)
Filesystem Information
stat -f /home/markr
# Type: ext2/ext3 (ext4)
# Block size: 4096
Syncthing Process Information
ps -o user,uid,gid,cmd -p $(pgrep syncthing)
# USER: markr
# UID: 1000
# GID: 1000
# CMD: /usr/bin/syncthing serve --no-browser --no-restart
Configuration Files Examined
Config Locations
/home/markr/syncthing/config/config/config.xml~/.local/state/syncthing/config.xml
Sample Folder Configuration (from config.xml)
<folder id="keyp6-wusra" label="Linux Documents" path="/home/markr/Documents" type="sendreceive">
<device id="H5JGHX2-TUE4CVB-DEAERO5-7OSJBRV-4G6FMLZ-UQPX4U2-JUKEPRO-FFDKXAO">
<!-- NAS device -->
</device>
</folder>
API Verification
curl -s -H "X-API-Key: gsn2kRK45mvyKLaehr4Stbg9d66b3xda" http://localhost:8384/rest/config/folders | python3 -m json.tool
# Confirmed path: "/home/markr/Documents"
Key Findings
-
Configuration is Always Correct
- Config files show proper subdirectory paths
- API returns correct paths
- Web UI displays correct paths
-
Error Message is Misleading
- Syncthing reports trying to create
/home/markr - Should be creating subdirectory like
/home/markr/Documents - Appears to be path parsing bug
- Syncthing reports trying to create
-
Works on MooToo, Fails on Moon
- Identical configuration works on MooToo laptop
- Same Syncthing version
- Same folder structure
- Same NAS as source
-
Not Permission-Related
- Error persists with 755 permissions
- Syncthing runs as correct user (markr, uid 1000)
- Owner matches directory owner
-
Not AppArmor-Related
- Removed AppArmor restrictions
- Verified process runs unconfined
- Error still occurs
-
Not Version-Related
- Occurred with Debian package (v1.27.2-ds4)
- Occurred with official release (v1.30.0)
-
Not Database-Related
- Cleared databases multiple times
- Fresh databases show same issue
Attempted Workarounds That Failed
- Manual directory creation with .stfolder marker
- Symlink redirection
- Permission changes
- Different subdirectory names
- Nested vs single-level paths
- AppArmor profile removal
- Complete reinstallation
- Database deletion and regeneration
- API-based configuration changes
Working Configuration (MooToo)
- System: Linux Mint
- Syncthing Version: (Not specified, but same package source)
- Folder Path:
/home/markr/Documents - Status: Works perfectly with no errors
Theories for Root Cause
Theory 1: Syncthing Code Bug on Moon’s Environment
- Specific to Moon’s kernel version, libraries, or system configuration
- Path parsing fails for
/home/markr/*specifically - Bug triggered by environment variable or system setting unique to Moon
Theory 2: Filesystem State Issue
- Possible ext4 filesystem corruption or metadata issue
/home/markrdirectory has unusual extended attributes or ACLs- Inode or directory entry corruption
Theory 3: System Library Mismatch
- Go runtime library issue specific to Moon
- System call interception or modification
- Security module interfering at kernel level
Recommended Next Steps
Option 1: Test Alternative Root Path
Try syncing to location outside /home/markr:
mkdir -p /tmp/sync-test
Configure folder with path /tmp/sync-test
Expected Outcomes:
- If works: Issue is specific to
/home/markr - If fails with “mkdir /tmp: permission denied”: Syncthing is fundamentally broken
Option 2: File Bug Report
Report to Syncthing developers with:
- This troubleshooting log
- System information (
uname -a,lsb_release -a) - Syncthing logs (
journalctl --user -u syncthing -n 1000) - strace output showing actual syscalls
Option 3: Use MooToo Instead
- MooToo works perfectly with identical configuration
- No workaround needed
- Simpler solution
Option 4: Nuclear Option - OS Reinstall
If Syncthing is critical on Moon:
- Backup data
- Reinstall Linux Mint
- Test Syncthing before restoring data
Commands for Further Debugging
Enable Syncthing Debug Logging
systemctl --user stop syncthing
STTRACE=all /usr/bin/syncthing serve --no-browser > /tmp/syncthing-debug.log 2>&1 &
Capture System Call Trace
strace -f -o /tmp/syncthing-strace.log /usr/bin/syncthing serve --no-browser
Check for Filesystem Issues
sudo dmesg | grep -i error
sudo fsck -n /dev/sdX # Replace with actual device
Verify Extended Attributes
getfattr -d -m '.*' /home/markr
lsattr /home/markr
Timeline of Events
- Initial Error Discovery - Syncthing fails with “mkdir /home/markr: permission denied”
- Path Changes - Tested multiple paths, all failed
- Database Cleanup - Deleted and regenerated databases
- Version Upgrade - Switched from Debian package to official release
- AppArmor Discovery - Found docker-default profile restricting Syncthing
- AppArmor Removal - Disabled AppArmor for Syncthing
- Permission Testing - Changed /home/markr to 755, then reverted
- Complete Reinstall - Removed all Syncthing data and reinstalled
- Fresh Database - Started with completely clean database
- Error Persists - All attempts failed to resolve issue
Conclusion
After exhaustive troubleshooting, the issue remains unresolved. The error “mkdir /home/markr: permission denied” occurs despite:
- Correct configuration
- Proper permissions
- No AppArmor restrictions
- Multiple fresh installations
- Different paths and versions
The bug appears to be:
- Environment-specific to Moon laptop
- Related to path parsing in Syncthing code
- Not reproducible on MooToo with identical config
Recommendation: Use MooToo for syncing, or report bug to Syncthing developers with full system diagnostics.
Contact Information
- User: markr
- System: Moon (Linux Mint)
- Syncthing Version: v1.30.0
- Issue Date: October 26, 2025