0

When I trie to show logs of a specific priority in logcat and direct the stream to a textfile I get the following error message:

 1|shell@android:/ $ adb logcat "*:W" > logcat.txt                             
 /system/bin/sh: can't create logcat.txt: Read-only file system

What has the Read-only file system to do with directing the output to textfile? How do I get around this? probably via

chmod +w <file>

but which folder/file in the linux-filesystem of my android device?

Are there better get-arounds?

I can underline that my device is already rooted.

1
  • adb logcat -v threadtime > <destination on you computer>
    – Sam
    Apr 18, 2016 at 17:51

2 Answers 2

3

adb logcat on your phone launches an ADB server on your phone (which is also running on your PC) and connects to itself.

Then you try to write everything to /logcat.txt (/ is the the root of your filesystem; you can't write there).

Try routing your output to something like /sdcard/logcat.txt or run it directly on your PC, where it gets saved in the current working directory of your cmd.exe.

2
  • Ok, maybe I completely missed something here? I thought it was directed to where I am in the computers filesystem, since adb logcat > logcat.txt does that. Aug 23, 2015 at 18:38
  • It does that, as long as you run from your computer. adb shell runs on your phone.
    – GiantTree
    Aug 23, 2015 at 19:47
2

In your command line example, you are running the ADB command from the Android terminal with / as current directory. So Android tries to write the output to /logcat.txt, which fails.

Keep in mind that after you execute adb shell everything you type happens on the phone. The command adb logcat then runs on your phone, and the creation of the text file also happens on your phone.

Because / is read-only in Android you get the error you described.

If you just want the logcat on your PC, run adb logcat > logcat.txt from your PC with your phone connected. If you want to save the logcat on your phone, type logcat > /sdcard/logcat.txt to save it to a writable location.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .