Help - How to Hard code/set PUPMODE to 13 - SOLVED

Booting, installing, newbie
Post Reply
Message
Author
kleung21
Posts: 28
Joined: Sat 18 Nov 2006, 07:11
Location: Toronto, Ontario

Help - How to Hard code/set PUPMODE to 13 - SOLVED

#1 Post by kleung21 »

Hi there,

I have a very noisy hard drive and I've installed puppy 2.12 onto the hard drive as a .SFS file (ie: frugal type install) with a save file.

HOWEVER, I want disk access to be nil or none (like in a usbdrive/ PUPMODE=13).

I cannot find a way to change/set the PUPMODE. Is there a way to edit the startup script or even to hardcode it into the file/system somewhere to just use mode 13?

THanks for any light you can shed on this matter.

Kevin

EDIT - AFTER futzing around with this for 2 days, I finally have a solutions for this. I will post it in the how-to section. You can also jump down this thread to see how I did it (you'll want to read all the in-between messages because there are hints in there as well).
Last edited by kleung21 on Mon 04 Dec 2006, 06:33, edited 2 times in total.

User avatar
Pizzasgood
Posts: 6183
Joined: Wed 04 May 2005, 20:28
Location: Knoxville, TN, USA

#2 Post by Pizzasgood »

You'd need to edit the /sbin/init file found in initrd.gz. I made a script called Edit-Initrd that will make that part easier.
http://www.murga-linux.com/puppy/viewto ... it&t=12089

I don't know exactly what you'd have to edit. It might be as easy as finding where it sets the PUPMODE variable and forcing it to use 13. It might set it inside an if statement or something, and do other things in there. In that case, you'd have to think about it a little more. I'd take a look, but I'm back home for the weekend and don't have the file with me.


I do plan to add an override variable to Pizzapup, but I haven't gotten to that part yet. I can't do any serious work right now, because I don't have the time. My finals are the week after next, though, so then I'll have a bunch. Right now I'm doing the smaller odd-jobs, like a defaults-changer.

Another reason such a variable would be nice is for the reverse. I have a SATA drive, and Puppy sees it as /dev/sda. That's the same designation given to USB cards, so Pupy assumes that's what it's booting from and puts me in mode 13. It doesn't bother me, but it would be nice to use 12 sometimes, especially to avoid the periodic slowdown when it copies the data back to the save-file all at once every thirty minutes.
[size=75]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[/size]
[img]http://www.browserloadofcoolness.com/sig.png[/img]

John Doe
Posts: 1681
Joined: Mon 01 Aug 2005, 04:46
Location: Michigan, US

Re: Help - How to Hard code/set PUPMODE to 13

#3 Post by John Doe »

kleung21 wrote:I want disk access to be nil or none (like in a usbdrive/ PUPMODE=13).
It's not hardcoded, but just want to make sure you know you can type:

Code: Select all

puppy pfix=ram
at the boot menu, if you are using the CD boot.

No menu for the USB boot.

kleung21
Posts: 28
Joined: Sat 18 Nov 2006, 07:11
Location: Toronto, Ontario

#4 Post by kleung21 »

Thanks to both quick replies. Yes, I know about pfix=ram; but then, I would lose my settings, etc... I guess I could always remaster puppy; but the system I'm running it on doesn't have a CD-RW.

I'm going to try the first method and edit init IF I can get it to stick; that would be great.

Thanks guys, any more ideas would also be welcome

Kevin

User avatar
darkerror05
Posts: 276
Joined: Sat 17 Jun 2006, 22:10
Location: Rochester NY, USA

#5 Post by darkerror05 »

if you dont mind a older version of pup try taking the .sfs and initrd.gz from qemu-puppy
http://www.erikveen.dds.nl/qemupuppy/index.html <--about
http://linux.softpedia.com/get/System/O ... 0352.shtml <--download
and replace the ones on your harddrive. Or you can just look at these and try to use them to edit the ones on your harddrive. Qemu-puppy is made to run from a usb-tumbdrive so it is "hard-coded" for mode13. I am tring to edit a initrd.gz from 2.12 to work with the mode13 code from qemu-puppy. I will try to reply with what I find and also it would be great to hear about your finds. Good luck.
-darkerror

User avatar
Pizzasgood
Posts: 6183
Joined: Wed 04 May 2005, 20:28
Location: Knoxville, TN, USA

#6 Post by Pizzasgood »

I guess I could always remaster puppy; but the system I'm running it on doesn't have a CD-RW.

I'm going to try the first method and edit init IF I can get it to stick; that would be great.
Yep, it will stick. Actually, using a Frugal install makes it easier, because you don't have to mess with making and burning an ISO.
[size=75]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[/size]
[img]http://www.browserloadofcoolness.com/sig.png[/img]

kleung21
Posts: 28
Joined: Sat 18 Nov 2006, 07:11
Location: Toronto, Ontario

My story so far

#7 Post by kleung21 »

Ok, update after 3 hours.

1) edit-initrd is great; it seems to be running fine... I haven't checked the filesize of initrd after modifications though to see if everything is making it back in.

HOWEVER, I'm finding that it is more difficult to set PUPMODE=13 than just setting a variable. As such, I have given up on this for now as this is only my 2nd week of linux and I'm not proficient enough to start modding the other script lines

