Empty save file causes kernel panic (Solved)

Using applications, configuring, problems
Message
Author
User avatar
Ghost Dog
Posts: 163
Joined: Fri 27 Jan 2012, 04:29

Empty save file causes kernel panic (Solved)

#1 Post by Ghost Dog »

Hello!

I want to make a usb stick for somebody pre-loaded with Puppy, but the person is a little dense, so I don't want him to have to make his own save file. So I created an empty one with this command:

dd if=/dev/zero of=puppy_save.4fs bs=1M count=1024
yes y | mkfs.ext4 puppy_save.4fs
sync

But when the usb stick boots, it gives "kernel panic".
Last edited by Ghost Dog on Mon 12 Aug 2013, 06:28, edited 3 times in total.
The Way of the Samurai

User avatar
Ghost Dog
Posts: 163
Joined: Fri 27 Jan 2012, 04:29

#2 Post by Ghost Dog »

When I make a regular save file on the stick the usual way at first shutdown, on the usb stick, it works like it's supposed to. Puppy finds it and merges the filesystem.

But when I make it fresh using the commands in the previous post, it doesn't work for some reason.
Last edited by Ghost Dog on Sun 11 Aug 2013, 05:58, edited 1 time in total.
The Way of the Samurai

User avatar
Karl Godt
Posts: 4199
Joined: Sun 20 Jun 2010, 13:52
Location: Kiel,Germany

#3 Post by Karl Godt »

The PUPPY_VERSION_SAVE file name is hardcoded in the initrd.gz .

A Wary would not offer to load a slackosave-DATE.4fs at boot for example, only warysave*.4fs .
Probably name it -NAMESTRING with dash . The dash might be used as a delimiter in the /init code .

It might have been different with Puppy-4 series, though, that seem to be named pupsave-STRING.2fs anyways .
lupusave-STRING.3fs naming came with Puppy-5 series me thinks .
puppy_VERSION-STRING.3fs is also "newer" .
«Give me GUI or Death» -- I give you [[Xx]term[inal]] [[Cc]on[s][ole]] .
Macpup user since 2010 on full installations.
People who want problems with Puppy boot frugal :P

User avatar
Karl Godt
Posts: 4199
Joined: Sun 20 Jun 2010, 13:52
Location: Kiel,Germany

#4 Post by Karl Godt »

Code: Select all

yes y | mkfs.ext4 puppy_save.4fs
Where have you found that code ?
Never seen such .

Code: Select all

mkfs.ext4 puppy_save.4fs
should work .
Also

Code: Select all

fsck puppy_save.4fs
probably afterwards .

User avatar
Ghost Dog
Posts: 163
Joined: Fri 27 Jan 2012, 04:29

#5 Post by Ghost Dog »

Hi Karl,

Sorry, I was naming the folder the same as PupSaveConfig did it. Creating a save file with the appropriate name in the root directory results in it being found at boot. But now I get a kernel panic.

I have tried creating the file in two ways. One is using the code Dejan55 originally used in his script, later used by RSH and ANSI Education in theirs:

Code: Select all

dd if=/dev/zero of=slackosave.4fs bs=1M count=1024
yes y | mkfs.ext4 slackosave.4fs
sync
And using code adapted from rc.shutdown:

Code: Select all

dd if=/dev/zero of=slackosave.4fs bs=1k count=1024000
yes y | mkfs.ext4 -q -m 0 -F slackosave.4fs
Both result in the kernel panic error. Why does a savefile created in the normal way at shutdown get found and work great, but ones created manually don't work?
The Way of the Samurai

User avatar
Semme
Posts: 8399
Joined: Sun 07 Aug 2011, 20:07
Location: World_Hub

#6 Post by Semme »

Hey Karl, know anything about this?

User avatar
Karl Godt
Posts: 4199
Joined: Sun 20 Jun 2010, 13:52
Location: Kiel,Germany

#7 Post by Karl Godt »

yes y | mkfs.whateverfs whaterveroptions whatever.file is not the Puppy way .

Current it should be

Code: Select all

