Puppy Linux Discussion Forum Forum Index Puppy Linux Discussion Forum
Puppy HOME page : puppylinux.com
"THE" alternative forum : puppylinux.info
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

The time now is Tue 21 Oct 2014, 22:00
All times are UTC - 4
 Forum index » House Training » HOWTO ( Solutions )
How to force PUPMODE 13 (flash drive) when using hd install
Moderators: Flash, Ian, JohnMurga
Post_new_topic   Reply_to_topic View_previous_topic :: View_next_topic
Page 1 of 2 Posts_count   Goto page: 1, 2 Next
Author Message
kleung21

Joined: 18 Nov 2006
Posts: 28
Location: Toronto, Ontario

PostPosted: Mon 04 Dec 2006, 03:00    Post_subject:  How to force PUPMODE 13 (flash drive) when using hd install
Sub_title: Use this to force PUPMODE 13 on a hard drive
 

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 Puppy and pupmodes at 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
Code:
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:
Code:
case $PUPMODE in

then add before it this line of
Code:
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.

EXTRAs

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.
Code:
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.
Back to top
View user's profile Send_private_message 
Pizzasgood


Joined: 04 May 2005
Posts: 6270
Location: Knoxville, TN, USA

PostPosted: Mon 04 Dec 2006, 03:10    Post_subject:  

I wrote a script a while back to force a save in mode 13, just in case you did something important or want to do a hard-shutdown.
http://www.murga-linux.com/puppy/viewtopic.php?highlight=savepuppy&t=11542

Also note, every thirty minutes, Puppy will start copying everything you've done. That means it runs nice the rest of the time, but you might experience slowdown when it copies everything that accumulated in one burst.

_________________
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
View user's profile Send_private_message Visit_website 
Fractal

Joined: 08 Dec 2010
Posts: 8

PostPosted: Fri 11 Feb 2011, 07:50    Post_subject:  

Unfortunately your mount command fails with "you must specify the filesystem type".
It won't work with any of the filesystem types when I try to use the "-t" option. What am I doing wrong?
Back to top
View user's profile Send_private_message 
jamesbond

Joined: 26 Feb 2007
Posts: 2227
Location: The Blue Marble

PostPosted: Fri 11 Feb 2011, 08:12    Post_subject:  

If you want to force puppy to run in PUPMODE=13 all you need to do is specify pmedia=ataflash on your boot command line. No initrd hacking is required.

cheers!

_________________
Fatdog64, Slacko and Puppeee user. Puppy user since 2.13.
Contributed Fatdog64 packages thread
Back to top
View user's profile Send_private_message 
_Mark_

Joined: 24 Sep 2009
Posts: 97

PostPosted: Fri 11 Feb 2011, 08:18    Post_subject:  

jamesbond wrote:
If you want to force puppy to run in PUPMODE=13 all you need to do is specify pmedia=ataflash on your boot command line. No initrd hacking is required.

cheers!


That's what I like the hard way followed by the easy way, presuming they both work I know which one I would use Smile
Back to top
View user's profile Send_private_message 
Fractal

Joined: 08 Dec 2010
Posts: 8

PostPosted: Fri 11 Feb 2011, 08:48    Post_subject:  

No! PMEDIA=ataflash does not do that with the version I am running (4.2.1)
Here's my GRUB lines:

kernel /vmlinuz PMEDIA=ataflash
initrd /initrd.gz

But there's no "Save" icon on my desktop and no save is made when shutting down and (most importantly) my CF drive is trashed if I suddenly remove power. This is vital because once I get my application deployed, the customers will be pulling power all the time as their preferred shutdown method (it's an industrial deployment). Puppy must protect my CF, which means PUPMODE=13 is a must.

I think version 4.2.1 has this bug, but newer versions I have tried fail to initialise my SBC's serial port, which I am using to communicate with an industrial controller.

If you helpful guys could point me in the right direction so I can start editing my init script, I'd appreciate that. Pizzagood's method doesn't work for me.
Back to top
View user's profile Send_private_message 
rcrsn51


Joined: 05 Sep 2006
Posts: 9200
Location: Stratford, Ontario

PostPosted: Fri 11 Feb 2011, 09:43    Post_subject:  

Another strategy is discussed here.
Back to top
View user's profile Send_private_message 
Fractal

Joined: 08 Dec 2010
Posts: 8

PostPosted: Fri 11 Feb 2011, 11:56    Post_subject:  

Thanks, guys!

All done. Basically, I have been looking for an alternative to Windows Embedded and I found Puppy. Puppy 5x worked well and I was impressed until I discovered that my application could not read or write the serial port of my SBC. I finally settled on 4.2.1 and remastered it. Then my customers decided they wanted window transparencies so I needed a composing WM (JWM is not composing).
I am now experimenting with Succi Puppy which uses xcfe as it's WM, which is compositing. My app now has transparent-capabilities but I have a Portugese initrd, and also the PUPMODE 13 bug.

So thanks for that script - I am now running in PUPMODE 13.
Now to un-translate all that Portugese... Wink Ta again.
Back to top
View user's profile Send_private_message 
Sylvander

Joined: 15 Dec 2008
Posts: 3455
Location: West Lothian, Scotland, UK

PostPosted: Tue 15 Feb 2011, 06:13    Post_subject:  

Running Lupu-520 from "live" CD-RW, with lupusave on a folder, in the root folder, of an ext3 partition [sdb2], on the 2nd internal HDD.
Hence, initrd.gz is on a CD-RW disk! Confused

I'd like to give this a try...
And yet, being less than experienced...
I'm puzzled by:
1. The code provided, as follows...
Code:
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

You'll probably laugh, but...
Do I <Enter> one line of code at a time?
Or copy and "Shift+insert" all of it in one go?

