Softpanorama

May the source be with you, but remember the KISS principle ;-)
Home Switchboard Unix Administration Red Hat TCP/IP Networks Neoliberalism Toxic Managers
(slightly skeptical) Educational society promoting "Back to basics" movement against IT overcomplexity and  bastardization of classic Unix

Root filesystem is mounted read only on boot

News /etc/fstab/ Recommended Links Ext2-Ext3-Ext4 Attributes Filesystem mount options
Troubleshooting Errors in /etc/fstab fsck - check and repair a Linux strace Kexec Boot Directly into a Shell
 Linux Logical Volume Snapshots tmpfs   Humor Etc

Try to search in dmesg for errors. For example via

dmesg | less

If there are errors in /etc/fstab  the system can't boot properly and usually comes up in rescue mode. In this mode the only drive (root) is mounted as read-only.

Boot into single user mode by selecting your kernel and pressing e to edit and adding either 1, s, or single to the end of the statement. Hit return and then press b to boot. Once you are greeted with a prompt check your /etc/fstab to make sure root is readable. The entry for root should look like this:

UUID=26ab2266-f9f6-40f2-af3f-41f992154ac5 /                       ext4    defaults        1 1

Additionally check to make sure your other partitions look sane. If those look correct run dmesg to check that it isn't a hard drive problem.

To remount the root volume as RW, to make changes you can use the command:

mount -o remount,rw /

If you would like remount it to read-write, try to use mount -o remount,rw /

Than means that it is important to check if fstab options are correct for new partitions by first un-mounting them them and then trying to mount using

mount -a

Remember that the mount point must already exist, otherwise the entry will not mount on the filesystem

Again, system with incorrect /etc/fstab usually boot to safe mode with root filesystem mounted as read only.

There can be other reasons. Most common are failed disk and a corrupt file system.  

In this is a corrupt filesystem case (for example if the server abruptly lost power), in many cases such filesystem can be repaired using fsck utility. To determine which filesystem is affected (and whether this is filesystem related problem at all) useful information usually can be recovered from dmesg  command output.

The dmesg command is used to write the kernel messages in Linux and other Unixes  to standard output (which by default is the display screen).  Here is some recommendation on how to use it (How to use the dmesg command -- by The Linux Information Project (LINFO) ):

The dmesg  command is used to write the kernel messages  in Linux and other Unix-like operating systems to standard output (which by default is the display screen).

A kernel is the core of an operating system. It is the first part of the operating system that is loaded into memory when a computer boots up (i.e., starts up), and it controls virtually everything on a system. The numerous messages generated by the kernel that appear on the display screen as a computer boots up show the hardware devices that the kernel detects and indicate whether it is able to configure them.

dmesg obtains its data by reading the kernel ring buffer. A buffer is a portion of a computer's memory that is set aside as a temporary holding place for data that is being sent to or received from an external device, such as a hard disk drive (HDD), printer or keyboard. A ring buffer  is a buffer of fixed size for which any new data added to it overwrites the oldest data in it.

dmesg can be very useful when troubleshooting or just trying to obtain information about the hardware on a system. Its basic syntax is

dmesg [options]

Invoking dmesg without any of its options (which are rarely used) causes it to write all the kernel messages to standard output. This usually produces far too many lines to fit into the display screen all at once, and thus only the final messages are visible. However, the output can be redirected to the less  command through the use of a pipe (designated by the vertical bar character), thereby allowing the startup messages to be viewed one screenful at a time:

dmesg | less

less allows the output to be moved forward one screenful at a time by pressing the SPACE bar, backward by pressing the b  key and removed by pressing the q  key. (The more  command could have been used here instead of the less  command; however, less  is newer than more  and has additional functions, including the ability to return to previous pages of the output.)

When a user encounters a problem with the system, it can be convenient to write the output of dmesg to a file and then send that file by e-mail to a system administrator or other knowledgeable person for assistance. For example, the output could be redirected to a file named boot_messages  using the output redirection operator  (designated by a rightward facing angle bracket) as follows:

