Crash when unmounting SD card

Hi, I’m running latest Syncthing-fork v1.19.0.0 and having a issue:

so far I’ve always had an SD card mounted on my phone (so when I installed Syncthing I had it it mounted as well). Today I decided to reject the SD card and after that I got a crash in Syncthing, here are some logs:

21:14:43I/Util     runShellCommandGetOutput: Exited with code 0
21:14:43I/Util     runShellCommandGetOutput: Exited with code 0
21:15:12 [6LHZQ] INFO: Joined relay relay://163.172.167.217:22067
21:15:33I/Util     runShellCommandGetOutput: Exited with code 0
21:15:33I/Util     runShellCommandGetOutput: Exited with code 0
21:15:36I/Util     runShellCommandGetOutput: Exited with code 0
21:16:51I/Util     runShellCommandGetOutput: Exited with code 0
21:20:11I/SyncthingService onServiceStateChange: from ACTIVE to INIT
21:20:11I/Util     runShellCommandGetOutput: Exited with code 0
21:20:11 [6LHZQ] INFO: Relay listener (dynamic+https://relays.syncthing.net/endpoint) shutting down
21:20:11W/SyncthingRunnable Failed to read Syncthing's command line output
21:20:11W/SyncthingRunnable java.io.FileNotFoundException: /storage/0583-EF61/Android/data/com.github.catfriend1.syncthingandroid/files/syncthing.log: open failed: ENOENT (No such file or directory)
21:20:11W/SyncthingRunnable 	at libcore.io.IoBridge.open(IoBridge.java:492)
21:20:11W/SyncthingRunnable 	at java.io.FileOutputStream.<init>(FileOutputStream.java:236)
21:20:11W/SyncthingRunnable 	at com.google.common.io.Files$FileByteSink.openStream(Files.java:193)
21:20:11W/SyncthingRunnable 	at com.google.common.io.Files$FileByteSink.openStream(Files.java:181)
21:20:11W/SyncthingRunnable 	at com.google.common.io.ByteSink$AsCharSink.openStream(ByteSink.java:149)
21:20:11W/SyncthingRunnable 	at com.google.common.io.CharSink.write(CharSink.java:94)
21:20:11W/SyncthingRunnable 	at com.google.common.io.Files.append(Files.java:362)
21:20:11W/SyncthingRunnable 	at com.nutomic.syncthingandroid.service.SyncthingRunnable.lambda$log$0$SyncthingRunnable(SyncthingRunnable.java:426)
21:20:11W/SyncthingRunnable 	at com.nutomic.syncthingandroid.service.SyncthingRunnable$$ExternalSyntheticLambda0.run(Unknown Source:8)
21:20:11W/SyncthingRunnable 	at java.lang.Thread.run(Thread.java:923)
21:20:11W/SyncthingRunnable Caused by: android.system.ErrnoException: open failed: ENOENT (No such file or directory)
21:20:11W/SyncthingRunnable 	at libcore.io.Linux.open(Native Method)
21:20:11W/SyncthingRunnable 	at libcore.io.ForwardingOs.open(ForwardingOs.java:166)
21:20:11W/SyncthingRunnable 	at libcore.io.BlockGuardOs.open(BlockGuardOs.java:254)
21:20:11W/SyncthingRunnable 	at libcore.io.ForwardingOs.open(ForwardingOs.java:166)
21:20:11W/SyncthingRunnable 	at android.app.ActivityThread$AndroidOs.open(ActivityThread.java:7551)
21:20:11W/SyncthingRunnable 	at libcore.io.IoBridge.open(IoBridge.java:478)
21:20:11W/SyncthingRunnable 	... 9 more
21:20:11I/Util     runShellCommandGetOutput: Exited with code 0
21:20:11I/Util     runShellCommandGetOutput: Exited with code 0
21:20:11I/Util     runShellCommandGetOutput: Exited with code 0
21:20:11I/Util     runShellCommandGetOutput: Exited with code 0
21:20:11I/Util     runShellCommandGetOutput: Exited with code 0
21:20:11W/SyncthingRunnable Syncthing exited unexpectedly. Exit code = 141
21:20:11I/Util     runShellCommandGetOutput: Exited with code 0
21:20:11I/Util     runShellCommandGetOutput: Exited with code 0
21:20:11I/SyncthingService onServiceStateChange: from INIT to STARTING
21:20:11I/SyncthingService Web GUI will be available at https://127.0.0.1:8384
21:20:11W/ContextImpl Failed to ensure /storage/0583-EF61/Android/data/com.github.catfriend1.syncthingandroid/files: android.os.ServiceSpecificException:  (code -22)
21:20:11W/ContextImpl Failed to ensure /storage/0583-EF61/Android/data/com.github.catfriend1.syncthingandroid/files: android.os.ServiceSpecificException:  (code -22)
21:20:11W/FileUtils Could not determine app's private files directory on external storage.
21:20:11I/Util     runShellCommandGetOutput: Exited with code 0
21:20:11I/PollWebGuiAvailableTask Starting to poll for web gui availability
21:20:11I/SyncthingService onServiceStateChange: from ERROR to DISABLED
21:20:11W/ContextImpl Failed to ensure /storage/0583-EF61/Android/data/com.github.catfriend1.syncthingandroid/files: android.os.ServiceSpecificException:  (code -22)
21:20:11I/Util     runShellCommandGetOutput: Exited with code 0
21:20:11W/ContextImpl Failed to ensure /storage/0583-EF61/Android/data/com.github.catfriend1.syncthingandroid/files: android.os.ServiceSpecificException:  (code -22)
21:20:11W/FileUtils Could not determine app's private files directory on external storage.
21:20:11 [start] INFO: syncthing v1.19.0 "Fermium Flea" (go1.17.1 android-arm64) vagrant@basebox-stretch64 2022-01-24 03:45:54 UTC [noupgrade, stnoupgrade]
21:20:11W/SyncthingRunnable Failed to read Syncthing's command line output
21:20:11W/SyncthingRunnable java.io.FileNotFoundException: syncthing.log: open failed: EROFS (Read-only file system)
21:20:11W/SyncthingRunnable 	at libcore.io.IoBridge.open(IoBridge.java:492)
21:20:11W/SyncthingRunnable 	at java.io.FileOutputStream.<init>(FileOutputStream.java:236)
21:20:11W/SyncthingRunnable 	at com.google.common.io.Files$FileByteSink.openStream(Files.java:193)
21:20:11W/SyncthingRunnable 	at com.google.common.io.Files$FileByteSink.openStream(Files.java:181)
21:20:11W/SyncthingRunnable 	at com.google.common.io.ByteSink$AsCharSink.openStream(ByteSink.java:149)
21:20:11W/SyncthingRunnable 	at com.google.common.io.CharSink.write(CharSink.java:94)
21:20:11W/SyncthingRunnable 	at com.google.common.io.Files.append(Files.java:362)
21:20:11W/SyncthingRunnable 	at com.nutomic.syncthingandroid.service.SyncthingRunnable.lambda$log$0$SyncthingRunnable(SyncthingRunnable.java:426)
21:20:11W/SyncthingRunnable 	at com.nutomic.syncthingandroid.service.SyncthingRunnable$$ExternalSyntheticLambda0.run(Unknown Source:8)
21:20:11W/SyncthingRunnable 	at java.lang.Thread.run(Thread.java:923)
21:20:11W/SyncthingRunnable Caused by: android.system.ErrnoException: open failed: EROFS (Read-only file system)
21:20:11W/SyncthingRunnable 	at libcore.io.Linux.open(Native Method)
21:20:11W/SyncthingRunnable 	at libcore.io.ForwardingOs.open(ForwardingOs.java:166)
21:20:11W/SyncthingRunnable 	at libcore.io.BlockGuardOs.open(BlockGuardOs.java:254)
21:20:11W/SyncthingRunnable 	at libcore.io.ForwardingOs.open(ForwardingOs.java:166)
21:20:11W/SyncthingRunnable 	at android.app.ActivityThread$AndroidOs.open(ActivityThread.java:7551)
21:20:11W/SyncthingRunnable 	at libcore.io.IoBridge.open(IoBridge.java:478)
21:20:11W/SyncthingRunnable 	... 9 more
21:20:11W/SyncthingRunnable Syncthing exited unexpectedly. Exit code = 141
21:20:11W/ApiRequest Request to https://127.0.0.1:8384/rest/system/shutdown failed, code=0, msg=java.net.ConnectException: Failed to connect to /127.0.0.1:8384
21:20:11I/SyncthingService onServiceStateChange: from ERROR to DISABLED

The most important remarkable thing to notice is that I’m not using the SD card for any sync, just the internal storage, so why is Syncthing using it?

Thanks

1 Like

Hi,

that’s definitely a bug. We try to detect primary storage and on some phones the Android OS returns the external storage. This results in Syncthing-Fork writing log+backup to the extSdCard.

I some time ago liked to fix this but didn’t get it to reproduce on my phone.

I hope you’ll be able to fix it! It’s very annoying! I’m on Android 11 and custom ROM ArrowOS, try to install Syncthing on a similar system and while the SD Card is mounted, create some syncs on the internal storage then unmount the SD card. Please let know whether you’ll be able to reproduce and fix, thanks!

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.