Linux - NewbieThis 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!
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
[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.
mount / -o remount,rw
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
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.
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.
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.