The time now is Thu 20 Jun 2013, 07:12
All times are UTC - 4 |
| Author |
Message |
PaulBx1
Joined: 16 Jun 2006 Posts: 2308 Location: Wyoming, USA
|
Posted: Sat 02 May 2009, 19:37 Post subject:
How to manually fsck an encrypted pupsave |
|
As of Puppy 4.1.2, "puppy pfix=fsck" does not work. This is a manual alternative:
Boot "puppy pfix=ram"
In a console window, mount the volume containing your pupsave. Then "cd" there.
modprobe cryptoloop
modprobe aes
losetup-FULL -e aes /dev/loop6 pup_save_crypta.2fs
e2fsck /dev/loop6
This procedure assumes heavy encryption and will need modification for light encryption (perhaps someone else can contribute that recipe). It also assumes your pupsave is named "pup_save_crypta.2fs", of course.
|
|
Back to top
|
|
 |
vtpup

Joined: 15 Oct 2008 Posts: 1077 Location: Republic of Vermont
|
Posted: Tue 30 Jun 2009, 23:35 Post subject:
|
|
I need assistance here for the commands needed to do an fsck on a light encrypted pup save -- anyone?
|
|
Back to top
|
|
 |
MU

Joined: 24 Aug 2005 Posts: 13642 Location: Karlsruhe, Germany
|
Posted: Wed 01 Jul 2009, 00:07 Post subject:
|
|
I'm in hurry, so just a quick guess:
losetup-FULL -e xor /dev/loop6 pup_save_crypta.2fs
e2fsck /dev/loop6
http://noforum.de/man2html.php?page=losetup
Mark
_________________ my recommended links
|
|
Back to top
|
|
 |
Pizzasgood

Joined: 04 May 2005 Posts: 6270 Location: Knoxville, TN, USA
|
Posted: Wed 01 Jul 2009, 00:15 Post subject:
|
|
According to the comments in the scripts in Puppy 4.2, that xor is a different one from the xor used for the encryption. According to the scripts it works like this:
| Code: | modprobe cryptoloop
losetup-FULL -E 1 /dev/loop6 pup_save_cryptx.2fs
e2fsck /dev/loop6 |
I don't have one handy to test with though.
Also, if you have a bunch of filesystem images mounted, /dev/loop6 might already be in use. Running losetup-FULL -f will tell you the name of a free loopback device. And if you screw up while doing this, the loopback device you use might be left in-use. In that case, you can free it with losetup-FULL -d /dev/loop6
Just doing losetup-FULL /dev/loop6 will tell you information about the device.
REFERENCE: 683-687 of init from initrd.gz of Puppy 4.2.1:
| Code: | case $PUPSAVEFILE in
*cryptx*) #see /etc/rc.d/rc.shutdown.
CRYPTO='-E 1' #v2.16final '-e xor' --bug, loads xor.ko which is something else.
modprobe cryptoloop
;; |
EDITED 2009.07.05: Changed 'losetup' to 'losetup-FULL' because it's more reliable across multiple versions of Puppy.
_________________ Between depriving a man of one hour from his life and depriving him of his life there exists only a difference of degree. --Muad'Dib

Last edited by Pizzasgood on Sun 05 Jul 2009, 15:22; edited 2 times in total
|
|
Back to top
|
|
 |
vtpup

Joined: 15 Oct 2008 Posts: 1077 Location: Republic of Vermont
|
Posted: Wed 01 Jul 2009, 09:40 Post subject:
|
|
Thanks Mu and pizzasgood-
I'm using 4.1.2, not 4.2 -- but that didn't make a difference, pizzasgood solution worked.
I did try Mu's suggetsion first but I got an error message after entering the password. Thanks Mu for giving it a shot that quickly!
Thanks pizzasgood once again for the massive amount of help you give people here.
To clarify for others the steps that worked for me:
In my case my savefile was on sda6/puppy412/ and was named pup_save_cryptx.2fs, change that if your setup is different (marked in blue below). So:
1.) Boot puppy CD w/ puppy pfix=ram option
2.) Mount sda6
3.) open terminal
4.) type and enter modprobe cryptoloop
5.) type and enter losetup -E 1 /dev/loop6 /mnt/sda6/puppy412/pup_save_cryptx.2fs
6.) answer the password prompt
7.) type and enter e2fsck /dev/loop6
8.) you may be asked if you want to correct specific problems -- I answered yes to all, however it's possible not to if you feel something shouldn't be changed.
Thanks once again Pizzasgood, Mu, and PaulBx1 for this. You guys are great!
Makes me wonder if there's a simple bugfix in 4.1.2's code so that you can do an fsck as you are supposed to at the bootup password prompt. Functionality is supposed to be: hit ENTER instead of password, then in answer to the red prompt, hit any other letter.
I'd really like to do a routine fsck every month or so using the normal bootup method.
|
|
Back to top
|
|
 |
