LinuxQuestions.org
Download your favorite Linux distribution at LQ ISO.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices

Reply
 
Search this Thread
Old 01-04-2013, 01:57 AM   #1
Geoff_L
LQ Newbie
 
Registered: Jan 2013
Posts: 20

Rep: Reputation: Disabled
Read-only filesystem error


[SOLVED - please see my post at the end of the thread for the solution]

I'm trying to set up a compact, command-line only, debian-based virtual machine (VirtualBox OSE) and have plumped for Linux Voyage. After installation, I tried to install Apache and PHP but got the following errors:

W: Not using locking for read only lock file /var/lib/dpkg/lock
E: Unable to write to /var/cache/apt/
E: The package lists or status file could not be parsed or opened.

Doing ls -l /var/lib/dpkg/lock returns
-rw-r----- 1 root root 0 May 18 2012 /var/lib/dpkg/lock

Trying chmod +w /var/lib/dpkg/lock results in:
chmod: changing permissions of '/var/lib/dpkg/lock': Read-only file system

So I checked /etc/fstab and found for the root mount point:
/dev/hda1 / ext2 defaults,noatime,rw 0 0
I thought that the rw option would mean the partition was mounted read-write?! (I'm probably missing something, which is why I've posted this in the Newbie forum)

Trying touch /test.txt results in:
touch: cannot touch '/test.txt': Read-only file system
which confirms that '/' is mounted read-only.

Doing:
mount / -o remount,rw
touch /test.txt
creates the test file with no errors.

All pointers in the right direction gratefully received.

Last edited by Geoff_L; 01-06-2013 at 11:40 PM. Reason: To include pointer to solution
 
Old 01-04-2013, 03:14 AM   #2
syg00
LQ Veteran
 
Registered: Aug 2003
Location: Australia
Distribution: Lots ...
Posts: 12,043

Rep: Reputation: 970Reputation: 970Reputation: 970Reputation: 970Reputation: 970Reputation: 970Reputation: 970Reputation: 970
The mount option will initially mount it rw - but errors may change that. Been so long since I saw an actual ext2 filesystem, let's see what this gives
Code:
tune2fs -l /dev/hda1 | grep -i error
 
Old 01-04-2013, 03:35 AM   #3
Geoff_L
LQ Newbie
 
Registered: Jan 2013
Posts: 20

Original Poster
Rep: Reputation: Disabled
Many thanks for jumping in.

Quote:
Originally Posted by syg00 View Post
The mount option will initially mount it rw - but errors may change that. Been so long since I saw an actual ext2 filesystem, let's see what this gives
Code:
tune2fs -l /dev/hda1 | grep -i error
Errors behavior: Continue

Hope that's what you wanted.
 
Old 01-04-2013, 03:45 AM   #4
syg00
LQ Veteran
 
Registered: Aug 2003
Location: Australia
Distribution: Lots ...
Posts: 12,043

Rep: Reputation: 970Reputation: 970Reputation: 970Reputation: 970Reputation: 970Reputation: 970Reputation: 970Reputation: 970
Not really - I was half expecting (hoping seems inappropriate) for "remount-ro". How about
Code:
tune2fs -l /dev/hda1 | grep -i state
This will be particularly of interest once the filesystem goes read-only.
 
1 members found this post helpful.
Old 01-04-2013, 03:53 AM   #5
Geoff_L
LQ Newbie
 
Registered: Jan 2013
Posts: 20

Original Poster
Rep: Reputation: Disabled
Quote:
Originally Posted by syg00 View Post
Not really - I was half expecting (hoping seems inappropriate) for "remount-ro". How about
Code:
tune2fs -l /dev/hda1 | grep -i state
This will be particularly of interest once the filesystem goes read-only.
Filesystem state: not clean

I'm now wondering whether it might be a good idea to reboot from the live CD and run fsck on /dev/hda1?
 
Old 01-04-2013, 04:10 AM   #6
syg00
LQ Veteran
 
Registered: Aug 2003
Location: Australia
Distribution: Lots ...
Posts: 12,043

