Re: Most directories locked read-only: how to unlock them?

2006-01-20 Thread Ken Heard

Miquel van Smoorenburg wrote:

In article <[EMAIL PROTECTED]>,
Ken Heard  <[EMAIL PROTECTED]> wrote:


Daniel B. wrote:



That looks like you mistyped "defaults" as "drfaults" in your
/etc/fstab file.


	I was well aware that I mistyped "defaults" as my original post 
indicated.  I was also aware that this error caused the root directory 
to be mounted read-only.  Also as my original post indicated, my first 
query was how to change the mount to read-write without having to 
reinstall the whole operating system.



Simply specify both the directory _and_ the device on the command
line, in that case mount doesn't read fstab.

Eg something like:

mount -n -o remount,rw /dev/sda1 /


	Yes, but mount reads mtab.  Mtab showed / as already mounted; 
consequently  the mount command failed.  I had to use the script file 
furnished by Almut Behrens in his post to the list of 2006-01-17 05:41 UTC

--
Ken Heard
Research Associate
Museum Studies Program
University of Toronto, Canada




--
To UNSUBSCRIBE, email to [EMAIL PROTECTED] 
with a subject of "unsubscribe". Trouble? Contact [EMAIL PROTECTED]




Re: Most directories locked read-only: how to unlock them?

2006-01-20 Thread Miquel van Smoorenburg
In article <[EMAIL PROTECTED]>,
Ken Heard  <[EMAIL PROTECTED]> wrote:
>Daniel B. wrote:
>
>> That looks like you mistyped "defaults" as "drfaults" in your
>> /etc/fstab file.
>
>   I was well aware that I mistyped "defaults" as my original post 
>indicated.  I was also aware that this error caused the root directory 
>to be mounted read-only.  Also as my original post indicated, my first 
>query was how to change the mount to read-write without having to 
>reinstall the whole operating system.

Simply specify both the directory _and_ the device on the command
line, in that case mount doesn't read fstab.

Eg something like:

mount -n -o remount,rw /dev/sda1 /

Mike.
-- 
Freedom is no longer a problem.


-- 
To UNSUBSCRIBE, email to [EMAIL PROTECTED] 
with a subject of "unsubscribe". Trouble? Contact [EMAIL PROTECTED]



Re: Most directories locked read-only: how to unlock them?

2006-01-18 Thread Almut Behrens
On Wed, Jan 18, 2006 at 05:56:31PM -0500, Ken Heard wrote:
> Almut Behrens wrote:
> 
> >Copy /etc/fstab to /tmp/fstab and fix your "drfaults" typo in there.
> 
>   I copied /etc/fstab to /var/fstab and fixed the typ.
> 
> >Then patch a temporary copy of /bin/mount and libc.so to use /tmp/fstab
> >instead of /etc/fstab.  To do so, create this little script, make it
> >executable, and run it as root:
> 
>   Because I used /var instead of /tmp I modified your script as 
>   follows:
> 
> >#!/bin/bash  #You suggested /bin/sh
> >
> >FSTAB=/var/fstab # var changed from tmp
> >LIBC=/lib/libc.so.6
> >
> >perl -pe "s|/etc/fstab|$FSTAB|g" $LIBC >/var/libc.so.6   # var changed 
> >from tmp
> >perl -pe "s|/etc/fstab|$FSTAB|g" /bin/mount >/var/mount  # ditto
> >chmod +x /var/mount  # ditto
> >export LD_PRELOAD=/var/libc.so.6 # ditto
> >/var/mount -n -o remount,rw /

