Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Logs are written to external SD-card #817

Closed
STPKITT opened this issue Jun 8, 2021 · 19 comments
Closed

Logs are written to external SD-card #817

STPKITT opened this issue Jun 8, 2021 · 19 comments
Assignees
Labels
Milestone

Comments

@STPKITT
Copy link

STPKITT commented Jun 8, 2021

Description of the issue

Hi, I'm running Syncthing-Fork version 1.16.0.6 installed from F-Droid on a Sony Xperia X running LineageOS 16.0 which is Android 9 based. I have a SD-card in the device to which I try to avoid any write operations while running Android to due to the awfully vulnerable FAT filesystem which Android demands for external SD-cards. When I put the SD-card into my PC today to copy some new music onto it Windows reported that the filesystem was corrupt and due to the Scandisk result with recovered file fragments I found out that Syncthing-Fork was writing log files to the SD-card. I then went into the app trying to find the corresponding option to disable any log writing (btw it wears out the hardware, too!) or at the very least target those write operations to the device's internal memory but I couldn't find one.
So unless I overlooked something in which case I'd highly appreciate a hint I request the feature of an option to configure log file writing. Thanks!

Version Information

  • App Version: 1.16.0.6
  • Syncthing Version: IDK
  • Android Version: Android 9.0 / LineageOS 16.0
  • Device manufacturer: Sony
  • Device model: Xperia X
@Willie30F
Copy link

As far as I know, the log is written to the filesystem where the app is installed, so if you installed syncthing fork to the sd-card it writes onto it, instead of the internal memory. If that's the case, you should be able to move the app to the internal memory in android settings > apps.

An option to select a path where the logfile should be stored isn't implemented in the app as far as I can see.

@STPKITT
Copy link
Author

STPKITT commented Jun 8, 2021

I have not installed any app to the SD-card. I'm pretty sure that isn't even possible in Android versions newer than 4.x or so without any hacks.

@Catfriend1
Copy link
Owner

Hi, I understand your point but I've decided not to invest time on the log file path selector feature. To still make you feel better: If you have not enabled Syncthing debug options, the Syncthing log usually is a short consisting out of very little some log lines and therefore not harming your flash lifetime. What Android constantly writes (logs, sqlitedb's, etc.) is much more wearout, in my opinion.

@STPKITT
Copy link
Author

STPKITT commented Jun 8, 2021

That's disappointing to read! Despite not having debugging enabled the logs were about 4 Mb though the way filesystems work any byte to be written causes a much bigger amount of actual writing. Android logs are at least written to internal storage which features wear leveling, which an SD-card does not.
Syncthing-fork needs at least a switch to completely disable logging. Most users just happily using Syncthing-fork won't need any log whatsoever anyway.

@STPKITT
Copy link
Author

STPKITT commented Jun 8, 2021

GitHub edit function not working in my browser it seems, though I just wanted to add that I'd even consider this issue a bug since it's highly unusual behaviour to have apps constantly writing logs to the SD-card.

@Catfriend1
Copy link
Owner

Catfriend1 commented Jun 8, 2021

There is no constant writing. It's not the bug category. If you have too much log, something might be wrong, please show the log to let us investigate what causes a lot of Syncthing (error) activity. Turning the log off by default is a no-no because we need this info if things go wrong in upstream Syncthing(Native) to help the devs developing for Android compatibility.

@Willie30F
Copy link

But why is it written to the sd-card? For me it is written to internal memory...

@Catfriend1
Copy link
Owner

Which storage paths exist on your device below /storage/ ?

@Willie30F
Copy link

I got the following:

  • /storage/emulated/0/
  • /storage/BE6D-53F7/ thats the sd-card

@Catfriend1
Copy link
Owner

ok - no promise for a change - but I'll check the log wrapper code during my next dev session.

@STPKITT
Copy link
Author

STPKITT commented Jun 8, 2021

Thanks!
I currently can't provide logs since as mentioned initally I just found fragments of it in the FOUND.000 folder after a Scandisk run, which I deleted before reinserting the card into the smartphone.
The paths on my device are as follows:
/storage/E6AD-792A <-external SD-card
/storage/emulated/0/ <-internal memory
/storage/emulated/obb -<according to space available it's also the internal memory, shows different content though (just one folder belonging to an app)
/storage/self <-contains just a link to /mnt/user/0/primary which leads to the internal memory

@Catfriend1 Catfriend1 self-assigned this Jul 9, 2021
@j-romchain
Copy link

j-romchain commented Oct 18, 2021

This seems to be the same problem as I was having... #843

@STPKITT
Copy link
Author

STPKITT commented Oct 18, 2021

@j-romchain: I can only recommend to switch to using the original Syncthing app since that one doesn't constantly write to the SD-card and therefor your SD card's FAT filesystem will not become faulty as fast.

@j-romchain
Copy link

j-romchain commented Oct 18, 2021

My issue is that my sd card seems to be iffy, so when it tries to use it for logs it crashes, because the sdcard refuses to let it see the log. I could care less about my sdcards life, chances are ill be done with it or it'll break because of something else before I have to worry about flash wear.

@STPKITT
Copy link
Author

STPKITT commented Oct 18, 2021

While flash wear is a thing it's not what I'm talking about in this issue. The issue is the FAT filesystem in use on Android's external SD cards. Tiny issues like your device doing an automatic reset will cause the FAT filesystem to be faulty when in that moment something was writing to it and Android does a filesystem check on boot but I never saw that have any positive effect since it doesn't correct FAT errors and still not mount it without write protection. It's just typical awful Android behaviour but that means it's important for apps like this Syncthing client to use the external SD unnecessarily.
Btw you could test your SD card for flash damage with the Windows util called h2testw or F3 on Linux: https://alternativeto.net/software/h2testw/?platform=linux

@j-romchain
Copy link

I have not had problems with sd corruption, but finishing my statement, it seems that the logs on sdcard was my problem... anyhow I am out, I am no longer going to follow around on my/ this problem until I get a bigger problem fixed that I brought up at the end of the issue I mentioned... it seems that my problem is solely my phone and or samsung, but this is related.

1 similar comment
@j-romchain

This comment has been minimized.

@Catfriend1
Copy link
Owner

I'd kindly ask if anyone in here with the ability to test their phone rom/model has a snippet of pr code to fix the log path detection? My phone logs to internal storage, just fyi.

@Catfriend1
Copy link
Owner

@STPKITT Please test https://github.com/Catfriend1/syncthing-android/releases/tag/v1.19.1.1 and let me know if your issue is fixed. Thank you.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

4 participants