dmesg > boot_messages

Because of the length of the output of dmesg, it can be convenient to pipe its output to grep, a filter which searches for any lines that contain the string (i.e., sequence of characters) following it. The -i  option can be used to tell grep to ignore the case  (i.e., lower case or upper case) of the letters in the string. For example, the following command lists all references to USB (universal serial bus) devices in the kernel messages:

dmesg | grep -i usb

And the following tells dmesg to show all serial ports (which are represented by the string tty):

dmesg | grep -i tty

The dmesg and grep combination can also be used to show how much physical memory  (i.e., RAM) is available on the system:

dmesg | grep -i memory

The following command checks to confirm that the HDD(s) is running in DMA (direct memory access) mode:

dmesg | grep -i dma

The output of dmesg is maintained in the log file /var/log/dmesg, and it can thus also be easily viewed by reading that file with a text editor, such as vi or gedit, or with a command such as cat, e.g.,

cat /var/log/dmesg | less

Availability of baseline of the configuration is also very helpful.  

See also


Top Visited
Switchboard
Latest
Past week
Past month

NEWS CONTENTS

Old News ;-)

[Sep 30, 2015] boot - Why is my filesystem being mounted read-only in linux

Oct 1, 2010 | Server Fault

Tim

Why is my filesystem being mounted read-only in linux?

I am trying to set up a small linux system based on Gentoo on a VirtualBox machine, as a step towards deploying the same system onto a low-spec Single Board Computer. For some reason, my filesystem is being mounted read-only.
In my /etc/fstab, I have:
/dev/sda1 / ext3 defaults 0 0
none /proc proc defaults 0 0
none /sys sysfs defaults 0 0
none /dev/shm tmpfs defaults 0 0

However, once booted /proc/mounts shows
rootfs / rootfs rw 0 0
/dev/root / ext3 ro,relatime,errors=continue,barrier=0,data=writeback 0 0
proc /proc proc rw,nosuid,nodev,noexec,relatime 0 0
sysfs /sys sysfs rw,nosuid,nodev,noexec,relatime 0 0
udev /dev tmpfs rw,nosuid,relatime,size=10240k,mode=755 0 0
devpts /dev/pts devpts rw,nosuid,noexec,relatime,gid=5,mode=620 0 0
none /dev/shm tmpfs rw,relatime 0 0
usbfs /proc/bus/usb usbfs rw,nosuid,noexec,relatime,devgid=85,devmode=664 0 0
binfmt_misc /proc/sys/fs/binfmt_misc binfmt_misc rw,nosuid,nodev,noexec,relatime 0 0