The modifications look okay.
(Just make sure there's nothing after the "#!/bin/bash" in the first
line -- though I presume you've appended that comment just in this
post here...  BTW, just FYI, /bin/sh and /bin/bash should both work, as
(on linux) /bin/sh is just a link to /bin/bash, i.e. they're the same
program.  The only difference is that if bash is called as "sh" it
mimics the behavior of a regular bourne shell.  This shouldn't matter
here, though, as there's nothing bash-specific in the script...)

> 
>   I saved this script as /var/fixfstab, made it executable and -- as 
>   root and in /var -- ran ./fixfstab.  The following was returned:
> 
> : bad interpreter:  No such file or directory

Typically, you'd get this error, if you create the file on Windows
and then copy it over to linux.  The problem is the different line
ending conventions (\n on Linux, and \r\n on Windows), which is not
always immediately evident -- unless you already know what to look for.
Due to this, there'd be a trailing \r at the end of the interpreter
name, i.e. the system is trying to find a program "/bin/bash\r", which
of course doesn't exist...

To check, you could do a "less -u /var/fixfstab"; if you have the above
problem, you'd see ^M (= \r = carriage return) at the end of the lines.

To fix it, run the following command

  perl -i -pe 's/\r//g' /var/fixfstab

and then try again... (and, if it still doesn't work, report back here).

Almut


-- 
To UNSUBSCRIBE, email to [EMAIL PROTECTED] 
with a subject of "unsubscribe". Trouble? Contact [EMAIL PROTECTED]



Re: Most directories locked read-only: how to unlock them?

2006-01-18 Thread Ken Heard

Mike McCarty wrote:


I think the easiest would be


 to use a LiveCD, like KNOPPIX,

and edit the fstab that way.


	That is impossible for the reasons stated in my post of 2006-01-16 
19:42 EST.


--
Ken Heard
Research Associate
Museum Studies Program
University of Toronto, Canada




--
To UNSUBSCRIBE, email to [EMAIL PROTECTED] 
with a subject of "unsubscribe". Trouble? Contact [EMAIL PROTECTED]




Re: Most directories locked read-only: how to unlock them?

2006-01-18 Thread Ken Heard

Almut Behrens wrote:


Copy /etc/fstab to /tmp/fstab and fix your "drfaults" typo in there.


I copied /etc/fstab to /var/fstab and fixed the typ.


Then patch a temporary copy of /bin/mount and libc.so to use /tmp/fstab
instead of /etc/fstab.  To do so, create this little script, make it
executable, and run it as root:


Because I used /var instead of /tmp I modified your script as follows:


#!/bin/bash #You suggested /bin/sh

FSTAB=/var/fstab# var changed from tmp
LIBC=/lib/libc.so.6

perl -pe "s|/etc/fstab|$FSTAB|g" $LIBC >/var/libc.so.6 # var changed from 
tmp
perl -pe "s|/etc/fstab|$FSTAB|g" /bin/mount >/var/mount# ditto
chmod +x /var/mount # ditto
export LD_PRELOAD=/var/libc.so.6# ditto
/var/mount -n -o remount,rw /


	I saved this script as /var/fixfstab, made it executable and -- as root 
and in /var -- ran ./fixfstab.  The following was returned:


: bad interpreter:  No such file or directory

	By running find I discovered that /lib/libc.so.6 is linked to 
/lib/libc-2.3.2.so.


	Then tried to read the variables to be created by the script: $FSTAB 
and $LIBC.  Both returned nul.  I next entered the FSTAB variable 
directly (FSTAB=/var/fstab) and then ran $FSTAB, which returned


-bash: /var/fstab: permission denied.

	That message confused me, as I have been working as root all along and 
both fstab and fixfstab are both root files.  Fstab is rw, and  fixstab 
is rwx.


	Is this information helpful in figuring why the script does not work? 
I understand what the script is supposed to do, but I have no knowldege 
of perl.



--
Ken Heard




--
To UNSUBSCRIBE, email to [EMAIL PROTECTED] 
with a subject of "unsubscribe". Trouble? Contact [EMAIL PROTECTED]




Re: Most directories locked read-only: how to unlock them?

2006-01-17 Thread John Hasler
Mike writes:
> I think the easiest would be to use a LiveCD, like KNOPPIX, and edit the
> fstab that way.

Just remount the partition.  man mount
-- 
John Hasler


-- 
To UNSUBSCRIBE, email to [EMAIL PROTECTED] 
with a subject of "unsubscribe". Trouble? Contact [EMAIL PROTECTED]



Re: Most directories locked read-only: how to unlock them?

2006-01-17 Thread Mike McCarty

Ken Heard wrote:

Daniel B. wrote:


That looks like you mistyped "defaults" as "drfaults" in your
/etc/fstab file.



I was well aware that I mistyped "defaults" as my original post 
indicated.  I was also aware that this error caused the root directory 
to be mounted read-only.  Also as my original post indicated, my first 
query was how to change the mount to read-write without having to 
reinstall the whole operating system.


Regards,


I think the easiest would be to use a LiveCD, like KNOPPIX,
and edit the fstab that way.

Mike
--
p="p=%c%s%c;main(){printf(p,34,p,34);}";main(){printf(p,34,p,34);}
This message made from 100% recycled bits.
You have found the bank of Larn.
I can explain it for you, but I can't understand it for you.
I speak only for myself, and I am unanimous in that!


--
To UNSUBSCRIBE, email to [EMAIL PROTECTED] 
with a subject of "unsubscribe". Trouble? Contact [EMAIL PROTECTED]




Re: Most directories locked read-only: how to unlock them?

2006-01-17 Thread Ken Heard

Daniel B. wrote:


That looks like you mistyped "defaults" as "drfaults" in your
/etc/fstab file.


	I was well aware that I mistyped "defaults" as my original post 
indicated.  I was also aware that this error caused the root directory 
to be mounted read-only.  Also as my original post indicated, my first 
query was how to change the mount to read-write without having to 
reinstall the whole operating system.


Regards,
--
Ken Heard




--
To UNSUBSCRIBE, email to [EMAIL PROTECTED] 
with a subject of "unsubscribe". Trouble? Contact [EMAIL PROTECTED]




Re: Most directories locked read-only: how to unlock them?

2006-01-17 Thread Daniel B.

Ken Heard wrote:

...
I first tried Steve Kemp's suggestion, because it was the simpler, 
as it did not require use of a live CDROM.  He warned me that the 
command "mount -n -o remount,rw /" might not work.  It didn't.  It returned


EXT3-fs: Unrecognized mount option "drfaults" or missing value
mount: / not mounted already, or bad option


That looks like you mistyped "defaults" as "drfaults" in your
/etc/fstab file.

Daniel





--
To UNSUBSCRIBE, email to [EMAIL PROTECTED] 
with a subject of "unsubscribe". Trouble? Contact [EMAIL PROTECTED]




Re: Most directories locked read-only: how to unlock them?

2006-01-16 Thread Almut Behrens
On Mon, Jan 16, 2006 at 07:42:38PM -0500, Ken Heard wrote:
>   Thanks to Stural Holm Hansen and Steve Kemp for answering my post. 
> Unfortunately I my problem is still not solved.
> 
>   I first tried Steve Kemp's suggestion, because it was the simpler, 
>   as it did not require use of a live CDROM.  He warned me that the 
> command 
> "mount -n -o remount,rw /" might not work.  It didn't.  It returned
> 
>   EXT3-fs: Unrecognized mount option "drfaults" or missing value
> mount: / not mounted already, or bad option
> 
>I then ran "mount -n -o remount,defaults,rw /" and "mount -n -o 
> defaults,rw /".  The first command returned the same result as above. 
> The second returned:
> 
> mount: /dev/mapper/SOL-root is already mounted or / busy
> mount: according to mtab, /dev/mapper/SOL-root is already 
> mounted on /

If all else fails, you could try the following approach:

Copy /etc/fstab to /tmp/fstab and fix your "drfaults" typo in there. 
Then patch a temporary copy of /bin/mount and libc.so to use /tmp/fstab
instead of /etc/fstab.  To do so, create this little script, make it
executable, and run it as root:

#!/bin/sh

FSTAB=/tmp/fstab
LIBC=/lib/libc.so.6

perl -pe "s|/etc/fstab|$FSTAB|g" $LIBC >/tmp/libc.so.6
perl -pe "s|/etc/fstab|$FSTAB|g" /bin/mount >/tmp/mount
chmod +x /tmp/mount
export LD_PRELOAD=/tmp/libc.so.6
/tmp/mount -n -o remount,rw /


(I'm assuming you can still write in /tmp -- if not, you could of
course also use some other writable location, but make sure the length
of the string you then use in place of "/tmp/fstab" always is exactly
10 characters long.)

Use at your own risk!

Almut


-- 
To UNSUBSCRIBE, email to [EMAIL PROTECTED] 
with a subject of "unsubscribe". Trouble? Contact [EMAIL PROTECTED]



Re: Most directories locked read-only: how to unlock them?

2006-01-16 Thread Ken Heard
	Thanks to Stural Holm Hansen and Steve Kemp for answering my post. 
Unfortunately I my problem is still not solved.


	I first tried Steve Kemp's suggestion, because it was the simpler, as 
it did not require use of a live CDROM.  He warned me that the command 
"mount -n -o remount,rw /" might not work.  It didn't.  It returned


EXT3-fs: Unrecognized mount option "drfaults" or missing value
mount: / not mounted already, or bad option

   I then ran "mount -n -o remount,defaults,rw /" and "mount -n -o 
defaults,rw /".  The first command returned the same result as above. 
The second returned:


mount: /dev/mapper/SOL-root is already mounted or / busy
mount: according to mtab, /dev/mapper/SOL-root is already 
mounted on /


	So, my next step was to try Sturla Holm Hansen's suggestion: to boot 
from a live disk, mount somewhere my original /etc/ and then edit 
fstab.	The only live CDROM I had was Knoppix.  First I let Knoppix 
install itself without my intervention. It installed KDE Konqueror but 
did not configure the mouse; so it was useless.


	On the second attempt I chose the "Knoppix 2" option, which did not 
install the X-window-system, and left the machine in terminal mode.


	My next task was to mount my original root directory on hda.  That 
Knoppix would not do.


	As I explained in my original post, my root directory is mounted on LVM 
logical volume named /dev/mapper/SOL-root.  When I ran "mount -n -t ext3 
-o defaults /dev/mapper/SOL-root /", the command returned  "mount: 
special device /dev/mapper/SOL-root" does not exist.


	It next occurred to me to install the LVM2 package in the hopes that 
with it Knoppix would recognize the LVM logical volumes. However Knoppix 
stopped the installation, saying "Processing was halted because there 
were too many errors."


	I now know that Knoppix is useless for my purposes.  Since earlier it 
would not even configure a standard PS-2 two button mouse, I  really 
wonder whether Knoppix has any use.


So I am back to my two original question groups, with a third one added:

1.  Is there any way I can override the read-only restriction for the 
root directory and so amend the fstab file accordingly, or do I have to 
reinstall the whole OS?


2.  Why the hell did the installer put the "errors=remount-ro in the
options for mounting the root directory in the first place?  What
purpose is it supposed to serve?  Would any damage be done if -- once I
am able to amend the fstab file -- if I removed it entirely?

3.  Will any other live installation do for me what Knoppix would not, 
e.g., Ubuntu?


	Perhaps if I had a live rescue disk made from the Debian bootcd package 
which would be based on my own installation, I could mount a LVM logical 
volume.  However,I can't make one unless I install the package, and I 
can't install the package with essential directories read only.  It 
would be useful if the Debian installation manual mentioned the 
advisability of having a live bootcd and provided instructions as to how 
to make one.


Anyone have any ideas or suggestions?

 Regards,

--
Ken Heard




--
To UNSUBSCRIBE, email to [EMAIL PROTECTED] 
with a subject of "unsubscribe". Trouble? Contact [EMAIL PROTECTED]




Re: Most directories locked read-only: how to unlock them?

2006-01-14 Thread Steve Kemp
On Sat, Jan 14, 2006 at 04:36:37PM -0500, Ken Heard wrote:

> I allowed my box to get into a situation where the root directory (/),
> and all the subdirectories on it -- except /boot, /home, /tmp, /usr,
> /var, /media and swap -- are locked read-only.  Since I cannot write to
> the root directory -- or to /bin, /dev, /etc, /initrd, /lib, /opt, /sbin
> and /srv -- I have very effectively rendered the box unuseable.

  It might not work, but maybe this will help:

mount -n -o remount,rw /

Steve
-- 
Debian GNU/Linux System Administration
http://www.debian-administration.org/


-- 
To UNSUBSCRIBE, email to [EMAIL PROTECTED] 
with a subject of "unsubscribe". Trouble? Contact [EMAIL PROTECTED]



Re: Most directories locked read-only: how to unlock them?

2006-01-14 Thread Sturla Holm Hansen

Ken Heard skrev:


I allowed my box to get into a situation where the root directory (/),
and all the subdirectories on it -- except /boot, /home, /tmp, /usr,
/var, /media and swap -- are locked read-only.  Since I cannot write to
the root directory -- or to /bin, /dev, /etc, /initrd, /lib, /opt, /sbin
and /srv -- I have very effectively rendered the box unuseable.

I will now explain how this situation came about in the hope that some
one can suggest how I can remedy this situation without having to
install the entire OS, which is Sarge with the 2.6.8-2-386 kernel, all 
over again.


When I installed the OS earlier this week, I divided the 80 gb hda into
three partitions.  The /dev/hda1 has 100 mb for /boot.  The /dev/hda2 
has 1 gb for swap.  The rest of the drive, /dev/hda3, I made into a 
LVM physical volume.


I divided this LVM physical volume into five logical volumes: root 
(/), /home, /tmp, /usr and /var.  When as part of the initial 
installation I was setting these up, the installer asked me for the 
options to add to the /etc/fstab file.  I all five cases I dutifully 
added "noatime", but forgot to add "defaults".


When I discovered my error, I opened the fstab file to add "defaults". 
However, in adding it to the root (/) directory I mistyped it, 
entering "drfaults" instead.  The next time I booted the machine, I 
was told that there was an error in mounting the root directory  
because "drfaults" was not recognized.


At this point it would have been possible to edit the fstab file to 
correct the error but for one thing.  On installation the installer 
gratuitously added another option to the root (/) mount line, but not 
to the mount lines of the other four logical partitions: 
"errors=remount-ro".


I did not think anything of this option then, but now I wished I had, 
because the effect of it was to lock the root directories and all the 
subdirectories not mounted elsewhere as read only.


I tried to find a way to amend the fstab file, but could not, because 
it was now read-only.  I tried to dismount it, but mount would not let 
me do so, because the mtab file told me that it was already mounted or 
the directory was busy.  I rebooted in recovery mode but got the same 
result.


So, I now have the following questions:

1.  Is there any way I can override the read-only for the root 
directory and so amend the fstab file accordingly, or do I have to 
reinstall the whole OS?


2.  Why the hell did the installer put the "errors=remount-ro in the 
options for mounting the root directory in the first place?  What 
purpose is it supposed to serve?  Would any damage be done if -- once 
I am able to amend the fstab file -- if I removed it entirely?


Regards,


Boot the computer with a live-cd or rescue-cd, mount the root-partition 
and edit fstab...

Don't know the reason for the "errors=remount-ro" option though...


--
To UNSUBSCRIBE, email to [EMAIL PROTECTED] 
with a subject of "unsubscribe". Trouble? Contact [EMAIL PROTECTED]