Problem description
After you restart a Linux Elastic Compute Service (ECS) instance, the instance operating system runs as expected, but Read-only file system *** error messages appear when you run the charrt, mkdir, and cat commands on the instance.
When you run the
chattrcommand to modify thesshd_configfile, the Read-only file system *** error message appears.
When you run the
mkidrcommand to create a directory, the cannot create directory 'test': Read-only file system *** error message appears.
When you run the
catcommand to view the content of a file, the cannot create temp file for here-document: Read-only file system *** error message appears.
Causes
The issue may occur due to the following reasons:
The default mount option
rois configured in the/etc/fstabconfiguration file of the Linux ECS instance to mount the root file system (/) read-only. As a result, the system or processes cannot write files to the root file system, and the Linux ECS instance cannot start or system services cannot run as expected.No mount option is configured in the
/etc/fstabconfiguration file of the Linux ECS instance to mount the root file system (/). After you restart the Linux ECS instance, the default mount option (ro) is used to mount the root file system (/) read-only. As a result, the system or processes cannot write files to the root file system, and the Linux ECS instance cannot start or system services cannot run as expected.
Solution
Change the mount option for the root file system in the /etc/fstab configuration file
Connect to the Linux ECS instance by using Virtual Network Computing (VNC).
For more information, see Connection method overview.
View the mount option for the root file system.
cat /etc/fstabThe following command output indicates that the
romount option is used to mount the root file system (/) read-only. Set the mount option torwto mount the root file system read-write.
The following command output indicates that no mount option is configured for the root file system (
/) and the default mount option (ro) is used to mount the root file system. Set the mount option torwto mount the root file system read-write.
Remount the root file system read-write (
rw).mount -o remount rw /Set the mount option for the root file system (
/) in the/etc/fstabconfiguration file torw.Open the
/etc/fstabconfiguration file.vim /etc/fstabSet the mount option for the root file system (
/) torw.
Press the Esc key, enter
:wq, and then press the Enter key to save the change.Restart the Linux ECS instance for the change to take effect.
reboot