LinuxQuestions.org
Share your knowledge at the LQ Wiki.
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 04-17-2009, 11:28 AM   #1
Completely Clueless
Member
 
Registered: Mar 2008
Location: Marbella, Spain
Distribution: Many and various...
Posts: 814

Rep: Reputation: 69
Question Should I be able to write to a read-only partition??


Hi all,

I've edited fstab to mount my first partition /dev/sda1 read-only at boot-up and a quick "mount" confirms it is indeed so mounted:

/dev/sda1 on / type ext2 (ro)

But I've just discovered I can save documents to the filesystem on it and delete files! I am in root mode, but surely the operating system should still prohibit my doing this and remind me that the filesystem is read-only?? I would have thought I should have had to first execute a remount +r to add write permission but it seems not. Is this normal?

Thanks. cc.

PS: just found I can do the same as an ordinary user, too! :-/

Last edited by Completely Clueless; 04-17-2009 at 11:39 AM.
 
Old 04-17-2009, 12:20 PM   #2
ssaha
Member
 
Registered: Feb 2009
Location: Kolkata,India
Distribution: Fedora 8,Ubuntu 8.04, 8.10, 9.04, 9.10
Posts: 108

Rep: Reputation: 18
try unmounting and mounting the drive again...
 
Old 04-17-2009, 12:26 PM   #3
Completely Clueless
Member
 
Registered: Mar 2008
Location: Marbella, Spain
Distribution: Many and various...
Posts: 814

Original Poster
Rep: Reputation: 69
Quote:
Originally Posted by ssaha View Post
try unmounting and mounting the drive again...
No can do. It's the active partition: "device is busy"
 
Old 04-17-2009, 02:35 PM   #4
farslayer
LQ Guru
 
Registered: Oct 2005
Location: Willoughby, Ohio
Distribution: linuxdebian
Posts: 7,232
Blog Entries: 5

Rep: Reputation: 190Reputation: 190
what does the output of the mount command look like for that partition ?

and maybe

ls -al /dev/sda1
 
Old 04-17-2009, 03:07 PM   #5
Completely Clueless
Member
 
Registered: Mar 2008
Location: Marbella, Spain
Distribution: Many and various...
Posts: 814

Original Poster
Rep: Reputation: 69
Quote:
Originally Posted by farslayer View Post
what does the output of the mount command look like for that partition ?

and maybe

ls -al /dev/sda1
Hi Farslayer,

"Mount" for that partition gives:
/dev/sda1 on / type ext2 (ro)

And the listing you suggested gives:
brw-rw---- 1 root disk 8, 1 Apr 18.15 /dev/sda1

Any clues there?

CC.
 
Old 04-17-2009, 03:48 PM   #6
farslayer
LQ Guru
 
Registered: Oct 2005
Location: Willoughby, Ohio
Distribution: linuxdebian
Posts: 7,232
Blog Entries: 5

Rep: Reputation: 190Reputation: 190
This could be useful. was written for Suse 10.1 so it's not very old..

http://blog.chinaunix.net/u2/78225/showart_1728000.html
 
Old 04-17-2009, 09:44 PM   #7
maresmasb
Member
 
Registered: Apr 2009
Posts: 108

Rep: Reputation: 24
Your mounted device holds the root file sytem. A linux system usually boots in read-only mode to avoid disaster on testing newly built kernels. If everything goes, then it is remounted in rw mode. Obviously the same happens for, unregarded of the puzzling mount diagnostics.

You will have to tweak our custom Linux kernel or simply remount again in read-only mode. Remounting is the same as mounting, but you add the '-remount r' option. Have a try and tell us if it worked.

Last edited by Tinkster; 10-30-2010 at 04:18 PM.
 
Old 04-18-2009, 05:59 AM   #8
Completely Clueless
Member
 
Registered: Mar 2008
Location: Marbella, Spain
Distribution: Many and various...
Posts: 814

Original Poster
Rep: Reputation: 69
Quote:
Originally Posted by maresmasb View Post
You will have to tweak our custom Linux kernel or simply remount again in read-only mode. Remounting is the same as mounting, but you add the '-remount r' option. Have a try and tell us if it worked.
I'm sorry, but time pressures mean I've had to reinstall the original Linpus Lite just for the time being. I note you say "tweak _our_ custom kernel" so I assume you're part of the Ripper Gang? If so, great distro; I'm just gutted that this *one* little failing has meant I have to go back to Lamepus. I await the next release of PCLOS in the hope that this glitch will soon be fixed!