Pizzasgood

Joined: 04 May 2005 Posts: 6270 Location: Knoxville, TN, USA
|
Posted: Wed 01 Jul 2009, 20:59 Post subject:
|
|
I'll take a look later tonight and see if it's still a problem in 4.2.1. If it isn't, I can throw together a 4.1.2 frugal really quick and test with that. Can't be too hard to fix.
_________________ Between depriving a man of one hour from his life and depriving him of his life there exists only a difference of degree. --Muad'Dib

|
|
Back to top
|
|
 |
heaths
Joined: 01 Jul 2009 Posts: 1
|
Posted: Wed 01 Jul 2009, 21:45 Post subject:
|
|
Hi thanks for your replies
simulationcredit
|
|
Back to top
|
|
 |
Pizzasgood

Joined: 04 May 2005 Posts: 6270 Location: Knoxville, TN, USA
|
Posted: Wed 01 Jul 2009, 23:51 Post subject:
|
|
Well, in the init script from 4.2.1 I found this at lines 742-753:
| Code: | losetup $CRYPTO /dev/loop1 /mnt/dev_save$PUPSAVEFILE
fi
fi
echo "/dev/loop1 $CREATEPUPSAVE2FS ext2 defaults 1 1" >> /etc/fstab #v2.21
#fsck_func loop1 ext2 $PUPSAVEFILE #v3.01. no, removed, takes ages, and won't mount afterward.
mount -t ext2 -o noatime,rw /dev/loop1 $CREATEPUPSAVE2FS
MNTSTAT=$?
if [ "$MNTSTAT" = "0" ] ; then
echo -n "...successfully mounted" >/dev/console
break
else | The line we're interested in is 747:
#fsck_func loop1 ext2 $PUPSAVEFILE #v3.01. no, removed, takes ages, and won't mount afterward.
The fsck_func function automatically checks whether the pfix=fsck option has been given, and immediately returns unless it has. Otherwise it runs a scan. Except that this line was commented out, apparently because it wasn't working properly in 3.01. I'm not sure what that was about. I remember that there some issues with encryption back around that time, so maybe it was some 3.01 specific problem.
Anyways, I uncommented that line, rebuilt my initrd.gz file, and rebooted with pfix=fsck. As far as I can tell it worked. I got a message saying it was checking the file, and then after a short pause things continued as usual. After booting I looked in /initrd/tmp/ and found the file chret, which is where the fsck_func function stores the output from e2fsck. It listed a number of issues that it fixed automatically. Nothing seemed out of order.
I'm not going to post a bunch of initrd.gz files for the different versions of Puppy 4.x because I probably should have gone to bed half an hour ago. If anybody needs them and isn't willing to do it themselves, let me know and I can make them another night. But it's only a minor change to init - extract the initrd.gz file, open the 'init' script as text, and uncomment that line. It's line 747 in 4.2.1, but it will be at other places in other Puppies. Just paste the line into the find bar and it will come up. After uncommenting it (simply remove the #) rebuild and replace the initrd.gz file.
For those who need instructions on editing initrd.gz: How to edit initrd.gz (for Puppy 3.x and newer)
_________________ Between depriving a man of one hour from his life and depriving him of his life there exists only a difference of degree. --Muad'Dib

|
|
Back to top
|
|
 |
vtpup

Joined: 15 Oct 2008 Posts: 1077 Location: Republic of Vermont
|
Posted: Sun 05 Jul 2009, 10:27 Post subject:
|
|
Thanks for that Pizzasgood, I will try it later tonight.
I'm wondering if the reason for long delay, and/or reason it wouldn't mount is that the fsck process is throwing a Y/N question for the user, but possibly the user doesn't see or answer it? Maybe a subsequent silent abort leaves things mixed up. I don't know just throwing out a possibility since the code I used earlier definitely requires sitting by the keyboard. I had to hold down the Y key for autorepeat to get through all of the Y/N queries. Guess I had a lot of errors.
Is the fsck in initrd set to auto-fix errors, or does it still query?
Thanks again, and happy 4th of july (assuming you're in the states)!
|
|
Back to top
|
|
 |
Pizzasgood

Joined: 04 May 2005 Posts: 6270 Location: Knoxville, TN, USA
|
Posted: Sun 05 Jul 2009, 15:28 Post subject:
|
|
This is the code for fsk_func in Puppy 4.2.1 (Lines 56-85 of init):
| Code: | #v3.01 fsck for ext2/3 prior to mounting...
fsck_func() { #passed params: partition filesystem [filename]
[ "$PFSCK" != "yes" ] && return 0 #v404 default is not do any checking.
#v3.93 restrict to ext2 only...
#[ "$2" != "ext2" -a "$2" != "ext3" ] && return 0 #precaution.
[ "$2" != "ext2" ] && return 0 #precaution.
CHKDEV=$1
#[ $3 ] && CHKDEV="`basename $3`"
e2fsck -y /dev/$1 >/tmp/chkret &
#sleep 1
#if [ "`grep ': clean, ' /tmp/chkret`" = "" ];then
# echo -e "\\033[1;35m" >/dev/console #35=purple
# echo -n "Performing filesystem check on ${CHKDEV}, please wait" >/dev/console
# echo -en "\\033[0;39m" >/dev/console
#fi
echo -en "\\033[1;35m" >/dev/console #35=purple
MSGFSCK=" ${1} filesystem check, please wait..............."
MSGFSCNT=1
while [ "`pidof e2fsck`" != "" ];do
if [ "${1}" = "loop1" ];then
[ $MSGFSCNT -eq 1 ] && echo -n "filesystem check..." >/dev/console
else
[ $MSGFSCNT -lt 47 ] && MSGCHAR="`echo -n "$MSGFSCK" | cut -b $MSGFSCNT`"
echo -n "$MSGCHAR" >/dev/console
fi
sleep 1
MSGFSCNT=`expr $MSGFSCNT + 1`
done
echo -en "\\033[0;39m" >/dev/console
} |
In particular, line 64:
e2fsck -y /dev/$1 >/tmp/chkret &
So it's assuming yes, at least in 4.2.1.
Yeah, I'm in TN right now, in a house sticking off the side of some mountain (Mom just moved here three weeks ago). Went to see Transformers yesterday, and played some Nethack. Then I forgot which day it was and thought the neighbors were shooting at something for a couple moments before I realized it was just fireworks.
_________________ Between depriving a man of one hour from his life and depriving him of his life there exists only a difference of degree. --Muad'Dib

|
|
Back to top
|
|
 |
vtpup

Joined: 15 Oct 2008 Posts: 1077 Location: Republic of Vermont
|
Posted: Wed 07 Oct 2009, 13:47 Post subject:
|
|
| Pizzasgood wrote: | .... It's line 747 in 4.2.1, but it will be at other places in other Puppies. Just paste the line into the find bar and it will come up. After uncommenting it (simply remove the #) rebuild and replace the initrd.gz file.
For those who need instructions on editing initrd.gz: How to edit initrd.gz (for Puppy 3.x and newer) |
It's Line #726 in Puppy 4.1.2, for anyone interested.
Man the 4th of july came and went, along with 3 more months. Sorry about the slow reply. On a mountain myself hanging off it in a cabin.
|
|
Back to top
|
|
 |
stiginge

Joined: 22 Mar 2007 Posts: 419 Location: Kerry, Ireland
|
Posted: Thu 06 Oct 2011, 09:04 Post subject:
|
|
Hi Paul BX, I've had trouble with my heavy encrypted savefile, documented here:
http://www.murga-linux.com/puppy/viewtopic.php?t=72236
I used the code you provided above but it doesn't seem to work due to some block issue, have you seen this before?
_________________ Buy silver, crash JPMorgan
|
|
Back to top
|
|
 |
|
|
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum You cannot attach files in this forum You can download files in this forum
|
Powered by phpBB © 2001, 2005 phpBB Group
|