When I login my computer and try to run “tmux attach” this morning, it reported a strange error:
/tmp/tmux-1001/default (Address already in use)
Intuitively, I thought this temporary file is out of date. So I just type in a command to delete it. But another error jumped out “The filesystem is read-only!”.
By looking at the mount point “mount|grep ro,”, I noticed that my root directory is mounted with “read-only” option. Checking the /etc/fstab:
/dev/disk/by-uuid/69bf5a7f-4031-4a6d-b877-f83fc73a4440 / ext4 rw,discard,data=writeback, 0 1
I guess one of the mount options is wrong so the operating system only mounts a “read-only” filesystem.
After I remove the options one by one and reboot the machine many times, it turns out to be that “data=writeback” is the incorrect option. Essentially, “data=writeback” option is only for ext3.
When I trying to modify /etc/fstab, the system report “you can’t change file because the root filesystem is read-only”. Seems I was trapped in a dead loop… so I use my final weapon:
sudo mount -o remount,rw /dev/nvme0n1p2 /
And it works.
Now, by setting /etc/fstab, the ext4 filesystem could be mounted with both read and write permission:
/dev/disk/by-uuid/69bf5a7f-4031-4a6d-b877-f83fc73a4440 / ext4 rw,discard,noatime 0 1