Rep: Reputation: 970Reputation: 970Reputation: 970Reputation: 970Reputation: 970Reputation: 970Reputation: 970Reputation: 970
Stop wondering. Do it.
That will fix the filesystem (for now ?) - if there is an underlying problem with the (virtualised) hardware, this will recur. That's a whole 'nuther can of worms.
 
Old 01-04-2013, 04:31 AM   #7
Geoff_L
LQ Newbie
 
Registered: Jan 2013
Posts: 20

Original Poster
Rep: Reputation: Disabled
Many thanks for the continued help.

I ran fsck on /dev/hda1 and, although fsck found no errors and tune2fs still shows Filesystem state: not clean, the filesystem now mounts read/write. Again, thanks.
 
Old 01-04-2013, 07:56 AM   #8
jpollard
Senior Member
 
Registered: Dec 2012
Location: Washington DC area
Distribution: Fedora, CentOS, Slackware
Posts: 1,978

Rep: Reputation: 512Reputation: 512Reputation: 512Reputation: 512Reputation: 512Reputation: 512
Depends on when you run tune2fs... If it is your root disk it will always show "not clean" as it is mounted read/write.

When the system first boots, the init process (the initrd) will mount the root filesystem read only.

If the system detects a problem (ext2 is subject to this), then it will not mount it read/write until you have repaired whatever it thinks is bad. Usually a "fsck -y" will do the trick, sometimes releasing a scratch file that was incompletely deleted or other common things. If fsck can't fix it (files lost, or directories...), then it is up to the administrator to decide what to do interactively. Once finished, another run of fsck should be done to confirm it - then a reboot.

Having root mounted read only during this prevents the system from trying to update the (corrupted) disk image during reboot that fsck may have just repaired.
 
1 members found this post helpful.
Old 01-04-2013, 12:20 PM   #9
Geoff_L
LQ Newbie
 
Registered: Jan 2013
Posts: 20

Original Poster
Rep: Reputation: Disabled
Thanks for the explanation -- much appreciated.

As this VM is a new install, I don't have much invested in it and so can start afresh. I'll investigate whether I can use ext3 or ext4 with Linux Voyage or look for an alternative very lightweight current distro on which to build a basic LAMP server.
 
Old 01-06-2013, 11:39 PM   #10
Geoff_L
LQ Newbie
 
Registered: Jan 2013
Posts: 20

Original Poster
Rep: Reputation: Disabled
The solution identified above turned out to be a fluke and wasn't reproducible when I tried to create a second instance of the same distro (Voyage 0.8). The issue turns out to be because the distro is primarily designed to be used in embedded applications, typically with a CF card rather than a hard drive or SSD and so the system is configured to change the primary drive to read-only once initialisation is complete. To change this so that the drive remains read/write:

1. Log in as root
2. do remountrw
3. edit /etc/init.d/voyage-util by commenting out or removing the line "/usr/local/sbin/remountro" at about line 90. It might also help to comment out the echo command a line or two above this so that you don't see a "remounting / read-only" message just before the login prompt.

I hope this helps others.
 
Old 08-02-2013, 02:46 AM   #11
metrocitydoctor
LQ Newbie
 
Registered: Aug 2013
Posts: 1

Rep: Reputation: Disabled
thanks

just try to fix the same problem with the solution mentioned above. thanks and it is ok to install now.
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
[SOLVED] error: read only filesystem vikky Linux - Newbie 3 11-28-2012 08:26 PM
[SOLVED] crontab -e read-only filesystem error blainemiller Linux - Server 7 03-09-2011 05:32 PM
Read-only filesystem error s_federici Linux - Server 7 09-13-2010 10:30 PM
error mounting ext3 filesystem... mount: /dev/hdd1: can't read superblock versaulis Linux - Software 5 11-26-2006 08:34 PM
my linux error : Couldn't open /dev/null (read-only filesystem) Darick Ang Linux - General 3 10-28-2003 01:27 PM


All times are GMT -5. The time now is 12:30 PM.

Main Menu
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration