Syncthing not working (userdata-error?)

My DietPi is running a lot of stuff, mostly without any problems. So thanks a lot for this great piece of software!

Today I wanted to add Syncthing to my DietPi and got this error:

Configuring Syncthing: backup and sync server with web interface

11:09:43 WARNING: Failed to generate config and keys: mkdir /mnt/dietpi_userdata/syncthing: permission denied
sed: can't read /mnt/dietpi_userdata/syncthing/config.xml: No such file or directory
sed: can't read /mnt/dietpi_userdata/syncthing/config.xml: No such file or directory
sed: can't read /mnt/dietpi_userdata/syncthing/config.xml: No such file or directory

I moved dietpi_userdata to a harddrive after I booted dietpi for the first time (more than a year ago), so it should recognise that the directory was moved. But to me it looks like it didn’t, right? What can I do about this? I’m learning a lot about Linux but users and permissions are still beyond me. I’m lost.

Hi,

many thanks for your report. Which version of DietPi you are running? Pls can you post output of ls -ls /mnt/dietpi_userdata/

I’m running DietPi v6.32.2

insgesamt 16
0 drwxrwxr-x 1 komga     dietpi      0 Mai 17 09:41 comics
4 drwxrwxr-x 1 dietpi    dietpi   4096 Jul  6 12:08 downloads
0 drwxrwxr-x 1 komga     dietpi      0 Mai 17 09:41 ebooks
4 drwx------ 1 jellyfin  jellyfin 4096 Sep  1 22:10 jellyfin
4 drwxr-xr-x 1 komga     root     4096 Okt  2 16:24 komga
0 drwxrwxr-x 1 dietpi    dietpi      0 Sep  1 21:41 Music
0 drwxrwxr-x 1 dietpi    dietpi      0 Mai 17 09:39 Pictures
0 drwxr-xr-x 1 dietpi    dietpi      0 Aug 15 09:31 syncthing_data
4 drwxr-xr-x 1 ubooquity root     4096 Aug  3 18:38 ubooquity
0 drwxrwxr-x 1 dietpi    dietpi      0 Mai 17 09:39 Video

looks like /mnt/dietpi_userdata is not owned by user DietPi?? Could that be? That’s way Syncthing is not able to create the directory.

11:09:43 WARNING: Failed to generate config and keys: mkdir /mnt/dietpi_userdata/syncthing: permission denied

Anyway to have it fixed, you can created folder yourselves by running the following as user root:

mkdir /mnt/dietpi_userdata/syncthing
chown -R dietpi:dietpi /mnt/dietpi_userdata/syncthing*
systemctl restart syncthing

Ok, I did that and then reinstalled it with “dietpi-software reinstall 50”. No more error messages, but the web interface is still not working.

Might it still be a problem that the actual userdata is on a mounted drive?

I have two dietpi-userdata folder now, one in /mnt/ and one in mnt/123MYDRIVE123/. Both contain syncthing and syncthing_data subfolders.

dietpi-userdata should be a sym link to your HDD. Did you changed anything on this? Or how did you moved user data to you HDD

No, I didn’t do anything manually. Just pointing to a new drive by using dietpi-drive-manager after launching DietPi for the first time.

pls post entire output of following commands. Don’t cut anything on the output.

ls -la /mnt/
ls -la /mnt/123MYDRIVE123/
ls -la /mnt/123MYDRIVE123/dietpi_userdata/
ls -la /mnt/dietpi_userdata/
root@MediaPi:~# ls -la /mnt/
insgesamt 52
drwxr-xr-x 12 root root  4096 Sep 25 14:23 .
drwxr-xr-x 21 root root  4096 Jul  6 11:24 ..
drwxr-xr-x  2 root root  4096 Jun 28 10:26 10BE00F8BE00D7DC
drwxrwxrwx  1 root root 12288 Sep 12 12:12 14BEBE5BBEBE3558
drwxr-xr-x  2 root root  4096 Jul  9 11:19 16FA-2E47
drwxr-xr-x  2 root root  4096 Jun  4 19:20 7F2D-F959
drwxr-xr-x  2 root root     0 Feb 14  2019 9E5F-53C1
drwxr-xr-x  2 root root  4096 Aug 13 23:26 BackuPi
drwxr-xr-x  2 root root  4096 Jun 14 14:45 BD7D-4F18
lrwxrwxrwx  1 root root    37 Mai 18 13:09 dietpi_userdata -> /mnt/14BEBE5BBEBE3558/dietpi_userdata
drwxr-xr-x  2 root root  4096 Mai 15 23:25 E69271EA9271BF9B
drwxr-xr-x  2 root root  4096 Jan  7  2020 ftp_client
drwxr-xr-x  2 root root  4096 Jan  7  2020 nfs_client