dd if=/dev/zero of=${SMNTPT}$SAVEFILE bs=1k count=$SIZEPFILE
 sync
 pupkill $w1PID
 echo "`eval_gettext \"Creating a \\\${SFFS} filesystem in \\\${NAMEONLY}...\"`" >/dev/console
 if [ "$CRYPTO" = "" ];then
  case $SFFS in
   ext2) mkfs.ext2 -q -m 0 -F ${SMNTPT}$SAVEFILE ;;
   ext3) mkfs.ext3 -q -m 0 -F ${SMNTPT}$SAVEFILE ;;
   ext4) mkfs.ext4 -q -m 0 -F ${SMNTPT}$SAVEFILE ;;
  esac
no yes y anywhere .. need to get fresh air to stop rolling on the floor laughing ..

Will have to play with
yes y PIPE OR mkfs* * *

yes itself is a good hand warmer on a laptop , good for arctic conditions .

Probably yes y makes mkfs write Y into it instead of ZEROS .. :evil: :) :roll:

The page Semme liks to by MHHP says that some files are needed in the new savefile .
To make sure I would

Code: Select all

mkdir /mnt/savefile
mount -o loop savefile.4fs /mnt/savefile
[ "$?" = 0 ] || exit
cp -a /initrd/pup_rw/* /mnt/savefile/
rm -rf /mnt/savefile/ /root/*
mkdir -p /mnt/savefile/proc
mkdir -p /mnt/savefile/sys
mkdir -p /mnt/savefile/mnt
mkdir -p /mnt/savefile/tmp
chmod 1777 /mnt/savefile/tmp
mkdir -p /mnt/savefile/var
-BASICALLY mount the savefile and copy the content from /initrd/pup_rw/* into it , remove everything below /root/ therein and create the main folder structure on top rootfs inside it ( /var, /sys, etcetc ) .

User avatar
Ghost Dog
Posts: 163
Joined: Fri 27 Jan 2012, 04:29

#8 Post by Ghost Dog »

I should have mentioned that I tried both Dejan555 and Barry's approaches without using the "yes" part that you find so amusing, ie:

Code: Select all

mkfs.ext4 slackosave.4fs
sync

Code: Select all

mkfs.ext4 -q -m 0 -F slackosave.4fs
The reason I used that was because it is in the script that Dejan555, RSH, and ANSI Education made, with help from Bruce B.

So it needs files, huh? I thought it was supposed to be an empty savefile. I'm going to try what you suggested later today.

Thanks!
Last edited by Ghost Dog on Sun 11 Aug 2013, 21:53, edited 1 time in total.
The Way of the Samurai

User avatar
Ghost Dog
Posts: 163
Joined: Fri 27 Jan 2012, 04:29

#9 Post by Ghost Dog »

I should have been more careful, and checked those commands you posted before running them.

Code: Select all

rm -rf /mnt/slackosave/ /root/*
should have been

Code: Select all

rm -rf /mnt/slackosave/root/*
So much for all those important files I had in my root directory...
Last edited by Ghost Dog on Sun 11 Aug 2013, 23:43, edited 1 time in total.
The Way of the Samurai

User avatar
Ghost Dog
Posts: 163
Joined: Fri 27 Jan 2012, 04:29

#10 Post by Ghost Dog »

Image
The Way of the Samurai

User avatar
Ghost Dog
Posts: 163
Joined: Fri 27 Jan 2012, 04:29

#11 Post by Ghost Dog »

Yo I'm back.

Ok, so I created all of the folders you mentioned except for /initrd/pup_rw, because I want to create an empty file not one with all the modules and stuff, plus I'm on a full installation which doesn't seem to have /initrd/pup_rw.

These are the commands I issued from a terminal opened in the usb stick folder:

Code: Select all

dd if=/dev/zero of=slackosave.4fs bs=1k count=1024000
mkfs.ext4 -q -m 0 -F slackosave.4fs #mkfs.ext4 slackosave.4fs

mkdir /mnt/slackosave
mount -o loop slackosave.4fs /mnt/slackosave
mkdir -p /mnt/slackosave/proc
mkdir -p /mnt/slackosave/sys
mkdir -p /mnt/slackosave/mnt
mkdir -p /mnt/slackosave/lib/modules
mkdir -p /mnt/slackosave/tmp
chmod 1777 /mnt/slackosave/tmp
mkdir -p /mnt/slackosave/var
umount /mnt/slackosave && rm -rf /mnt/slackosave
If you click the .4fs file after, it shows the newly-created directories. So the resulting file must be good. However, it causes a kernel panic at boot.
Last edited by Ghost Dog on Mon 12 Aug 2013, 04:32, edited 1 time in total.
The Way of the Samurai

User avatar
Ghost Dog
Posts: 163
Joined: Fri 27 Jan 2012, 04:29

#12 Post by Ghost Dog »

So I made a fresh savefile the normal way without changing anything, and had a look inside.

I copied everything out, removed the contents of root, and copied the files into the mounted .4fs file.

And it works! Thanks for the help.
The Way of the Samurai

User avatar
Karl Godt
Posts: 4199
Joined: Sun 20 Jun 2010, 13:52
Location: Kiel,Germany

#13 Post by Karl Godt »

Ok , FULL installation explains it .

Basically MHHP mentions the file
/etc/rc.d/BOOTCONFIG

That looks different in frugal and full installation mode .

In full installation it is an empty file, since it gets written by the initrd.gz/init .

Such a file could look like

Code: Select all

PREVUNIONRECORD='pupsave-2013_07_12.2fs pup-430.sfs zp430305.sfs'
LASTUNIONRECORD='pupsave-2013_07_12.2fs pup-430.sfs zp430305.sfs'
( just copied it outside a mounted pupsave file - am running full also )

The PUPMODE changes from 5(RAM) to 12(intHD) or 13(extHD) when a savefile gets loaded .

The initrd.gz/init should check VARIABLES for contend it seems
and if $PREVUNIONRECORD =""
default back to PUPMODE 5 or set some default VARIABLES .

It is a kind of a rare corner case bug .

User avatar
johnywhy
Posts: 879
Joined: Sat 20 Aug 2011, 14:52

#14 Post by johnywhy »

noob asks:

i'd like to manually create a pupsave file. i'm trying to simplify the script posted above by karl godt:

Code: Select all

dd if=/dev/zero of=${SMNTPT}$SAVEFILE bs=1k count=$SIZEPFILE
 sync
 pupkill $w1PID
 echo "`eval_gettext \"Creating a \\\${SFFS} filesystem in \\\${NAMEONLY}...\"`" >/dev/console
 if [ "$CRYPTO" = "" ];then
  case $SFFS in
   ext2) mkfs.ext2 -q -m 0 -F ${SMNTPT}$SAVEFILE ;;
   ext3) mkfs.ext3 -q -m 0 -F ${SMNTPT}$SAVEFILE ;;
   ext4) mkfs.ext4 -q -m 0 -F ${SMNTPT}$SAVEFILE ;;
  esac
i've read through the mke2fs manual, but still a noob.

in any case, i want to hardcode everything (such as filename, size, mount-point, and format), rather than using variables/arguments as in karl's version. here's my version so far, but needless to say it's not working :oops:

first, manually create a folder in /mnt called "mytest". Then:

Code: Select all

# dd if=/mnt/mytest bs=1k count=100000
dd: reading `/mnt/mytest': Is a directory
0+0 records in
0+0 records out
0 bytes (0 B) copied, 0.000167725 s, 0.0 kB/s
# sync
# mkfs -t ext4 /mnt/mytest
mke2fs 1.41.14 (22-Dec-2010)
/mnt/mytest is not a block special device.
Proceed anyway? (y,n) y
mkfs.ext4: Device size reported to be zero.  Invalid partition specified, or
	partition table wasn't reread after running fdisk, due to
	a modified partition being busy and in use.  You may need to reboot
	to re-read your partition table.
feel free to laugh :P
plz assist after ROFL.

thx!
[b]Now[/b]: X-Tahr 2.0! StretchDog! DevuanDog!
[b]Tops[/b]: TarhNOP Vlina-R2 Racy
[b]Used[/b]: Puppeee Precise Lucid Wary Tahrpup Quirky Slacko MacPup Saluki Puppy Studio LxPupTarh Lina-Lite Lina
[i]i ♥ Puppy[/i]

User avatar
mikeb
Posts: 11297
Joined: Thu 23 Nov 2006, 13:56

#15 Post by mikeb »

dd if=/mnt/mytest bs=1k count=100000 should be
dd if=/dev/zero of=/mnt/mytest bs=1k count=100000

if = input file of = output file

rest seems ok though a force parameter for mkextfs would be nice.

generally try thing --help or thing -h
to see what all those important parameters do.

mike

User avatar
johnywhy
Posts: 879
Joined: Sat 20 Aug 2011, 14:52

#16 Post by johnywhy »

appreciate the reply, mikeb. questions in red...

so, we're copying a megabyte of zero's, 1 kilobit at a time, from a non-existent dir into our mountpoint. Correct?

if /dev/zero does not exist, could we use anything. Like, /dev/banana or /mnt/dogpoo?

why 'force'? i understand what it does, but why needed here?

i'm guessing we need 'sync' to apply the writes to disk, since puppy runs in RAM, so the changes might not have gotten written to disk yet. Correct?

Tho they will eventually get written, even without sync. Correct?

Question, where does the .4fs file come from?

i find a get a bit more detail by looking at the man page, than i get from --help. i need all the help i can get :)

many thx!
[b]Now[/b]: X-Tahr 2.0! StretchDog! DevuanDog!
[b]Tops[/b]: TarhNOP Vlina-R2 Racy
[b]Used[/b]: Puppeee Precise Lucid Wary Tahrpup Quirky Slacko MacPup Saluki Puppy Studio LxPupTarh Lina-Lite Lina
[i]i ♥ Puppy[/i]

User avatar
mikeb
Posts: 11297
Joined: Thu 23 Nov 2006, 13:56

#17 Post by mikeb »

in no particular order

-t ext4 sets the resultant file system... you add the .4fs...its just a name and pretty meaningless except in puppy.
Force means it won't ask you to force...better for scripts...you are formatting an image file not a real partition so seen as an odd request.

/dev/zero is a kernel special file/device that supplies dummy null data... not tried it but I believe its important to use that rather than bananas.

sync..unlikely you need it unless you type really fast...meant for scripts really.

yes is a copy of dummy data in the required quantity...the 1kb sort of gives a block size...not sure how relevant it is to formatting...more of a convenient figure.

hope that helps

mike

User avatar
johnywhy
Posts: 879
Joined: Sat 20 Aug 2011, 14:52

#18 Post by johnywhy »

Thx again, Mikeb!

But I don't understand how the .4fs file gets created. That code fills a mount point with zeros. Ok. But what's the code that creates the 4fs file?

Thx!
[b]Now[/b]: X-Tahr 2.0! StretchDog! DevuanDog!
[b]Tops[/b]: TarhNOP Vlina-R2 Racy
[b]Used[/b]: Puppeee Precise Lucid Wary Tahrpup Quirky Slacko MacPup Saluki Puppy Studio LxPupTarh Lina-Lite Lina
[i]i ♥ Puppy[/i]

User avatar
mikeb
Posts: 11297
Joined: Thu 23 Nov 2006, 13:56

#19 Post by mikeb »

mkfs -t ext4 /mnt/mytest

sorry was not clear...thats actually calls mkfs.ext4 (e2fsck) which formats the virtual disk...does that same job as format on windows that you use after fdisk.

mike

User avatar
johnywhy
Posts: 879
Joined: Sat 20 Aug 2011, 14:52

#20 Post by johnywhy »

mikeb wrote:mkfs -t ext4 /mnt/mytest
i'm sure you were clear, and i'm just dense.

so that command will create a 4fs file called mytest.4fs? Where will the file be located?

i'm confused, because i'm only seeing a mountpoint in this command.

thx!
[b]Now[/b]: X-Tahr 2.0! StretchDog! DevuanDog!
[b]Tops[/b]: TarhNOP Vlina-R2 Racy
[b]Used[/b]: Puppeee Precise Lucid Wary Tahrpup Quirky Slacko MacPup Saluki Puppy Studio LxPupTarh Lina-Lite Lina
[i]i ♥ Puppy[/i]

Post Reply