sudo unable to open read-only file system” cause

This error can be caused by several reasons, including:

  • The file system is inconsistent.
  • File system misconfiguration (bad entry in /etc/fstab file).
  • Unexpected or sudden shutdown of the system due to various reasons including sudden loss of power or damaged cables.
  • In some cases, Windows' dual-boot setup can cause this error.
  • hardware malfunction.

1. Check and fix file system errors in Linux

Freedom Star's
first step is to check your file system for any errors or inconsistencies. You can do this by running the following fsck command with the -M option, which skips checking for mounted filesystems.

$ sudo fsck -Af -M

If that fails, boot to the live installation media of your Linux system and run the following commands. Replace ext4 with the correct filesystem type and correct mount point. /dev/sda1

$ sudo fsck.ext4 -f /dev/sda1

Be sure to reboot the system after the file system repair is complete.

2. Mount the root file system with read and write permissions

Another trick is to force remount the root filesystem with read and write permissions using the root account, as shown below.

# mount -o 重新挂载,rw /

This should enable you to recover from errors.

3. Fix Linux and Windows dual boot problem

If you have a dual-boot setup, Windows is configured in fastboot mode, which occasionally locks up the filesystem.

The specific performance is that after restarting from win10 and entering ubuntu, it often appears that the file under a certain drive letter is read-only but not writable. This is the phenomenon that the file system is locked.

To fix this, first, boot into Windows.

Go to Start -> Power Settings and select Additional Power Settings on the right panel. Next, click Choose what the power buttons do.

Next, click “Change settings that are currently unavailable” and make sure the “Turn on fast startup” option is unchecked. Then click Save Changes.
Please add a picture description

Then reboot and boot into your Linux system.

$ reboot

Sometimes, simply rebooting can fix the problem. However, this may not be a permanent solution and the problem is likely to recur.

in conclusion

We've covered some issues that can cause read-only file systems and possible solutions to fix the error.

To mitigate or protect your data from such incidents, always back up your personal files and make sure to regularly update your system against malware and bugs. ``

reference

https://www.tecmint.com/fix-sudo-unable-to-open-read-only-filesystem/

Guess you like

Origin blog.csdn.net/chumingqian/article/details/130720302