And Farslayer; the BIOS went AGAIN today - just after I reinstalled Lamepus. I've reflashed it, but just hope this isn't going to be a regular occurrence. :-(
 
Old 04-18-2009, 10:31 AM   #9
Completely Clueless
Member
 
Registered: Mar 2008
Location: Marbella, Spain
Distribution: Many and various...
Posts: 814

Original Poster
Rep: Reputation: 69
Well now I've re-installed Linpus on the AAO and this exact same problem is STILL present. I then double checked on my No3 machine which is running PCLOS 2009.1 and the SAME again.

So I'm forming the conclusion that there's something amiss about the line I wrote in fstab which is conflicting or confusing the program from executing correctly. Can someone please post the correct line to place in fstab to require the OS to mount the first hard drive read-only with the other mount options optimised for a single user, good security (suid/nosuid).

Many thanks.

CC
 
Old 04-18-2009, 11:02 AM   #10
AlucardZero
Senior Member
 
Registered: May 2006
Location: USA
Distribution: Debian
Posts: 4,808

Rep: Reputation: 604Reputation: 604Reputation: 604Reputation: 604Reputation: 604Reputation: 604
I don't see your posted fstab line?

something like
Code:
/dev/xvda /     ext3    defaults,noatime,usrquota,errors=remount-ro,ro 0 0
 
Old 04-18-2009, 01:28 PM   #11
Completely Clueless
Member
 
Registered: Mar 2008
Location: Marbella, Spain
Distribution: Many and various...
Posts: 814

Original Poster
Rep: Reputation: 69
Quote:
Originally Posted by AlucardZero View Post
I don't see your posted fstab line?

something like
Code:
/dev/xvda /     ext3    defaults,noatime,usrquota,errors=remount-ro,ro 0 0
It was wiped out during the re-install. I'll give your suggested line a try and get back shortly. I'm not familiar with the "usrquota" option, though. Never encountered that one!
 
Old 04-18-2009, 02:10 PM   #12
AlucardZero
Senior Member
 
Registered: May 2006
Location: USA
Distribution: Debian
Posts: 4,808

Rep: Reputation: 604Reputation: 604Reputation: 604Reputation: 604Reputation: 604Reputation: 604
Don't copy me entirely if you don't know what it does, the important one is the ro option.
 
Old 04-18-2009, 03:51 PM   #13
Completely Clueless
Member
 
Registered: Mar 2008
Location: Marbella, Spain
Distribution: Many and various...
Posts: 814

Original Poster
Rep: Reputation: 69
Quote:
Originally Posted by AlucardZero View Post
Don't copy me entirely if you don't know what it does, the important one is the ro option.
For the sake of compliance, I'm following your line to the letter, since it's explicit, as opposed to the above, which isn't. Incidentally, shouldn't there be a space before the "-ro" and after the "remount"?
 
Old 04-18-2009, 04:03 PM   #14
Completely Clueless
Member
 
Registered: Mar 2008
Location: Marbella, Spain
Distribution: Many and various...
Posts: 814

Original Poster
Rep: Reputation: 69
Okay, I now have entered the stuff as shown, it's confirmed as gone in and retained, yet I'm STILL able to write to the SSD!

I think the best thing is I post the contents of fstab and the output from "mount" in full, and you guys can forward it off to the PTI7 to find out where this grave security breach is taking place. :-)

Seriously, relevant info to follow shortly...
 
Old 04-18-2009, 04:30 PM   #15
Completely Clueless
Member
 
Registered: Mar 2008
Location: Marbella, Spain
Distribution: Many and various...
Posts: 814

Original Poster
Rep: Reputation: 69
/media/sdc1

This is fstab complete:

# Entry for /dev/sda1 :
UUID=dd854c3c-d4cf-4adb-9936-79dbf4e500e6 / ext2 defaults,noatime,usrquota,errors=remount-ro,ro 0 0
none /proc proc defaults 0 0
# Entry for /dev/sda2 :
UUID=eab94120-43b6-4309-b66c-f711556d61ca swap swap defaults 0 0
none /dev/pts devpts mode=0620 0 0


and this is the output from 'mount':

[root@localhost Documents]# mount
/dev/sda1 on / type ext2 (ro,noatime,usrquota,errors=remount-ro)
none on /proc type proc (rw)
none on /dev/pts type devpts (rw,mode=0620)
none on /proc/sys/fs/binfmt_misc type binfmt_misc (rw)
none on /sys/fs/fuse/connections type fusectl (rw)
/dev/sdc1 on /media/disk type vfat (rw,nosuid,nodev,noatime,uhelper=hal,flush,uid=0,utf8,shortname=lower)
[root@localhost Documents]#

note, forget sdc1; it's the usb stick i'm using to transfer the messages over.

As I stated before, despite 'mount' declaring the volume as read-only, I can still write to it (and I don't mean in 'ramdisk' either).
 
  


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
Mounted read-write Fat32 partition suddenly becomes read-only?? hohead Linux - General 8 04-05-2007 01:17 PM
How can I read and write to windows partition dbknox Linux - Newbie 11 02-02-2006 12:21 AM
Read/write to UFS partition digitalhead Linux - General 3 01-24-2006 07:07 AM
How to mount a read write NTFS partition CircuitSix Linux - Hardware 3 12-07-2005 03:21 AM
Read/Write access to a partition? Boggit Linux - Newbie 5 04-04-2004 04:05 PM


All times are GMT -5. The time now is 06:34 AM.

Main Menu
Advertisement
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
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration