`Read-only file system` error using tab completion, and terminal window closing randomly
I rebooted in recovery mode and followed the instructions the system gave me. I ran fsck
on /dev/sda2
, and that fixed the problem.
The Read-only file system
error is the major clue here. I would guess that your home directory, where bash tries to store your command history and so forth, is inside a read-only partition.
I would guess that it tries to update your recent command history on disk once every 32 commands, which is why it's failing on the 32nd command you type in a session.
Now, a partition may be mounted as read-only if you do it deliberately, but it may also be mounted as read-only if there was an error - this latter behaviour is usually the default for the root partition.
I'd be surprised if you weren't experiencing other problems if your root partition is mounted read-only.
You can try rebooting and checking the disk from the recovery menu. Press and hold shift as the computer boots, right after the BIOS screen disappears and right before the Ubuntu logo appears.
This exact issue happened to me too.
It occurs intermittently.
So I finally had enough with it and decided to reinstall OS - ubuntu-gnome 14.04 (clean).
It fixed it! At least for a few days.. Then that exact same problem occurred again...
So I went to Fry's and got a new hdd (Seagate).
So far so good ( 6 months & counting ).
side note: stock hdd was Toshiba
As others have pointed out, a read-only /tmp
filesystem causes further problems.
As for the 31 lines, it's related to gnome-terminal
's internals.
It keeps a certain amount of lines in memory, in a so-called "ring". The rest, lines that scroll out of this ring are placed in a "stream". In older versions of gnome-terminal the stream was pretty much directly written into a file under /tmp
, in newer versions there's buffering, compression and encryption before it's written out. (I can't remember off the top of my head whether the file under /tmp
is opened when the first chunk of data is written into the stream, or when the stream first tries to actually write to /tmp
; it's a minor implementation detail.)
The size of the ring is always a power of two (each slot containing 1 line of the terminal; except for 1 slot is not used due to technical reasons), and is doubled every time it's required due to the growth of the terminal height (but never shrinks back). E.g., with the default height of 24 lines the ring contains the last 31 lines of output, the rest goes to the stream (eventually to /tmp
). If you increase the window's height to let's say 40 lines, the in-memory ring will grow to accommodate at most 63 entries at a time.
What you experience is that gnome-terminal
tries to open a file in /tmp
to store the stream, and exits because of the unexpected failure here. Try with a taller window than the default; it'll crash after pressing Enter 63 (or maybe 127) times.
That being said, /tmp
should be fixed to be writable (with permissions 1777).
My problem was that a process was running with 100% CPU and probably took all disk resources (Some backup process: Ur-Backup).
Once i killed it, all went well. So I would think that a bottle-neck on the IO could cause this error even if there is enough space and you have write permission.
(Raspberry Pi with Jessy 18/03/16)