(the above may contain errors: there's no practical way to copy and paste)
The partition at /dev/hda1 is clearly being mounted OK, since I can read all the data, but it's not being mounted as described in fstab. How might I go about diagnosing / resolving this?
Edit: I can remount with mount -o remount,rw / and it works as expected, except that /proc/mounts reports /dev/root mounted at / rather than /dev/sda1 as I'd expect.
If I try to remount with mount -a I get
mount: none already mounted or /sys busy
mount: according to mtab, sysfs is already mounted on /sys

Edit 2: I resolved the problem with mount -a (the same error was occuring during startup, it turned out) by changing the sysfs and proc lines to
proc /proc proc [...]
sysfs /sys sysfs [...]

Now mount -a doesn't complain, but it doesn't result in a read-write root partition. mount -o remount / does cause the root partition to be remounted, however.
linux boot gentoo fstab

Can you remount the partion rw? mount -o remount,rw / – MattyB Oct 1 '10 at 16:58


Do you use an initrd? If you use one, do you pivot the root file system? – Mircea Vutcovici Mar 22 '11 at 1:06
2

You say /dev/sda1 in some spots, /dev/hda1 in other spots. Mixing the 2 up can cause the issues youre seeing, so make sure everything is referencing the proper device. – Patrick Dec 23 '11 at 4:35
add a comment |
3 Answers 3
activeoldestvotes
up vote4down vote

perhaps it is because the disk is unclean, try changing:

/dev/sda1 / ext3 defaults 0 0

to

/dev/sda1 / ext3 defaults 0 1

or at least do an fsck and then reboot
share|improve this answer
answered Oct 19 '11 at 17:54

freedenizen
1412

Did this answer by freedenizen help you? It's easy to give back. Sign up to get started.

1

Even if this isnt the cause, the change should still be made. – Patrick Dec 23 '11 at 6:52
add a comment |


No problem. We won't show you that ad again. Why didn't you like it?
Uninteresting
Misleading
Offensive
Repetitive
Other
Oops! I didn't mean to do this.

up vote2down vote
You say it's a VirtualBox machine... Does the VirtualBox process have write privileges to the datastore on the host?
mount -a remounts everything as described in /etc/fstab. If this is not behaving as expected, there may be some output in syslog. Check and post here if there is anything relevant.
share|improve this answer
answered Oct 1 '10 at 18:22

Aaron Copley
6,67521844

I can't seem to find syslog on the machine, I don't know if it's been disabled in the distro I'm adapting, I'll have a look at re-enabling it. There doesn't seem to be any logging in /var/log, presumably because the device is read-only so nothing can be written. – Tim Oct 2 '10 at 5:01


And yes, on a different VirtualBox guest I can mount the device for writing just fine. – Tim Oct 2 '10 at 7:07


Oh, right -- /var/log would be read-only. If only you could edit /etc/syslog.conf you can try logging to a remote host. But then, if you could do that you wouldn't have a problem. Have you had any luck since this was originally posted? – Aaron Copley Oct 19 '10 at 19:35
add a comment |
up vote1down vote
If your are running Ubuntu then try first removing ntfs-3g and then install by running - "aptitude install ntfs-config" This usually fixes it. (The problem is that if you installed some other version of ntfs driver (e.g. additional options og parted) then it does not have write capability.)
share|improve this answer
answered Mar 4 '12 at 3:40

anonyn
111

I must admit that the post about ntfs-3g didn't look like much to me.. But it was accurate enough to lead me to another solution! I just had this same problem after rebooting a working system. In my case, however, I had to unmerge dosfstols. Best wishes to you all! – user204239 Jan 3 '14 at 16:23

[Dec 06, 2012] [ubuntu] Edit fstab from recovery shell - Ubuntu Forums

It's telling you that you can't write, because the filesystem was mounted read-only. Logically, you want to remount it with writes enabled, if you want to write.

mount -o remount,rw <your_root_partition such as /dev/sda#> /

user024

To just give my feedback, I wanted to use the vi editor to change the fstab file but I couldn't, because of the read only problem.

I tried to remount the volume, but there was something wrong about what I did. No luck either to copy my fstab.bak file back to fstab. The read only curse.

So, I tried the following and it actualy worked much better than I hoped: During the GRUB listing I pressed "e" for editing the commands before booting and I changed the "ro" argument for the drive to rw. Then, I pressed ctrl-x to boot.

I expected to confront the same "waiting to mount" error, but I didn't. The system started as normally did.

I sudo gedit-ed the fstab file back to the original with a smile from one ear to another and rebooted.

The GRUB file was back to the original "ro" (read only) argument and I just came to register to the forum to write about it, since I 've read about your solution by my phone.

I should say I am using karmic koala with GRUB 1.97

Idea #18468 Be able to boot into recovery mode and fix malformed -etc-fstab - Ubuntu brainstorm

Idea #18468: Be able to boot into recovery mode and fix malformed /etc/fstab
Written by dcstar the 6 Mar 09 at 03:49. Category: System. Related project: Nothing/Others. Status: New
Rationale

If a user make an error modifying the root filesystem line in their /etc/fstab, they will then always be booted up with the root filesystem in "Read Only" mode so they cannot edit the file and boot normally.

The only repair option now is to boot up using Live CD/Recovery media, then mount the filesystem and then edit the /etc/fstab file (using sudo privileges). This can be a bit much to ask of an inexperienced user.

Tags: boot fstab readonly Recovery

31
votes
33 8 2
Solution #1: Vanilla fstab file

Written by dcstar the 6 Mar 09 at 03:49.

I propose that a "vanilla" or "Install" /etc/fstab file be created at install that is available to be used in the "Recovery" menu that Ubuntu now provides.

This would allow R/W access to the root filesystem so a user could then fix their system without requiring external boot media and the issue of mounting/editing their boot disk.

Root partition mounted read-only on boot

Quote:
Originally Posted by mbreith
You're doing what .
I have two hard drives on the same IDE cable, I just switch the jumper on the hdd's to determine which one is master.

Seems like I have found the problem, I booted up in runlevel 1, when I tried to remount the root partition,


Code:

mount -n -o remount,rw /

I got an error
Code:
Mount Failed: /dev/hda3 (ext3) and /dev/hdb3 (ext3) both have label /
So I disconnect the debian hdd and fedora boots up fine. I find it strange that this happens because my fedora /etc/fstab has no reference to hdb!

Recommended Links

Google matched content

Softpanorama Recommended

Top articles

Sites

Fstab - Community Ubuntu Documentation

Corruption of Fstab and Mtab Files and Available Linux Recovery Solutions



Etc

Society

Groupthink : Two Party System as Polyarchy : Corruption of Regulators : Bureaucracies : Understanding Micromanagers and Control Freaks : Toxic Managers :   Harvard Mafia : Diplomatic Communication : Surviving a Bad Performance Review : Insufficient Retirement Funds as Immanent Problem of Neoliberal Regime : PseudoScience : Who Rules America : Neoliberalism  : The Iron Law of Oligarchy : Libertarian Philosophy

Quotes

War and Peace : Skeptical Finance : John Kenneth Galbraith :Talleyrand : Oscar Wilde : Otto Von Bismarck : Keynes : George Carlin : Skeptics : Propaganda  : SE quotes : Language Design and Programming Quotes : Random IT-related quotesSomerset Maugham : Marcus Aurelius : Kurt Vonnegut : Eric Hoffer : Winston Churchill : Napoleon Bonaparte : Ambrose BierceBernard Shaw : Mark Twain Quotes

Bulletin:

Vol 25, No.12 (December, 2013) Rational Fools vs. Efficient Crooks The efficient markets hypothesis : Political Skeptic Bulletin, 2013 : Unemployment Bulletin, 2010 :  Vol 23, No.10 (October, 2011) An observation about corporate security departments : Slightly Skeptical Euromaydan Chronicles, June 2014 : Greenspan legacy bulletin, 2008 : Vol 25, No.10 (October, 2013) Cryptolocker Trojan (Win32/Crilock.A) : Vol 25, No.08 (August, 2013) Cloud providers as intelligence collection hubs : Financial Humor Bulletin, 2010 : Inequality Bulletin, 2009 : Financial Humor Bulletin, 2008 : Copyleft Problems Bulletin, 2004 : Financial Humor Bulletin, 2011 : Energy Bulletin, 2010 : Malware Protection Bulletin, 2010 : Vol 26, No.1 (January, 2013) Object-Oriented Cult : Political Skeptic Bulletin, 2011 : Vol 23, No.11 (November, 2011) Softpanorama classification of sysadmin horror stories : Vol 25, No.05 (May, 2013) Corporate bullshit as a communication method  : Vol 25, No.06 (June, 2013) A Note on the Relationship of Brooks Law and Conway Law

History:

Fifty glorious years (1950-2000): the triumph of the US computer engineering : Donald Knuth : TAoCP and its Influence of Computer Science : Richard Stallman : Linus Torvalds  : Larry Wall  : John K. Ousterhout : CTSS : Multix OS Unix History : Unix shell history : VI editor : History of pipes concept : Solaris : MS DOSProgramming Languages History : PL/1 : Simula 67 : C : History of GCC developmentScripting Languages : Perl history   : OS History : Mail : DNS : SSH : CPU Instruction Sets : SPARC systems 1987-2006 : Norton Commander : Norton Utilities : Norton Ghost : Frontpage history : Malware Defense History : GNU Screen : OSS early history

Classic books:

The Peter Principle : Parkinson Law : 1984 : The Mythical Man-MonthHow to Solve It by George Polya : The Art of Computer Programming : The Elements of Programming Style : The Unix Hater’s Handbook : The Jargon file : The True Believer : Programming Pearls : The Good Soldier Svejk : The Power Elite

Most popular humor pages:

Manifest of the Softpanorama IT Slacker Society : Ten Commandments of the IT Slackers Society : Computer Humor Collection : BSD Logo Story : The Cuckoo's Egg : IT Slang : C++ Humor : ARE YOU A BBS ADDICT? : The Perl Purity Test : Object oriented programmers of all nations : Financial Humor : Financial Humor Bulletin, 2008 : Financial Humor Bulletin, 2010 : The Most Comprehensive Collection of Editor-related Humor : Programming Language Humor : Goldman Sachs related humor : Greenspan humor : C Humor : Scripting Humor : Real Programmers Humor : Web Humor : GPL-related Humor : OFM Humor : Politically Incorrect Humor : IDS Humor : "Linux Sucks" Humor : Russian Musical Humor : Best Russian Programmer Humor : Microsoft plans to buy Catholic Church : Richard Stallman Related Humor : Admin Humor : Perl-related Humor : Linus Torvalds Related humor : PseudoScience Related Humor : Networking Humor : Shell Humor : Financial Humor Bulletin, 2011 : Financial Humor Bulletin, 2012 : Financial Humor Bulletin, 2013 : Java Humor : Software Engineering Humor : Sun Solaris Related Humor : Education Humor : IBM Humor : Assembler-related Humor : VIM Humor : Computer Viruses Humor : Bright tomorrow is rescheduled to a day after tomorrow : Classic Computer Humor

The Last but not Least Technology is dominated by two types of people: those who understand what they do not manage and those who manage what they do not understand ~Archibald Putt. Ph.D


Copyright © 1996-2021 by Softpanorama Society. www.softpanorama.org was initially created as a service to the (now defunct) UN Sustainable Development Networking Programme (SDNP) without any remuneration. This document is an industrial compilation designed and created exclusively for educational use and is distributed under the Softpanorama Content License. Original materials copyright belong to respective owners. Quotes are made for educational purposes only in compliance with the fair use doctrine.

FAIR USE NOTICE This site contains copyrighted material the use of which has not always been specifically authorized by the copyright owner. We are making such material available to advance understanding of computer science, IT technology, economic, scientific, and social issues. We believe this constitutes a 'fair use' of any such copyrighted material as provided by section 107 of the US Copyright Law according to which such material can be distributed without profit exclusively for research and educational purposes.

This is a Spartan WHYFF (We Help You For Free) site written by people for whom English is not a native language. Grammar and spelling errors should be expected. The site contain some broken links as it develops like a living tree...

You can use PayPal to to buy a cup of coffee for authors of this site

Disclaimer:

The statements, views and opinions presented on this web page are those of the author (or referenced source) and are not endorsed by, nor do they necessarily reflect, the opinions of the Softpanorama society. We do not warrant the correctness of the information provided or its fitness for any purpose. The site uses AdSense so you need to be aware of Google privacy policy. You you do not want to be tracked by Google please disable Javascript for this site. This site is perfectly usable without Javascript.

Last modified: July, 28, 2019