2) Thanks for the QEMU tip... That is GREAT, especially since my laptop cannot boot from USB. It's easier to boot from windows/QEMU and then get back into Puppy.

Puppy is really great for learning linux. I'm really finding it's just easier to manipulate and recover from as I'm learning the OS.

Thanks and more tips appreciated. OR any idea on how to modify the init script to accept a PUPMODE variable

Kevin

User avatar
Dougal
Posts: 2502
Joined: Wed 19 Oct 2005, 13:06
Location: Hell more grotesque than any medieval woodcut

#8 Post by Dougal »

I think if you open the init script and find the line

Code: Select all

case $PUPMODE in
then add before it

Code: Select all

PUPMODE=13
it should do the job.
What's the ugliest part of your body?
Some say your nose
Some say your toes
But I think it's your mind

kleung21
Posts: 28
Joined: Sat 18 Nov 2006, 07:11
Location: Toronto, Ontario

#9 Post by kleung21 »

Don't know if it's a simple as setting the PUPMODE variable in the init script. Tried that and it gave me a failure message. Good suggestion though.

I think it might be coded to run pupmode 13 off /dev/sda so I'll have to look at the other lines and see if I can figure it out - sigh :)

Thanks,

Kevin

User avatar
Pizzasgood
Posts: 6183
Joined: Wed 04 May 2005, 20:28
Location: Knoxville, TN, USA

#10 Post by Pizzasgood »

Try adding PMEDIA=ideflash to the kernel line of the boot prompt (the part with kernel=/boot/vmlinuz.....). I just realized that PMEDIA=satahd makes it use my SATA drive in mode 12 rather than 13 (because it was thinking it was USB rather than SATA).
[size=75]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[/size]
[img]http://www.browserloadofcoolness.com/sig.png[/img]

kleung21
Posts: 28
Joined: Sat 18 Nov 2006, 07:11
Location: Toronto, Ontario

How to force Pupmode 13

#11 Post by kleung21 »

The truth is, this method should allow you to force ANY pupmode. However, you should have a good understanding of how the pupmodes work first before you change things as you can break your puppy.

Barry has posted a description of how puppy and pupmodes http://www.puppyos.com/development/howpuppyworks.html

I want to thank everybody that helped in coming out with this solution, especially Pizzasgood, Darkerror05, Dougal, and MU

Who this is for? Why I did it.

If you run puppy off your hard drive and use a puppy save file.

Pupmode 13 is the one used by USB drives. The advantage of forcing your hard drive to behave in the same manner is that a) it decreases writes and b) if you have a loud hard drive like mine, its a LOT quieter as it only flushes the cache/new files every 30 minutes. In this mode, the system will try to use every last bit of ram first before writing accessing the drive (I think)

This will disable your swap drive as well; which is good from my standpoint as the memory/swap drive increases access to the Hard drive = noise.

The tradeoff is that if your computer crashes in that time period, you're SOL with respect to new data.

The default mode for hard drive running is PUPMODE=12. In this mode, all writes are immediately passed through onto the save file image. Thus, there will be frequent writes as you keep modifying data/develop temp files, etc...

How-to

The parameter to edit is located in a boot-up script locked inside the compressed file initrd.gz
Unfortunately, there is no way you can directly edit this. Instead, you will have to uncompress this file, mount it in a temporary location, and then recompress it to get it to work.

Before you start

1) backup initrd.gz. This file is located in your initially mounted drive.

2) You will need to run the following commands to edit the init shell file. You can run this from a terminal -> xterm, etc...

The following commands will uncompress initrd.gz, mount it in a temporary location, run leafpad text editor so you can make the changes, and then recompress initrd.gz for you

gunzip initrd.gz
mkdir /root/minit
mount -o loop initrd /root/minit
leafpad /root/minit/sbin/init
sync
umount /root/minit
sync
gzip initrd
cd /root
sync

3) What you need to change inside the init script

Find the following line of
Code:

case $PUPMODE in

then add before it this line of
Code:

PUPMODE=13


That's it in a nutshell. Now reboot and your puppy works in mode 13. I can see this as a method for forcing other PUPMODES but since I haven't analyzed all the other failpoints, you might want to check it out yourself.

EXTRA's

If you want your hard-drive to power down quickly after this is all done, you can edit 1 more startup script to add the following commands. This can be done without fancy initrd.gz work.

Open up a text editor and open the file

/etc/rc.d/rc.local

add the following commands at the end. You will have to change the command to specify the correct hard drive.

swapoff -a
hdparm -S3 /dev/hda
hdparm -y /dev/hda

These 3 commands will
- turn off all swap files
- set your hard drive to spin-down into standby mode after 15 seconds. S1=5sec, S2=10sec S3=15 sec, you get the picture.
- put your hard drive into standby mode immediately.[/url]

User avatar
Erik Veenstra
Posts: 107
Joined: Wed 27 Jul 2005, 21:06
Location: NL
Contact:

#12 Post by Erik Veenstra »

> Qemu-puppy is made to run from a usb-tumbdrive so it is "hard-coded" for mode13.

If QEMU-Puppy is started within QEMU, PUPMODE is hard-coded to 13. But if QEMU-Puppy is started natively, it simply behaves like plain old Puppy Linux. (Well, it _is_ plain old Puppy Linux.) No hard coded values.

gegroet,
Erik V. - http://www.erikveen.dds.nl/

Post Reply