root@MediaPi:~# ls -la /mnt/14BEBE5BBEBE3558/
insgesamt 464
drwxrwxrwx  1 root   root    12288 Sep 12 12:12  .
drwxr-xr-x 12 root   root     4096 Sep 25 14:23  ..
drwxrwxrwx  1 root   root        0 Aug 14 11:06 '$RECYCLE.BIN'
drwxrwxrwx  1 root   root     4096 Okt  5 04:03  Backups
drwxrwxrwx  1 root   root     4096 Mär  7  2020  Bücher
drwxrwxrwx  1 root   root     4096 Mai 18 10:43  Comics
drwxr-xr-x  1 root   root     4096 Okt  8 12:25  dietpi_userdata
-rwxrw-r--  1 dietpi dietpi   4096 Sep 12 12:12  ._.DS_Store
-rwxrw-r--  1 dietpi dietpi  10244 Sep 12 12:12  .DS_Store
drwxrwxrwx  1 root   root    69632 Okt  1 21:23  Filme
drwxrwxrwx  1 root   root   311296 Okt  7 14:10  Musik
drwxrwxrwx  1 root   root    32768 Sep 23  2018  Roms
drwxrwxrwx  1 root   root     4096 Feb 22  2016 'SRQ Backup'
drwxrwxrwx  1 root   root     4096 Okt  3 10:16  Serien
drwx------  1 root   root        0 Dez 31  2016 'System Volume Information'
drwxrwxrwx  1 root   root        0 Apr 18  2016  .Trashes
drwxrwxrwx  1 root   root     4096 Aug  2 21:36  Videos



root@MediaPi:~# ls -la /mnt/14BEBE5BBEBE3558/dietpi_userdata/
insgesamt 32
drwxr-xr-x 1 root      root      4096 Okt  8 12:25 .
drwxrwxrwx 1 root      root     12288 Sep 12 12:12 ..
drwxrwxr-x 1 komga     dietpi       0 Mai 17 09:41 comics
drwxrwxr-x 1 dietpi    dietpi    4096 Jul  6 12:08 downloads
drwxrwxr-x 1 komga     dietpi       0 Mai 17 09:41 ebooks
drwx------ 1 jellyfin  jellyfin  4096 Sep  1 22:10 jellyfin
drwxr-xr-x 1 komga     root      4096 Okt  2 16:24 komga
drwxrwxr-x 1 dietpi    dietpi       0 Sep  1 21:41 Music
drwxrwxr-x 1 dietpi    dietpi       0 Mai 17 09:39 Pictures
drwx------ 1 dietpi    dietpi       0 Okt  8 12:25 syncthing
drwxr-xr-x 1 dietpi    dietpi       0 Aug 15 09:31 syncthing_data
drwxr-xr-x 1 ubooquity root      4096 Aug  3 18:38 ubooquity
drwxrwxr-x 1 dietpi    dietpi       0 Mai 17 09:39 Video



root@MediaPi:~# ls -la /mnt/dietpi_userdata/
insgesamt 32
drwxr-xr-x 1 root      root      4096 Okt  8 12:25 .
drwxrwxrwx 1 root      root     12288 Sep 12 12:12 ..
drwxrwxr-x 1 komga     dietpi       0 Mai 17 09:41 comics
drwxrwxr-x 1 dietpi    dietpi    4096 Jul  6 12:08 downloads
drwxrwxr-x 1 komga     dietpi       0 Mai 17 09:41 ebooks
drwx------ 1 jellyfin  jellyfin  4096 Sep  1 22:10 jellyfin
drwxr-xr-x 1 komga     root      4096 Okt  2 16:24 komga
drwxrwxr-x 1 dietpi    dietpi       0 Sep  1 21:41 Music
drwxrwxr-x 1 dietpi    dietpi       0 Mai 17 09:39 Pictures
drwx------ 1 dietpi    dietpi       0 Okt  8 12:25 syncthing
drwxr-xr-x 1 dietpi    dietpi       0 Aug 15 09:31 syncthing_data
drwxr-xr-x 1 ubooquity root      4096 Aug  3 18:38 ubooquity
drwxrwxr-x 1 dietpi    dietpi       0 Mai 17 09:39 Video

As you can see on your first output, dietpi_userdata is pointing to your HDD 14BEBE5BBEBE3558

dietpi_userdata -> /mnt/14BEBE5BBEBE3558/dietpi_userdata

You don’t have 2 folder dietpi_userdata because it’s same.

pls restart your system and post output of systemctl status syncthing.service afterwards.

Thank you so much for trying to help me!

● syncthing.service - Syncthing (DietPi)
   Loaded: loaded (/etc/systemd/system/syncthing.service; disabled; vendor prese
t: enabled)
   Active: active (running) since Thu 2020-10-08 14:35:44 CEST; 1min
19s ago
 Main PID: 649 (syncthing)
    Tasks: 22 (limit: 1485)
   CGroup: /system.slice/syncthing.service
           ├─649 /opt/syncthing/syncthing -no-browser -no-restart -logflags=0 -h
