Fixing “Read‑Only File System” Error on Linux System: Causes & Complete Solutions

Fixing “Read‑Only File System” Error on Linux System: Causes & Complete Solutions

Fixing “Read‑Only File System” Error on Linux System: Causes & Complete Solutions

Sharwat Shafin July 15, 2025

If you have ever faced "read-only file system" error in Linux, you know how frustrating it can be. It can slow down your work or even cause system issues. This problem can happen for many reasons—sometimes it's just a simple setting, other times it could mean something more serious like file system damage. Before you can fix it, it's important to understand what's actually causing it.

In this blog, I'll explain why this happens, how to fix it step by step, and share some tips to help you avoid it in the future.

What Causes the Read-Only File System Issue?

Here I'll explain some of the most common reasons why your file system suddenly becomes read-only.


File-system errors or corruption:

One of the main reasons your Linux system might go into read-only mode is file system corruption. This can happen if your Linux VPS shuts down unexpectedly, if there's a hardware issue, or even because of a bug in the file system.

Hardware or storage I/O issues

On VPS setups, your hard disk might have some physical problems, which is a common reason why Ubuntu sets the file system to read-only. For example, if there are bad sectors on the disk, the system may switch to read-only mode to avoid causing more damage.

Misconfigured System File

Sometimes, the system settings file called /etc/fstab can be misconfigured. If it has certain options like errors=remount-ro, your system might automatically switch to read-only mode when it finds a problem. It's a built-in safety feature, but the wrong setup can cause unexpected issues.

Full disk space

A 100% full filesystem may mount as read-only to prevent further writes.

Critical System Crashes

If your system crashes or has a serious error (e.g., kernel panic), it can mess up the file system. When you reboot the VPS, Linux OS might set the file system to read-only to protect it from further damage.


How to Detect the Problem

Let's walk through several easy-to-use commands that help you confirm this and find out why it happened.

Check If Any Partition Is Mounted Read-Only:

Run this command to check if any file systems are in read-only mode:

Terminal
mount | grep ' ro,'

If you see output like this:

/dev/sda1 on / type ext4 (ro,errors=remount-ro)

Then your root (/) or another partition is definitely read-only.

Check If Root (/) Is Read-Only:

Run this command to check the mount options for your root file system:

Terminal
findmnt -no OPTIONS /

If it says:

rw,relatime

Then it's read-write. If it says:

ro,relatime

Then it's read-only — and that's the problem.

Check Disk Space:

Run this command to check disk space:

Terminal
df -h

If you see something like:

Filesystem      Size  Used Avail Use% Mounted on
/dev/sda1        40G   39G   0G  100% /

If Use% is 100%, your disk is completely full — and that's a problem.

Look for Kernel Messages (Read-Only Trigger Logs):

Run this command to check system logs for read-only remount messages:

Terminal
dmesg | grep -i "read-only"

This command searches through the system logs to find any messages related to file systems being set to read-only.

Example output:

EXT4-fs error (device sda1): Remounting filesystem read-only

This output gives strong evidence that Linux detected an error and forced the filesystem into read-only mode for safety.

Check File System Errors in Kernel Logs

Run this command to check kernel messages related to your file system (like ext4):

Terminal
sudo dmesg | grep -i ext4

This will show recent system messages that mention the ext4 file system. Replace “ext4” with your file system type (e.g., xfs, btrfs)

Check Detailed System Logs in /var/log/:

Run this command to check for system-level errors in the logs:

Terminal
sudo cat /var/log/syslog | grep -i error

or:

Terminal
sudo less /var/log/syslog

These commands help you find background issues like service crashes, disk problems, or permission errors—things that might cause your file system to go read-only.

Step-by-Step Guide to Fix the Read-Only File System Issue

Running into a read-only file system error on your Linux server can be really frustrating, especially when you can't make any changes or save files. But don't worry — in most cases, this issue can be fixed with a few steps. In this section, I'll walk you through some simple ways to identify and solve the problem.

Step 1: Try Remounting the File System

Sometimes the system switches to read-only mode because of a temporary issue. You can try to remount the file system as read/write with this command:

Terminal
sudo mount -o remount,rw /

This tells the system to remount your root (/) file system with write access. If this works, it may have just been a minor glitch. But if it doesn't, continue to the next steps.

Step 2: Check and Repair the File System (fsck)