2. Could you perhaps explain what each line of code achieves?

3. After which line should I edit the contents of "the init shell file".

4. Regarding "Extras"...
(a) I have no swap partition in use, so how does that affect things.
(b) In my Puppy file = /etc/rc.d/rc.local
Should I be using the code:
Code:
hdparm -S3 /dev/sdb
hdparm -y /dev/sdb


5. Thought it better to ask, rather than proceed in hope, with fingers crossed.
Back to top
View user's profile Send_private_message 
jamesbond

Joined: 26 Feb 2007
Posts: 2227
Location: The Blue Marble

PostPosted: Thu 17 Feb 2011, 07:59    Post_subject:  

Sylvander, the original post was in 2006, probably for Puppy 2.x series. The instruction is now longer valid - Puppy has since changed the format of initrd.gz (from ramdisk format, to initramfs format).
_________________
Fatdog64, Slacko and Puppeee user. Puppy user since 2.13.
Contributed Fatdog64 packages thread
Back to top
View user's profile Send_private_message 
Sylvander

Joined: 15 Dec 2008
Posts: 3455
Location: West Lothian, Scotland, UK

PostPosted: Thu 17 Feb 2011, 08:21    Post_subject:  

Is it no longer possible to run a HDD pupsave as if it were a Flash Drive pupsave?

If it IS still possible...
Does anyone know how to do it?
[Without using GRUB, or making a locked-down installation]

I want to be able to choose whether/when to save the [pupsave on HDD] session, either during the session or at shut-down.
Just like I do when the pupsave is on a Flash Drive.
Back to top
View user's profile Send_private_message 
Jasper


Joined: 25 Apr 2010
Posts: 1144
Location: England

PostPosted: Thu 17 Feb 2011, 09:08    Post_subject:  

Hi Sylvander,

STEP 1
You could permanently change System>Puppy Event Manager>Save Session> Interval to 0.


STEP 2a
Then if you don't want to save you could rename your current save file by putting say an "x" as the first character with a view to returning to the original name after shut down.


or STEP 2b
Alternatively and more easily, you could do a hard "power off", unless that is never to be recommended.

My regards

Edited_time_total
Back to top
View user's profile Send_private_message 
jamesbond

Joined: 26 Feb 2007
Posts: 2227
Location: The Blue Marble

PostPosted: Thu 17 Feb 2011, 09:18    Post_subject:  

Sylvander wrote:
Is it no longer possible to run a HDD pupsave as if it were a Flash Drive pupsave?

If it IS still possible...
Does anyone know how to do it?
[Without using GRUB, or making a locked-down installation]

I want to be able to choose whether/when to save the [pupsave on HDD] session, either during the session or at shut-down.
Just like I do when the pupsave is on a Flash Drive.
Have you tried pmedia=ataflash I suggested above? If you are running from CD-RW - you should be able to see the boot menu, you can just type "puppy pmedia=ataflash" during boot-up. Then follow Jasper's suggestion.
_________________
Fatdog64, Slacko and Puppeee user. Puppy user since 2.13.
Contributed Fatdog64 packages thread
Back to top
View user's profile Send_private_message 
Sylvander

Joined: 15 Dec 2008
Posts: 3455
Location: West Lothian, Scotland, UK

PostPosted: Thu 17 Feb 2011, 10:35    Post_subject:  

@jasper
1. "You could permanently change System>Puppy Event Manager>Save Session> Interval to 0."
(a) When using a pupsave on a Flash Drive:
That applies, and I already know how to do that, plus...
How to stop "SAVING TO FILE" at shutdown.
These are what I use when the pupsave is on a Flash Drive.

(b) I believe that in order to apply these when the pupsave is on a HDD, I need to be able to make the Puppy [using a pupsave on a HDD] behave as though it were a Puppy using a pupsave on a Flash Drive.
That would be an elegant solution.
Your other 2 suggestions are inelegant solutions I don't fancy using.

@jamesbond
2. "If you want to force puppy to run in PUPMODE=13 all you need to do is specify pmedia=ataflash on your boot command line. No initrd hacking is required."
(a) Where is this "boot command line"?
Remember I'm using a "live" Puppy CD-RW.
Wouldn't want to be forced to type a command at EVERY boot.
Is it possible to include it within one of the files on the CD?
i.e. Alter a line of code within a file in the ISO used to make the CD?
Back to top
View user's profile Send_private_message 
Jasper


Joined: 25 Apr 2010
Posts: 1144
Location: England

PostPosted: Thu 17 Feb 2011, 11:47    Post_subject:  

Hi Sylvander,

I have amended my post above by adding step numbers.

It is easy to test if Step 1 works on your hard drive by making an insignificant and unimportant change, and then using either Step 2a or Step 2b (ignoring elegance for a one-off trial). Then rebooting.

My regards

With MultiPup I'm pretty sure CatDude explained to us (you and me) how to change both the choices and sequence of the initial boot parameters; but (though I tried It) I can't retest that as my CD/DVD facilities are now kaput.
Back to top
View user's profile Send_private_message 
Display_posts:   Sort by:   
Page 1 of 2 Posts_count   Goto page: 1, 2 Next
Post_new_topic   Reply_to_topic View_previous_topic :: View_next_topic
 Forum index » House Training » HOWTO ( Solutions )
Jump to:  

Rules_post_cannot
Rules_reply_cannot
Rules_edit_cannot
Rules_delete_cannot
Rules_vote_cannot
You cannot attach files in this forum
You can download files in this forum


Powered by phpBB © 2001, 2005 phpBB Group
[ Time: 0.0961s ][ Queries: 12 (0.0062s) ][ GZIP on ]