LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - General (https://www.linuxquestions.org/questions/linux-general-1/)
-   -   Reiserfsck root partition through SSH (Gentoo) (https://www.linuxquestions.org/questions/linux-general-1/reiserfsck-root-partition-through-ssh-gentoo-350921/)

Mil0 08-07-2005 05:04 PM

Reiserfsck root partition through SSH (Gentoo)
 
I have root access to a Gentoo box (through SSH) which has a corrupt/missing file

/etc/proftpd to be exact

the proftpd package is unmerged (uninstalled) but this "file" is still in the /etc/ dir.

rm'ing the file as root gives an error :
rm: cannot lstat `/etc/proftpd': Permission denied

rebooting the machine changes nothing (and if i recall correctly reiserfs doesn't use fsck at boot the way ext3 does anyway?)

now /etc/ is on my root partition , so running "reiserfsck --fix-fixable" which i ASSUME will fix this, doesn't work (as the partition needs to be unmounted to run reiserfsck ).

normally i would just boot with a liveCD and run reiserfsck on the unmounted root partition, but since i only have SSH access and no fysical access to the pc, this is no option.

now i'm not very up-to-date with the entire linux-runlevel-init-etc. stuff, but i imagine i can make reiserfsck start before the root partition is RW mounted during the boot process ?

does anyone here happen to know if this can be done ?
and ifso, where to do this.

any help is really appreciated

Matir 08-08-2005 01:57 PM

You'd have to make sure it runs in a mode that doesn't require human interaction, or it will be stuck. :)

First off though, I encourage you to run 'lsattr /etc/protftpd'. Reiserfs has recently had support for e2fs-style attributes, so I wonder if the 'immutable' attribute got turned on somehow.

Mil0 08-09-2005 04:04 AM

Quote:

First off though, I encourage you to run 'lsattr /etc/protftpd'. Reiserfs has recently had support for e2fs-style attributes, so I wonder if the 'immutable' attribute got turned on somehow.
Seems to have the same problem as RM does. the file "doesnt exist" but does show up.
i can't recreate it nor remove it. i guess reiserfsck --fix-fixable is the best option.

server / # whoami
root
server / # pwd
/
server / # rm -f /etc/proftpd
rm: cannot remove `/etc/proftpd': Permission denied
server / # lsattr /etc/proftpd
lsattr: Permission denied while trying to stat /etc/proftpd
server / # find /etc/ -name foobar
find: /etc/proftpd: Permission denied
server / # mkdir /etc/proftpd
mkdir: cannot create directory `/etc/proftpd': Permission denied
server / # touch /etc/proftpd
touch: cannot touch `/etc/proftpd': Permission denied
server / # reiserfsck --fix-fixable -y /dev/hda3
reiserfsck 3.6.19 (2003 www.namesys.com)
[...]
Will check consistency of the filesystem on /dev/hda3
and will fix what can be fixed without --rebuild-tree
Will put log info to 'stdout'
###########
reiserfsck --fix-fixable started at Tue Aug 9 10:45:14 2005
###########
Partition /dev/hda3 is mounted with write permissions, cannot check it
server / #



I noticed there was a script named "/etc/runlevels/boot/checkfs", which (according to gentoo's rc-status application) is ran everytime the system boots.

i added the line "reiserfsck --yes --fix-fixable /dev/hda3" in this script (as first line in the "start" function) but that doesn't seem to help (perhaps it didn't run at the right time ?)
along with this line i also added an "echo REISERFS_FIX" line, which i now can't find in /var/log/messages (does this mean it didn't run ?).

Matir 08-09-2005 12:13 PM

Not all init script echos get logged in messages, I don't think. Especially those that occur before filesystem mounting ;)

Try this:
Boot into a very limited mode (if you were at it physically, I would say single user mode). If many people log into this machine, touch /etc/nologin (BUT DELETE IT LATER, before rebooting).

Now:
Code:

mount -o remount,ro /
reiserfsck --fix-fixable -y /dev/hda3

You'll have a read-only root filesystem for a bit, but you should be able to fsck it then.


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