File system corruption is a common reason for this issue. To fix it, you'll need to run a file system check using the fsck command. But first, you must unmount the file system (if it's not your root directory):

Terminal
sudo umount /dev/sdX1
sudo fsck -y /dev/sdX1

Replace /dev/sdX1 with the correct disk/partition name.

If you're fixing the root (/) file system, you can do this from a Live CD/ISO or rescue mode:

Terminal
sudo fsck -yf /dev/sdX1

Once the scan and repair are complete, reboot your server:

Terminal
sudo reboot

Step 3: Check /etc/fstab for Errors

The /etc/fstab file tells your system how to mount drives during boot. If there's a wrong setting here, it might cause your system to mount the file system as read-only. View the file using:

Terminal
cat /etc/fstab

Look for a line like this:

UUID=xxxx / ext4 errors=remount-ro 0 1

To avoid the system switching to read-only every time there's an error, you can change it to:

UUID=xxxx / ext4 defaults 0 1

Be careful when editing this file. Only make changes if you're sure about the correct settings.

Step 4: Check Disk Space

If your server runs out of space, it can cause the system to go into read-only mode. Run the command below to check disk usage:

Terminal
df -h

If any partition is 100% full, try cleaning up some space. For example, to clean up log files:

Terminal
sudo du -h --max-depth=1 /var/log
sudo apt clean

Freeing up disk space might fix the issue.

Step 5: Look for I/O Errors or Hardware Issues

If none of the above steps work, there may be a hardware problem or disk I/O error. Run the following to check for any error messages:

Terminal
dmesg | grep -i 'error\|I/O\|remount'

You can also check the health of your disk (if supported) with:

Terminal
sudo smartctl -a /dev/sdX

Replace /dev/sdX with your actual disk name. You may need to install the smartmontools package first.


How to Prevent "Read-Only File System" Errors in the Future

Once you've fixed the issue, it's a good idea to take a few simple steps to prevent it from happening again. These are easy habits that can keep your Linux VPS healthy and running smoothly.

Keep Your System Updated

Make sure your system is always running the latest updates and patches. Updates fix bugs, security holes, and system errors — some of which can cause disk or file system issues.

To update Ubuntu/Debian:

Terminal
sudo apt update && sudo apt upgrade

For CentOS/AlmaLinux:

Terminal
sudo yum update

Always Shut Down/Reboot Properly

Avoid turning off your server the hard way (like pulling the plug or holding the power button). Sudden shutdowns can corrupt the file system.

Always shut down with:

Terminal
sudo shutdown -h now

Always reboot with:

Terminal
sudo reboot

Check Disk Health Regularly

You can catch small problems before they become big ones. Use tools like fsck (file system check) and smartctl (disk health) to check your system.

To run a full check:

Terminal
sudo fsck -Af

To check disk health (if supported):

Terminal
sudo smartctl -a /dev/sda
Note: Some VPS providers may not support smartctl — it's more useful on physical disks or dedicated servers.

Monitor Disk Space

Running out of space can sometimes cause Linux to remount the file system as read-only. So it's smart to check it now and then.

Check disk usage:

Terminal
df -h

Double-Check /etc/fstab

This is the file Linux uses to decide how to mount your disks. A small mistake here can cause problems at boot or force a read-only mount.

Make sure entries in /etc/fstab are correct and don't include unnecessary ro (read-only) flags unless needed.

Conclusion

The “Read-Only File System” error in Linux is common — but it doesn't have to be stressful. With the right commands and a few quick checks, you can fix it fast and keep your server stable.

If you're looking for a faster, more reliable Linux hosting experience, check out our Ryzen-powered Linux VPS plans — built for performance and peace of mind.

FAQ:

Will using fsck delete my data?

fsck is designed to fix errors, not delete data. However, if it finds severely corrupted files, it may move them to a lost+found folder. Always back up if possible before running it.

Why does this happen more on VPS servers?

Some VPS platforms use shared virtual disks, which may be more prone to performance spikes, I/O delays, or improper shutdowns — all of which can lead to read-only states. That’s why choosing a stable host matters.

👉 Looking for reliable VPS? Check out our Linux VPS plans with Ryzen power

Can I fix a read-only file system without rebooting?
Yes, temporarily. But this doesn’t solve the root problem — a reboot and full disk check are usually needed.

Related Posts

Command Not Found in Linux: Real Error Examples & How to Fix Them

Command Not Found in Linux: Real Error Examples & How to Fix Them

