LinuxQuestions.org
Welcome to the most active Linux Forum on the web.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - General
User Name
Password
Linux - General This Linux forum is for general Linux questions and discussion.
If it is Linux Related and doesn't seem to fit in any other forum then this is the place.

Notices


Reply
  Search this Thread
Old 08-07-2005, 06:04 PM   #1
Mil0
LQ Newbie
 
Registered: May 2003
Posts: 10

Rep: Reputation: Disabled
Question 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
 
Old 08-08-2005, 02:57 PM   #2
Matir
LQ Guru
 
Registered: Nov 2004
Location: San Jose, CA
Distribution: Ubuntu
Posts: 8,507

Rep: Reputation: 128Reputation: 128
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.
 
Old 08-09-2005, 05:04 AM   #3
Mil0
LQ Newbie
 
Registered: May 2003
Posts: 10

Original Poster
Rep: Reputation: Disabled
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 ?).
 
Old 08-09-2005, 01:13 PM   #4
Matir
LQ Guru
 
Registered: Nov 2004
Location: San Jose, CA
Distribution: Ubuntu
Posts: 8,507

Rep: Reputation: 128Reputation: 128
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.
 
  


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 On
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
How to rescue partition? (Bad block in disk, reiserfsck stops) gattumarrudu Linux - Hardware 4 06-29-2010 02:47 PM
I have to ssh -l root to run root processes!? paul.nel Red Hat 3 11-15-2004 12:55 PM
Dual boot w/ Gentoo/xp pro vs. gentoo-invalid partition table bobbear Linux - Software 3 02-10-2004 05:28 PM
Can't SSH into Gentoo from win2k breakerfall Linux - Networking 19 09-16-2003 06:04 PM
reiserfsck nautilus_1987 Slackware 1 11-22-2002 12:06 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - General

All times are GMT -5. The time now is 08:55 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