[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: Most directories locked read-only: unlocked!



Almut Behrens wrote:
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...

Yes, all the comments were to mark the changes I made. They did not appear in the final version of the script file.

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 changed it back to sh. I discovered that /bin/sh is a link to /bin/bash. I assume that for some (most? all?) scripts bash can be used but the scripts application may be confused if it is called bash rather than sh.

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.

	I should have known.  However, the problem was easily fixed.

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

	It did.

	I then ran the script.  It returned
"EXT3 FS on dm-0, on internal journal".

I then was able to amend /etc/fstab for the root directory mount by fixing the typo. I also removed the "errors=remount-ro" option. Apparently the Debian installer always adds this option to the fstab mount line for the root directory, and no one on the list could enlighten me as to what purpose it serves by being there, In any event, any error in mounting the root directory effectively disables the computer, with consequent difficulty in getting it working it again as I have experienced. I therefore decided that I would be better off without this option.

Finally, thanks for your help in getting me out of my difficulty. I can now get back to other things, such as getting WordPerfect 8.0 to work.

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

				



Reply to: