Fix "The file system is read-only" error in Linux
Method 1: Set access rights
The first way to fix the error "The file system is read-only." in Linux it consists of checking the access rights. Sometimes a user accidentally or intentionally sets restrictions that apply to other users. We suggest that you check the attributes first and then make any necessary changes.
- Start the console using a method that is comfortable for you. To do this, you can use the corresponding icon in the application menu or the shortcut key Ctrl + Alt + T.
- Here, enter a command
ls -l
to see the complete list of discs with detailed information, among which will be the one we need. - Examine the attributes displayed in the first column next to the problem disk or partition. If there is only one character -rmeans that the system is read-only. Availability w means open to read and write.
- If the problem is really related to the specified attributes, you will have to reconfigure the permissions. Enter the command
sudo chown -R [user]:[user] /home/[user]
substituting user to the name of the desired user, to which all changes will be applied. - This action is performed with the option sudoso it will have to be confirmed by entering the superuser password in the new line.
After activating the command, you will be notified that all changes have taken effect. It is recommended to restart the PC and start testing. If the command is used ls has all required attributes for partition or media, you should move on to other solutions for the problem encountered.
Method 2: Bug Fixes Using GParted
GParted is one of the most popular disk management utilities on Linux with a built-in graphical user interface. It has many ancillary functions related to resolving various media errors, among others.
- If GParted is not available by default on your distribution, install it using the command
sudo apt-get install gparted
. Confirm this action by entering the root password and approving the file download. - Afterwards, the easiest thing is to start the utility by clicking on the corresponding icon in the applications menu.
- You will also need superuser privileges to open it.
- When you log in, it will be immediately clear which partition is the problem, as an exclamation point will light up next to it. Right click on this line.
- In the context menu, click "Error checking.".
- Start operations by clicking the check mark button on the top panel.
- Confirm to run the check.
- It only remains to wait for this process to complete.
If any bugs are found and corrected, you will be notified accordingly. After the check is complete, you must restart your PC so that when you start the next session you can check the effectiveness of the actions taken at once. If they don't give any results, move on.
Method 3: Repair Bad Blocks
Sometimes a read error occurs due to bad sectors of the hard drive. There are special utilities that allow you to allocate the problem space or fix it, if possible. Linux has a built-in command to do this. We suggest its use in case the above recommendations are of no use.
- First, we are going to look at the list of disks to see which one needs to be checked. The way to do it is to run the program
fdisk -l
. - In the list, locate the problem unit by identifying its exact name. You will need it later when you activate the appropriate command to heal the blocks.
- Now use the command
hdparm -i /dev/sda2 | grep Model
to check the selected media or logical drive. Here replace / Dev / sda2 to the previously defined name. - After that, you need to unmount the disk so that you can run a block check later. This is done with the line
umount /dev/sda2
. - Run the test by inserting the command
badblocks -s /dev/sda2 > /root/badblock
. - Detected locks that cannot be set must be checked for the system to stop activating them. To do this, use
e2fsck -l /root/badblock /dev/sda2
.
All changes will be applied immediately, but as usual it is recommended to create a new OS session to check if the error encountered problem has been resolved "The file system is read-only.".
Method 4: Format the drive
The last method we want to talk about in today's article is the most radical, since it involves a complete formatting of the drive, after which the state of the file system will be restored. This option will be suitable only in the situation where there are no important files on the disk and all the content can be deleted. For more detailed instructions on this topic, please see the separate article on our website using the link provided below.
Further information: Format a disk in Linux
Today we break down four methods to fix the problem "The file system is read-only.". It remains to find a suitable one only by brute force, carrying out all the instructions given in order. In most cases, at least one of them is effective and allows the error under consideration to be completely eliminated.
We are glad that we were able to help you resolve the issue.
Our specialists will try to respond as quickly as possible.
Has this article helped you?
What is the size in pixels of the sheets a4 a3 a2 a1 and a0 depending on the dpi
How to delete a Facebook account without password and email
How to know who is behind an instagram profile
How to know who canceled the message on instagram
How to know if the iPhone is hacked
How to install IPTV on the Fire TV Stick
What to do if images disappear from gallery on Android
Spotify cracked IOS 2021, How to install it?
How to copy the link to your instagram profile
How to know who is behind a Facebook profile
Troubleshooting the red LOS light on the router
How to find out the MI account id on your Xiaomi smartphone
How to install IPTV on the Fire TV Stick
How to change Supercell email id
How to unblock Iphone Telegram channels
how to hide who i follow on instagram
How to fix the error requires action with the Google account
e_fail 0x80004005 error in Virtualbox, causes and solutions
How to put your name on a WhatsApp list
How to delete your Shein account
Troubleshooting the red LOS light on the router
How to see how many messages are in a chat
How to unblock Iphone Telegram channels
How to send self-destructing photos or videos on Telegram
How to download Facebook stories from PC