Command Not Found in Linux: Real Error Examples & How to Fix Them

Sharwat Shafin July 7, 2025

Linux is powerful, but if you're new to it, encountering a message like "command not found" can be frustrating. Whether you're using Ubuntu, CentOS, Debian, Arch, or any other distro, this is one of the most commonly searched and seen errors.

In this guide, I'll break down real-life examples of this error and show you exactly how to fix them across different distributions.

What Does "Command Not Found" Actually Mean?

  • The command is not installed.
  • The command is installed, but not in your PATH.
  • You made a typo in the command.

Most Common "Command Not Found" Errors & Fixes Across Distros

Here are some of the most commonly searched "command not found" errors users encounter:

  • bash: ifconfig: command not found
    # Ubuntu/Debian:
    sudo apt install net-tools
    # CentOS/RHEL:
    sudo yum install net-tools
    # Fedora:
    sudo dnf install net-tools
    # Arch Linux:
    sudo pacman -S net-tools
    # Alpine:
    sudo apk add net-tools
    # openSUSE:
    sudo zypper install net-tools
                
  • bash: pip: command not found
    # Ubuntu/Debian:
    sudo apt install python3-pip
    # CentOS/RHEL:
    sudo yum install python3-pip
    # Fedora:
    sudo dnf install python3-pip
    # Arch Linux:
    sudo pacman -S python-pip
    # Alpine:
    sudo apk add py3-pip
    # openSUSE:
    sudo zypper install python3-pip
                
  • bash: python: command not found
    # Ubuntu/Debian:
    sudo apt install python3
    # CentOS/RHEL:
    sudo yum install python3
    # Fedora:
    sudo dnf install python3
    # Arch Linux:
    sudo pacman -S python
    # Alpine:
    sudo apk add python3
    # openSUSE:
    sudo zypper install python3
                
  • bash: git: command not found
    # Ubuntu/Debian:
    sudo apt install git
    # CentOS/RHEL:
    sudo yum install git
    # Fedora:
    sudo dnf install git
    # Arch Linux:
    sudo pacman -S git
    # Alpine:
    sudo apk add git
    # openSUSE:
    sudo zypper install git
                
  • zsh: node: command not found
    # Recommended for all distros:
    curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.39.7/install.sh | bash
    nvm install node
                
  • bash: curl: command not found
    # Ubuntu/Debian:
    sudo apt install curl
    # CentOS/RHEL:
    sudo yum install curl
    # Fedora:
    sudo dnf install curl
    # Arch Linux:
    sudo pacman -S curl
    # Alpine:
    sudo apk add curl
    # openSUSE:
    sudo zypper install curl
                
  • bash: sudo: command not found
    (If you're logged in as root)
    # Ubuntu/Debian:
    apt install sudo
    # CentOS/RHEL:
    yum install sudo
    # Fedora:
    dnf install sudo
    # Arch Linux:
    pacman -S sudo
    # Alpine:
    apk add sudo
    # openSUSE:
    zypper install sudo
                

What If the Command Is Installed But Still Not Found?

You might need to add it to your PATH.

Check PATH:
echo $PATH

Example Fix:
export PATH=$PATH:/usr/local/bin

To make it permanent, add that line to your .bashrc or .zshrc file.

How to Find the Package That Provides a Command

  • Debian/Ubuntu:
    apt-cache search 
    apt-file search  # install via: sudo apt install apt-file
  • CentOS/Red Hat:
    yum provides "*/"
  • Fedora:
    dnf provides 
  • Arch Linux:
    pacman -F  # Needs updated file database
  • Alpine:
    apk search -v 
  • openSUSE:
    zypper search 

Bonus: Fixing Your Own Custom Scripts

If you're creating custom bash scripts:

  • Save them in a known location, e.g., ~/scripts
  • Add that location to your PATH:
    export PATH="$PATH:$HOME/scripts"

FAQ: Command Not Found in Linux

Why do I get 'command not found' even after installing a package?

It could be because the binary is not in your system’s PATH. Run echo $PATH to see your current PATH, and ensure it includes the directory where the binary is installed.

What's the difference between 'command not found' in bash vs zsh?

Functionally, it’s the same issue — the shell can’t locate the command. The error message just varies by shell (bash: vs zsh:).

How can I make a command available permanently?

Add the installation directory to your PATH via .bashrc, .zshrc, or profile files: export PATH=”$PATH:/custom/path/to/bin”

Can I use a universal method to install missing commands?

Yes, for some tools like Node.js or Python, using version managers like nvm, pyenv, or package managers

like snap or flatpak can help across multiple distros.

Should I worry if 'sudo' itself is not found?
Yes — if sudo is missing, you may need to switch to the root account using su and install it manually depending on your distro

Conclusion

"Command not found" is common—but very fixable. Start by checking if the package is installed, then inspect your PATH. Whether you're managing servers or just learning Linux, these tips will help you quickly resolve the issue.

For persistent issues or uncommon errors, check the exact error and search it—or refer to this guide!

Related Posts

Unable to Locate Package phpmyadmin on Ubuntu VPS? Fix It in Minutes

Unable to Locate Package phpmyadmin on Ubuntu VPS? Fix It in Minutes

Sharwat Shafin July 3, 2025

Why the "Unable to locate package phpmyadmin" Error Occurs

If you've recently launched a fresh Ubuntu VPS and tried running:

Code
sudo apt install phpmyadmin

...you might see:

Code
E: Unable to locate package phpmyadmin

This happens because:

  • The phpmyadmin package isn't in the default Ubuntu 20.04/22.04 repositories
  • Some VPS providers ship minimal OS images with limited software sources
  • The universe repository (where phpmyadmin resides) isn't enabled

Prerequisites Before Installing phpMyAdmin

Make sure:

  • You're using a Ubuntu 20.04 or 22.04 VPS
  • You have sudo/root access
  • Your VPS is connected to the internet

If you don't have a VPS yet, check out our Ubuntu VPS Hosting Plans (Ryzen VPS page link) with root access and managed support for LAMP/LEMP setup.

Step-by-Step Fix for Ubuntu VPS

Step 1: Update Package Lists

Code
sudo apt update && sudo apt upgrade -y

Step 2: Enable the Universe Repository

Code
sudo add-apt-repository universe
sudo apt update

Step 3: Install phpMyAdmin

Code
sudo apt install phpmyadmin -y

During installation:

  • Select the web server (Apache or Lighttpd)
  • Configure the database with dbconfig-common
  • Set a password for phpmyadmin user

Step 4: Enable PHP Extension and Restart Apache (if needed)

Code
sudo phpenmod mysqli
sudo systemctl restart apache2

Step 5: Access phpMyAdmin

Open your browser and visit:

http://your-server-ip/phpmyadmin

Need a secure domain with SSL? Register a secure Domain. (Domain page link)

Common Mistakes to Avo

  • Missing universe repo → Use add-apt-repository universe
  • Wrong Ubuntu version → Some older versions dropped support
  • Incomplete LAMP setup→ Make sure Apache, PHP, and MySQL are installe

Alternatives to phpMyAdmin

If phpMyAdmin feels heavy or complex, here are some alternatives:


ToolDescription
AdminerLightweight PHP-based DB admin
MySQL CLIDefault command-line client
HeidiSQLGUI-based, works via SSH tunnel

Need help choosing the right stack? Explore our Managed VPS Services (Xeon VPS page) for assistance.

Final Thoughts and Related Resources

Getting the "Unable to locate package phpmyadmin" error is common on new VPS setups, but it's easily fixable by enabling the correct APT repositories. With a properly configured LAMP stack, phpMyAdmin gives you powerful, browser-based database control.

Conclusion

The “Unable to locate package phpmyadmin” error can be frustrating, especially when setting up a fresh Ubuntu VPS. But in most cases, it simply comes down to missing repositories or outdated package lists. By enabling the universe repository and properly configuring your system, you’ll have phpMyAdmin installed and running in just a few minutes.

Whether you're managing databases, deploying a website, or configuring a full web stack, having a stable and well-supported VPS environment makes all the difference.

Frequently Asked Questions (FAQ)

Why am I getting 'Unable to locate package phpmyadmin' on Ubuntu?

This error occurs because the phpmyadmin package is not available in the default Ubuntu 20.04 or 22.04 repositories. You need to enable the universe repository and update your APT sources to install it.

How do I fix the 'Unable to locate package phpmyadmin' error on my VPS?
To fix this error, run the following commands

sudo add-apt-repository universe
sudo apt update
sudo apt install phpmyadmin

This will enable the required repository and install phpMyAdmin on your Ubuntu VPS.

Is phpMyAdmin available on Ubuntu 22.04?

Yes, phpMyAdmin is available on Ubuntu 22.04, but it is not included in the default package sources. You must manually enable the universe repository using:

sudo add-apt-repository universe

Then update your package list with sudo apt update.

Can I install phpMyAdmin on a VPS with a LAMP stack?
Yes, phpMyAdmin works perfectly with a LAMP stack (Linux, Apache, MySQL, PHP). Just ensure that all components are properly installed and configured before installing phpMyAdmin.
What are some alternatives to phpMyAdmin for database management?

Some popular alternatives include:

  • Adminer – a lightweight PHP-based database management tool.
  • MySQL CLI – command-line client for advanced users.
  • MySQL Workbench – a GUI-based tool (run locally and connect via SSH).

These tools can also be used effectively on a VPS

Related Posts

bash: systemctl: command not found – How to Fix  This Common Linux Error

bash: systemctl: command not found – How to Fix This Common Linux Error

bash: systemctl: command not found – How to Fix This Common Linux Error

Sharwat Shafin June 30, 2025
If you’ve ever run into the error:

bash: systemctl: command not found…

while trying to manage a service in your Linux VPS or server, you’re not alone. This is one of the most commonly encountered Linux command-line errors, especially by users working with minimal server distributions or Docker containers.

In this article, we’ll explore why the systemctl command might be missing and provide step-by-step solutions for various Linux distributions including Ubuntu, Debian, CentOS, AlmaLinux, and Rocky Linux.

Why You See This Error

The error appears when your Linux system does not have systemd installed or when systemctl is not available in your $PATH.

Common causes include:

  • Using a minimal OS image (like Ubuntu minimal, Alpine Linux, or containers)
  • Running a Linux container without systemd
  • systemd not installed or not properly linked
  • Using a distribution that uses an alternative init system like SysVinit or OpenRC

What the Error Means

This message means your system either doesn't use systemd, lacks the systemctl utility, or it isn't in your shell's PATH.

Troubleshooting Steps

Here are some troubleshooting steps on how to install systemctl Linux and command not found issue:

Step 1: Verify if systemd is Installed

Run the following commands to check your init system:

ps -p 1 -o comm=

or

systemd --version

If it shows 'systemd', your system supports systemctl. If it's 'init', 'Upstart', or 'SysV', you may not be using systemd.

Step 2: Check Your PATH Environment Variable

If systemd is installed but the systemctl command isn’t found, check if your PATH environment variable includes the directory where systemctl resides:

echo $PATH

t should include /bin/, /usr/bin/, or /usr/local/bin/, as these directories typically contain systemctl. If not, add them to your PATH.

export PATH=$PATH:/usr/bin/

Step 3: Install or Reinstall systemd

If systemd is not installed and your distribution supports it, install it using your package manager. Here’s how to fix systemd not found on some of the major Linux distributions:

For Debian/Ubuntu:

sudo apt update

or

sudo apt install systemd-sysv

For CentOS/Fedora:


sudo yum install systemd

Minimal Environments & WSL

  • Minimal Docker or cloud images may lack systemd.
  • WSL1 doesn't support systemctl. Use WSL2 instead.

Alternatives if You Don't Use Systemd

If you're on older systems like CentOS 6, use:


sudo service  start

How Our VPS Can Help


FAQ

What if which systemctl returns nothing?

It’s likely not installed or not in your PATH.

Can I use service instead?

Yes, on non-systemd systems.

Why doesn’t WSL1 support systemctl?

WSL1 lacks a real init system. Upgrade to WSL2.

Common Questions About the “systemctl Not Found” Error

If you're using our "systemctl: command not found" error, here are other related problems and questions Linux users often search:

  • Fix systemctl not found Ubuntu 22.04 - This error usually happens when you're using a minimal install or WSL where systemd is missing.
  • Systemctl command missing CentOS - If you're on CentOS 6 or using a Docker container, systemd may not be present by default.
  • How to install systemctl on Linux - You can typically restore systemctl by installing systemd: sudo apt install systemd or yum install systemd.
  • Alternative to systemctl on Debian - Use service or init commands if systemd is not supported.
  • Systemctl not found error fix - Follow the full guide above to solve this issue across multiple Linux distributions.

If you're using our Linux Ryzen VPS or Xeon VPS, this error may appear on minimal images. Our team pre-installs systemd in standard OS templates to avoid this issue.

Related Posts