ome=/mnt/dietpi_userdata/syncthing
           └─745 /opt/syncthing/syncthing -no-browser -no-restart -logflags=0 -h
ome=/mnt/dietpi_userdata/syncthing

Okt 08 14:35:51 MediaPi syncthing[649]: [7VQ4O] INFO: TCP listener ([::]:22000)
starting
Okt 08 14:35:51 MediaPi syncthing[649]: [7VQ4O] INFO: Relay listener (dynamic+ht
tps://relays.syncthing.net/endpoint) starting
Okt 08 14:35:51 MediaPi syncthing[649]: [7VQ4O] INFO: Completed initial scan of
sendreceive folder "Default Folder" (default)
Okt 08 14:35:52 MediaPi syncthing[649]: [7VQ4O] INFO: GUI and API listening on 1
27.0.0.1:8384
Okt 08 14:35:52 MediaPi syncthing[649]: [7VQ4O] INFO: Access the GUI via the fol
lowing URL: http://127.0.0.1:8384/
Okt 08 14:35:52 MediaPi syncthing[649]: [7VQ4O] INFO: My name is "MediaPi"
Okt 08 14:36:02 MediaPi syncthing[649]: [7VQ4O] INFO: Detected 4 NAT services
Okt 08 14:36:11 MediaPi syncthing[649]: [7VQ4O] INFO: quic://0.0.0.0:22000 detec
ted NAT type: Port restricted NAT
Okt 08 14:36:11 MediaPi syncthing[649]: [7VQ4O] INFO: quic://0.0.0.0:22000 resol
ved external address quic://93.135.20.201:63402 (via stun.syncthing.net:3478)
Okt 08 14:36:27 MediaPi syncthing[649]: [7VQ4O] INFO: Joined relay relay://195.2
19.166.59:443

ok looks like your Syncthing Gui is LISTEN on local internal interface only.

Okt 08 14:35:52 MediaPi syncthing[649]: [7VQ4O] INFO: GUI and API listening on 127.0.0.1:8384

let’s check configuration file

cat config.xml|grep address

cat: config.xml: Datei oder Verzeichnis nicht gefunden (“file or directory not found”)

Ah sorry my fault, should be following

cat /mnt/dietpi_userdata/syncthing/config.xml|grep address

PS: kein Problem, ich verstehe die Fehlermeldung :wink:

:smiley:

<address>dynamic</address>
<address>127.0.0.1:8384</address>

ok this should fix it

sed -i 's/127.0.0.1:8384/0.0.0.0:8384/g' /mnt/dietpi_userdata/syncthing/config.xml
systemctl restart syncthing.service

So sorry, but web ui stilll does not work. I keep getting page loading error.

ok let’s check if Syncthing is LISTEN on port 8384

lsof -i -P -n | grep LISTEN

might be lsof is not installed on your system. Just use apt install lsof if it’s missing

Doesn’t look like it:

dropbear  586      root    3u  IPv4  16513      0t0  TCP *:22 (LISTEN)
dropbear  586      root    4u  IPv6  16514      0t0  TCP *:22 (LISTEN)
smbd      652      root   29u  IPv6  16742      0t0  TCP *:445 (LISTEN)
smbd      652      root   30u  IPv6  16743      0t0  TCP *:139 (LISTEN)
smbd      652      root   31u  IPv4  16744      0t0  TCP *:445 (LISTEN)
smbd      652      root   32u  IPv4  16745      0t0  TCP *:139 (LISTEN)
java      660 ubooquity   44u  IPv6  16212      0t0  TCP *:2039 (LISTEN)
java      660 ubooquity   52u  IPv6  17130      0t0  TCP *:2038 (LISTEN)
jellyfin  667  jellyfin  280u  IPv6  16382      0t0  TCP *:8096 (LISTEN)
kodi.bin_ 752      root   28u  IPv4  18841      0t0  TCP 127.0.0.1:50067 (LISTEN)
kodi.bin_ 752      root   30u  IPv4  18802      0t0  TCP 127.0.0.1:52530 (LISTEN)
kodi.bin_ 752      root   34u  IPv4  18850      0t0  TCP 127.0.0.1:60113 (LISTEN)
kodi.bin_ 752      root   38u  IPv6  16197      0t0  TCP *:8080 (LISTEN)
kodi.bin_ 752      root   39u  IPv4  16198      0t0  TCP *:8080 (LISTEN)
kodi.bin_ 752      root   40u  IPv6  16204      0t0  TCP [::1]:9090 (LISTEN)
kodi.bin_ 752      root   42u  IPv4  16205      0t0  TCP 127.0.0.1:9090 (LISTEN)
kodi.bin_ 752      root   43u  IPv4  18852      0t0  TCP 127.0.0.1:44901 (LISTEN)