无法打开输出文件:只读文件系统

无法打开输出文件:只读文件系统

我刚刚安装了 Ubuntu。我的问题是我试图将日志文件写入 home。我正在使用logcat名为 的 Python 模块adb。当我尝试终端命令时,adb logcat -f <path>我应该能够将此日志输出到硬盘上的文本文件中,但我却收到错误:

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

尽管尝试了命令,但结果仍然如此sudo adb logcat -f <path>。因为<path>我主要尝试的是“log”和“log.txt”

我能够使用将文件写入磁盘cat >,并且可以毫无问题地保存文件。我读到过这可能是由硬盘故障引起的,但到目前为止,我还没有看到任何其他证据。任何帮助理解为什么会发生这种情况以及如何克服它的帮助都将不胜感激。如果有人想知道,它我需要将此文件输出到磁盘。

编辑:

我应该提到,我的交换分区确实有问题。启动时,我在启动画面上收到错误/dev/mapper/cryptswap1 is not ready yet or not present(不是确切的措辞),但我重新格式化并创建了一个新的交换分区,从而消除了错误。但是,在发现问题之前和现在,gparted 都将交换分区标记为“未知”。free -m没有显示任何问题,也没有swapon -s

编辑:输出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)

输出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

答案1

作为一种解决方法,您可以简单地自己重定向输出,而不是使用该-f选项:

adb logcat > log

我猜想程序可能会更改其工作目录,因此它会尝试创建 log您无权写入的位置。如果是这样,您还应该能够使用绝对路径使其工作:

adb logcat > /home/username/log

相关内容