couldn't open output file: Read-only file system

5,254

As a workaround, you can simply redirect the output yourself instead of using the -f option:

adb logcat > log

I am guessing that the program might change it's working directory so it's trying to create log somewhere where you have no write access. If so, you should also be able to get it to work using an absolute path:

adb logcat > /home/username/log
Share:
5,254

Related videos on Youtube

Totem
Author by

Totem

Updated on September 18, 2022

Comments

  • Totem
    Totem over 1 year

    I just installed Ubuntu. My problem is I am attempting to write a log file to home. I am using logcat from a python module called adb. When I attempt the terminal command adb logcat -f <path> I should be able to output this log to a text file on my hard drive, but Instead I get the error:

    couldn't open output file: Read-only file system
    

    This is despite attempting the command sudo adb logcat -f <path>. For <path> I have mainly been trying just 'log' and 'log.txt'

    I am able to write files to disk using cat > and I can save files without issue. I have read that this can be caused by a failing hard disk, but up until now I haven't seen any other evidence of this. Any help in understanding why this is happening and how to overcome it would be greatly appreciated. In case anyone is wondering, it is necessary for me to output this file to disk.

    EDIT:

    I should mention that I did in fact have a problem with my swap partition. I was getting an error to the tune of /dev/mapper/cryptswap1 is not ready yet or not present(not exact wording)on the splash screen during boot, but I reformatted and made a new swap partition which got rid of the error. However, both before seeing to the problem, and still now, gparted labels the swap partition as 'unknown'. free -m shows no issues, nor does swapon -s

    EDIT: output of sudo mount

    /dev/sda5 on / type ext4 (rw,errors=remount-ro)
    proc on /proc type proc (rw,noexec,nosuid,nodev)
    sysfs on /sys type sysfs (rw,noexec,nosuid,nodev)
    none on /sys/fs/cgroup type tmpfs (rw)
    none on /sys/fs/fuse/connections type fusectl (rw)
    none on /sys/kernel/debug type debugfs (rw)
    none on /sys/kernel/security type securityfs (rw)
    udev on /dev type devtmpfs (rw,mode=0755)
    devpts on /dev/pts type devpts (rw,noexec,nosuid,gid=5,mode=0620)
    tmpfs on /run type tmpfs (rw,noexec,nosuid,size=10%,mode=0755)
    none on /run/lock type tmpfs (rw,noexec,nosuid,nodev,size=5242880)
    none on /run/shm type tmpfs (rw,nosuid,nodev)
    none on /run/user type tmpfs (rw,noexec,nosuid,nodev,size=104857600,mode=0755)
    none on /sys/fs/pstore type pstore (rw)
    /dev/sda7 on /home type ext4 (rw)
    binfmt_misc on /proc/sys/fs/binfmt_misc type binfmt_misc (rw,noexec,nosuid,nodev)
    systemd on /sys/fs/cgroup/systemd type cgroup (rw,noexec,nosuid,nodev,none,name=systemd)
    /home/me/.Private on /home/me type ecryptfs (ecryptfs_check_dev_ruid,ecryptfs_cipher=aes,ecryptfs_key_bytes=16,ecryptfs_unlink_sigs,ecryptfs_sig=cbb0ed41b9f457c5,ecryptfs_fnek_sig=9e985b7d47d6e940)
    gvfsd-fuse on /run/user/1000/gvfs type fuse.gvfsd-fuse (rw,nosuid,nodev,user=me)
    

    output of apt-cache policy 'sytemd*':

    Version table:
     *** 204-0ubuntu19.1 0
            500 http://ie.archive.ubuntu.com/ubuntu/ saucy-updates/main amd64 Packages
            100 /var/lib/dpkg/status
         204-0ubuntu18 0
            500 http://ie.archive.ubuntu.com/ubuntu/ saucy/main amd64 Packages
    root-system-bin:
      Installed: (none)
      Candidate: 5.34.09-1
      Version table:
         5.34.09-1 0
            500 http://ie.archive.ubuntu.com/ubuntu/ saucy/universe amd64 Packages
    libboost-filesystem1.50-dev:
      Installed: (none)
      Candidate: (none)
      Version table:
    libmono-system-data4.0-cil:
      Installed: (none)
      Candidate: 2.10.8.1-5ubuntu2
      Version table:
         2.10.8.1-5ubuntu2 0
            500 http://ie.archive.ubuntu.com/ubuntu/ saucy/main amd64 Packages
    libmono-system-runtime4.0-cil:
      Installed: (none)
      Candidate: 2.10.8.1-5ubuntu2
      Version table:
         2.10.8.1-5ubuntu2 0
            500 http://ie.archive.ubuntu.com/ubuntu/ saucy/main amd64 Packages
    libmono-system-windows-forms4.0-cil:
      Installed: (none)
      Candidate: 2.10.8.1-5ubuntu2
      Version table:
         2.10.8.1-5ubuntu2 0
            500 http://ie.archive.ubuntu.com/ubuntu/ saucy/main amd64 Packages
    qemu-system-or32:
      Installed: (none)
      Candidate: (none)
      Version table:
    xen-system:
      Installed: (none)
      Candidate: (none)
      Version table:
    libmono-system2.0-cil:
      Installed: (none)
      Candidate: 2.10.8.1-5ubuntu2
      Version table:
         2.10.8.1-5ubuntu2 0
            500 http://ie.archive.ubuntu.com/ubuntu/ saucy/main amd64 Packages
    libsystemu-ruby1.8:
      Installed: (none)
      Candidate: 2.5.1-1
      Version table:
         2.5.1-1 0
            500 http://ie.archive.ubuntu.com/ubuntu/ saucy/universe amd64 Packages
    system-image-dev:
      Installed: (none)
      Candidate: 1.9.1-0ubuntu1
      Version table:
         1.9.1-0ubuntu1 0
            500 http://ie.archive.ubuntu.com/ubuntu/ saucy/universe amd64 Packages
    libsystemsettings1:
      Installed: (none)
      Candidate: 0.1+13.10.20131015.2-0ubuntu1
      Version table:
         0.1+13.10.20131015.2-0ubuntu1 0
            500 http://ie.archive.ubuntu.com/ubuntu/ saucy/universe amd64 Packages
    xen-linux-system-686-pae:
      Installed: (none)
      Candidate: (none)
      Version table:
    libmono-system-data-linq4.0-cil:
      Installed: (none)
      Candidate: 2.10.8.1-5ubuntu2
      Version table:
         2.10.8.1-5ubuntu2 0
            500 http://ie.archive.ubuntu.com/ubuntu/ saucy/main amd64 Packages
    ubuntu-system-service:
      Installed: 0.2.5
      Candidate: 0.2.5
      Version table:
     *** 0.2.5 0
            500 http://ie.archive.ubuntu.com/ubuntu/ saucy/main amd64 Packages
            100 /var/lib/dpkg/status
    qemu-system-s390x:
      Installed: (none)
      Candidate: (none)
      Version table:
    libboost-filesystem1.53.0:
      Installed: (none)
      Candidate: 1.53.0-6+exp3ubuntu8
      Version table:
         1.53.0-6+exp3ubuntu8 0
            500 http://ie.archive.ubuntu.com/ubuntu/ saucy/main amd64 Packages
    libmono-system-runtime-serialization4.0-cil:
      Installed: (none)
      Candidate: 2.10.8.1-5ubuntu2
      Version table:
         2.10.8.1-5ubuntu2 0
            500 http://ie.archive.ubuntu.com/ubuntu/ saucy/main amd64 Packages
    qemu-system-ppcemb:
      Installed: (none)
      Candidate: (none)
      Version table:
    libmono-system-ldap4.0-cil:
      Installed: (none)
      Candidate: 2.10.8.1-5ubuntu2
      Version table:
         2.10.8.1-5ubuntu2 0
            500 http://ie.archive.ubuntu.com/ubuntu/ saucy/main amd64 Packages
    systemc:
      Installed: (none)
      Candidate: (none)
      Version table:
    system-config-printer:
      Installed: (none)
      Candidate: (none)
      Version table:
    systemd:
      Installed: (none)
      Candidate: (none)
      Version table:
    qemu-system-sh4:
      Installed: (none)
      Candidate: (none)
      Version table:
    xen-linux-system-amd64:
      Installed: (none)
      Candidate: (none)
      Version table:
    qemu-system-xtensa:
      Installed: (none)
      Candidate: (none)
      Version table:
    libmono-system-transactions4.0-cil:
      Installed: (none)
      Candidate: 2.10.8.1-5ubuntu2
      Version table:
         2.10.8.1-5ubuntu2 0
            500 http://ie.archive.ubuntu.com/ubuntu/ saucy/main amd64 Packages
    libghc-system-fileio-prof-0.3.10-17c22:
      Installed: (none)
      Candidate: (none)
      Version table:
    libmono-system-windows-forms-datavisualization4.0-cil:
      Installed: (none)
      Candidate: 2.10.8.1-5ubuntu2
      Version table:
         2.10.8.1-5ubuntu2 0
            500 http://ie.archive.ubuntu.com/ubuntu/ saucy/main amd64 Packages
    libghc-system-filepath-prof:
      Installed: (none)
      Candidate: 0.4.7-2build1
      Version table:
         0.4.7-2build1 0
            500 http://ie.archive.ubuntu.com/ubuntu/ saucy/universe amd64 Packages
    libqtsysteminfo1:
      Installed: (none)
      Candidate: 1.2.0-3ubuntu5
      Version table:
         1.2.0-3ubuntu5 0
            500 http://ie.archive.ubuntu.com/ubuntu/ saucy/universe amd64 Packages
    system-tools-backends-dev:
      Installed: (none)
      Candidate: 2.10.2-1ubuntu1
      Version table:
         2.10.2-1ubuntu1 0
            500 http://ie.archive.ubuntu.com/ubuntu/ saucy/universe amd64 Packages
    libboost-system1.52-dev:
      Installed: (none)
      Candidate: (none)
      Version table:
    system-config-samba:
      Installed: (none)
      Candidate: 1.2.63-0ubuntu5
      Version table:
         1.2.63-0ubuntu5 0
            500 http://ie.archive.ubuntu.com/ubuntu/ saucy/universe amd64 Packages
    libmono-system-security4.0-cil:
      Installed: (none)
      Candidate: 2.10.8.1-5ubuntu2
      Version table:
         2.10.8.1-5ubuntu2 0
            500 http://ie.archive.ubuntu.com/ubuntu/ saucy/main amd64 Packages
    libboost-filesystem1.46-dev:
      Installed: (none)
      Candidate: (none)
      Version table:
    libghc-filesystem-conduit-doc:
      Installed: (none)
      Candidate: 1.0.0-2build1
      Version table:
         1.0.0-2build1 0
            500 http://ie.archive.ubuntu.com/ubuntu/ saucy/universe amd64 Packages
    root-system-common:
      Installed: (none)
      Candidate: 5.34.09-1
      Version table:
         5.34.09-1 0
            500 http://ie.archive.ubuntu.com/ubuntu/ saucy/universe amd64 Packages
    system-config-printer-gnome:
      Installed: 1.4.2+20130920-0ubuntu1.2
      Candidate: 1.4.2+20130920-0ubuntu1.2
      Version table:
     *** 1.4.2+20130920-0ubuntu1.2 0
            500 http://ie.archive.ubuntu.com/ubuntu/ saucy-updates/main amd64 Packages
            100 /var/lib/dpkg/status
         1.4.2+20130920-0ubuntu1 0
            500 http://ie.archive.ubuntu.com/ubuntu/ saucy/main amd64 Packages
    libmono-system-servicemodel-routing4.0-cil:
      Installed: (none)
      Candidate: 2.10.8.1-5ubuntu2
      Version table:
         2.10.8.1-5ubuntu2 0
            500 http://ie.archive.ubuntu.com/ubuntu/ saucy/main amd64 Packages
    qemu-system-ppc64:
      Installed: (none)
      Candidate: (none)
      Version table:
    libmono-system-web-abstractions4.0-cil:
      Installed: (none)
      Candidate: 2.10.8.1-5ubuntu2
      Version table:
         2.10.8.1-5ubuntu2 0
            500 http://ie.archive.ubuntu.com/ubuntu/ saucy/main amd64 Packages
    libmono-system-xaml4.0-cil:
      Installed: (none)
      Candidate: 2.10.8.1-5ubuntu2
      Version table:
         2.10.8.1-5ubuntu2 0
            500 http://ie.archive.ubuntu.com/ubuntu/ saucy/main amd64 Packages
    liblua5.1-filesystem0:
      Installed: (none)
      Candidate: 1.5.0+16+g84f1af5-1
      Version table:
         1.5.0+16+g84f1af5-1 0
            500 http://ie.archive.ubuntu.com/ubuntu/ saucy/universe amd64 Packages
    system-tools-backends:
      Installed: (none)
      Candidate: 2.10.2-1ubuntu1
      Version table:
         2.10.2-1ubuntu1 0
            500 http://ie.archive.ubuntu.com/ubuntu/ saucy/universe amd64 Packages
    qemu-system-x86:
      Installed: (none)
      Candidate: 1.5.0+dfsg-3ubuntu5.3
      Version table:
         1.5.0+dfsg-3ubuntu5.3 0
            500 http://ie.archive.ubuntu.com/ubuntu/ saucy-updates/main amd64 Packages
            500 http://security.ubuntu.com/ubuntu/ saucy-security/main amd64 Packages
         1.5.0+dfsg-3ubuntu5 0
            500 http://ie.archive.ubuntu.com/ubuntu/ saucy/main amd64 Packages
    system-config-printer-kde:
      Installed: (none)
      Candidate: (none)
      Version table:
    init-system-helpers:
      Installed: 1.7
      Candidate: 1.7
      Version table:
     *** 1.7 0
            500 http://ie.archive.ubuntu.com/ubuntu/ saucy/main amd64 Packages
            100 /var/lib/dpkg/status
    systemd-shim:
      Installed: 6-0ubuntu0.13.10
      Candidate: 6-0ubuntu0.13.10
      Version table:
     *** 6-0ubuntu0.13.10 0
            500 http://ie.archive.ubuntu.com/ubuntu/ saucy-updates/main amd64 Packages
            100 /var/lib/dpkg/status
         3+real-0ubuntu1 0
            500 http://ie.archive.ubuntu.com/ubuntu/ saucy/main amd64 Packages
    libghc-system-fileio-doc:
      Installed: (none)
      Candidate: 0.3.10-2build1
      Version table:
         0.3.10-2build1 0
            500 http://ie.archive.ubuntu.com/ubuntu/ saucy/universe amd64 Packages
    systemtap-grapher:
      Installed: (none)
      Candidate: (none)
      Version table:
    libmono-system-enterpriseservices4.0-cil:
      Installed: (none)
      Candidate: 2.10.8.1-5ubuntu2
      Version table:
         2.10.8.1-5ubuntu2 0
            500 http://ie.archive.ubuntu.com/ubuntu/ saucy/main amd64 Packages
    libghc-system-filepath-dev-0.4.7-c7b27:
      Installed: (none)
      Candidate: (none)
      Version table:
    qemu-system-x86-64:
      Installed: (none)
      Candidate: (none)
      Version table:
    system-config-printer-udev:
      Installed: 1.4.2+20130920-0ubuntu1.2
      Candidate: 1.4.2+20130920-0ubuntu1.2
      Version table:
     *** 1.4.2+20130920-0ubuntu1.2 0
            500 http://ie.archive.ubuntu.com/ubuntu/ saucy-updates/main amd64 Packages
            100 /var/lib/dpkg/status
         1.4.2+20130920-0ubuntu1 0
            500 http://ie.archive.ubuntu.com/ubuntu/ saucy/main amd64 Packages
    libsystem-command-perl:
      Installed: (none)
      Candidate: 1.09-1
      Version table:
         1.09-1 0
            500 http://ie.archive.ubuntu.com/ubuntu/ saucy/universe amd64 Packages
    libboost-system1.42-dev:
      Installed: (none)
      Candidate: (none)
      Version table:
    qemu-system:
      Installed: (none)
      Candidate: 1.5.0+dfsg-3ubuntu5.3
      Version table:
         1.5.0+dfsg-3ubuntu5.3 0
            500 http://ie.archive.ubuntu.com/ubuntu/ saucy-updates/main amd64 Packages
            500 http://security.ubuntu.com/ubuntu/ saucy-security/main amd64 Packages
         1.5.0+dfsg-3ubuntu5 0
            500 http://ie.archive.ubuntu.com/ubuntu/ saucy/main amd64 Packages
    systemtap-doc:
      Installed: (none)
      Candidate: 2.2.1-1ubuntu1
      Version table:
         2.2.1-1ubuntu1 0
            500 http://ie.archive.ubuntu.com/ubuntu/ saucy/main amd64 Packages
    libboost-system1.48-dev:
      Installed: (none)
      Candidate: (none)
      Version table:
    lua5.2-filesystem-dev:
      Installed: (none)
      Candidate: (none)
      Version table:
    system-config-kickstart:
      Installed: (none)
      Candidate: 2.5.20-0ubuntu22
      Version table:
         2.5.20-0ubuntu22 0
            500 http://ie.archive.ubuntu.com/ubuntu/ saucy/main amd64 Packages
    live-config-systemd:
      Installed: (none)
      Candidate: 3.0.23-1
      Version table:
         3.0.23-1 0
            500 http://ie.archive.ubuntu.com/ubuntu/ saucy/universe amd64 Packages
    systemtap:
      Installed: (none)
      Candidate: 2.2.1-1ubuntu1
      Version table:
         2.2.1-1ubuntu1 0
            500 http://ie.archive.ubuntu.com/ubuntu/ saucy/universe amd64 Packages
    libsystemd-login-dev:
      Installed: (none)
      Candidate: 204-0ubuntu19.1
      Version table:
         204-0ubuntu19.1 0
            500 http://ie.archive.ubuntu.com/ubuntu/ saucy-updates/main amd64 Packages
         204-0ubuntu18 0
            500 http://ie.archive.ubuntu.com/ubuntu/ saucy/main amd64 Packages
    x-window-system:
      Installed: (none)
      Candidate: (none)
      Version table:
    qemu-system-mips64el:
      Installed: (none)
      Candidate: (none)
      Version table:
    libsystemu-ruby-doc:
      Installed: (none)
      Candidate: 2.5.1-1
      Version table:
         2.5.1-1 0
            500 http://ie.archive.ubuntu.com/ubuntu/ saucy/universe amd64 Packages
    xen-system-amd64:
      Installed: (none)
      Candidate: 4.3.0-1ubuntu1.3
      Version table:
         4.3.0-1ubuntu1.3 0
            500 http://ie.archive.ubuntu.com/ubuntu/ saucy-updates/universe amd64 Packages
            500 http://security.ubuntu.com/ubuntu/ saucy-security/universe amd64 Packages
         4.3.0-1ubuntu1 0
            500 http://ie.archive.ubuntu.com/ubuntu/ saucy/universe amd64 Packages
    qemu-system-sparc:
      Installed: (none)
      Candidate: 1.5.0+dfsg-3ubuntu5.3
      Version table:
         1.5.0+dfsg-3ubuntu5.3 0
            500 http://ie.archive.ubuntu.com/ubuntu/ saucy-updates/main amd64 Packages
            500 http://security.ubuntu.com/ubuntu/ saucy-security/main amd64 Packages
         1.5.0+dfsg-3ubuntu5 0
            500 http://ie.archive.ubuntu.com/ubuntu/ saucy/main amd64 Packages
    xen-linux-system-686:
      Installed: (none)
      Candidate: (none)
      Version table:
    gnome-system-log:
      Installed: 3.8.1-1svn1
      Candidate: 3.8.1-1svn1
      Version table:
     *** 3.8.1-1svn1 0
            500 http://ie.archive.ubuntu.com/ubuntu/ saucy/main amd64 Packages
            100 /var/lib/dpkg/status
    libmono-system4.0-cil:
      Installed: (none)
      Candidate: 2.10.8.1-5ubuntu2
      Version table:
         2.10.8.1-5ubuntu2 0
            500 http://ie.archive.ubuntu.com/ubuntu/ saucy/main amd64 Packages
    libqt5systeminfo5:
      Installed: (none)
      Candidate: 5.0~git20130712-0ubuntu3
      Version table:
         5.0~git20130712-0ubuntu3 0
            500 http://ie.archive.ubuntu.com/ubuntu/ saucy/universe amd64 Packages
    libmono-system-xml-linq4.0-cil:
      Installed: (none)
      Candidate: 2.10.8.1-5ubuntu2
      Version table:
         2.10.8.1-5ubuntu2 0
            500 http://ie.archive.ubuntu.com/ubuntu/ saucy/main amd64 Packages
    qtdeclarative5-systeminfo-plugin:
      Installed: (none)
      Candidate: 5.0~git20130712-0ubuntu3
      Version table:
         5.0~git20130712-0ubuntu3 0
            500 http://ie.archive.ubuntu.com/ubuntu/ saucy/universe amd64 Packages
    xen-system-i386:
      Installed: (none)
      Candidate: (none)
      Version table:
    libmono-system-configuration4.0-cil:
      Installed: (none)
      Candidate: 2.10.8.1-5ubuntu2
      Version table:
         2.10.8.1-5ubuntu2 0
            500 http://ie.archive.ubuntu.com/ubuntu/ saucy/main amd64 Packages
    libboost-system1.53-dev:
      Installed: (none)
      Candidate: 1.53.0-6+exp3ubuntu8
      Version table:
         1.53.0-6+exp3ubuntu8 0
            500 http://ie.archive.ubuntu.com/ubuntu/ saucy/main amd64 Packages
    qemu-system-m68k:
      Installed: (none)
      Candidate: (none)
      Version table:
    qemu-system-mips:
      Installed: (none)
      Candidate: 1.5.0+dfsg-3ubuntu5.3
      Version table:
         1.5.0+dfsg-3ubuntu5.3 0
            500 http://ie.archive.ubuntu.com/ubuntu/ saucy-updates/main amd64 Packages
            500 http://security.ubuntu.com/ubuntu/ saucy-security/main amd64 Packages
         1.5.0+dfsg-3ubuntu5 0
            500 http://ie.archive.ubuntu.com/ubuntu/ saucy/main amd64 Packages
    libfsosystem-dbg:
      Installed: (none)
      Candidate: (none)
      Version table:
    libmono-system-numerics4.0-cil:
      Installed: (none)
      Candidate: 2.10.8.1-5ubuntu2
      Version table:
         2.10.8.1-5ubuntu2 0
            500 http://ie.archive.ubuntu.com/ubuntu/ saucy/main amd64 Packages
    libmono-system-data-services4.0-cil:
      Installed: (none)
      Candidate: 2.10.8.1-5ubuntu2
      Version table:
         2.10.8.1-5ubuntu2 0
            500 http://ie.archive.ubuntu.com/ubuntu/ saucy/main amd64 Packages
    qemu-system-i386:
      Installed: (none)
      Candidate: (none)
      Version table:
    qemu-system-misc:
      Installed: (none)
      Candidate: 1.5.0+dfsg-3ubuntu5.3
      Version table:
         1.5.0+dfsg-3ubuntu5.3 0
            500 http://ie.archive.ubuntu.com/ubuntu/ saucy-updates/main amd64 Packages
            500 http://security.ubuntu.com/ubuntu/ saucy-security/main amd64 Packages
         1.5.0+dfsg-3ubuntu5 0
            500 http://ie.archive.ubuntu.com/ubuntu/ saucy/main amd64 Packages
    libghc-system-filepath-dev:
      Installed: (none)
      Candidate: 0.4.7-2build1
      Version table:
         0.4.7-2build1 0
            500 http://ie.archive.ubuntu.com/ubuntu/ saucy/universe amd64 Packages
    
    • terdon
      terdon about 10 years
      Please include the actual path of your desired output file. If the path is simply log in your current directory, please explain which directory you are running from. Do you get the same message if you do this from your $HOME?
    • Totem
      Totem about 10 years
      Running from HOME :)
    • Totem
      Totem about 10 years
      strange, all my other comments have disappeared
    • terdon
      terdon about 10 years
      Yes, comments can be deleted without warning, that's why details should always be added to the question body. Now, if I understand correctly, you only get this from a python script. Is that right? Can you run the command itself from the terminal correctly? Can we see the relevant parts of your script?
    • Totem
      Totem about 10 years
      if I run 'adb logcat' then I get the desired output to the terminal, option -f <path> should output to a file. So it's working without the -f <path> bit
    • Totem
      Totem about 10 years
      This is not part of a script, I just wanted the log file to troubleshoot some unrelated issues. If I just output to the terminal then too much info gets passed by
    • terdon
      terdon about 10 years
      Well, you can always use adb logcat > log of course, are you sure the -f option does what you think it does? I don't know where to get this adb in order to test.
    • Totem
      Totem about 10 years
      from adb logcat --help is the following on -f: -f <filename> Log to file. Default to stdout