Standardise Temp dir for Puppy frugal (outside of savefile)

What features/apps/bugfixes needed in a future Puppy
Post Reply
Message
Author
User avatar
darkcity
Posts: 2534
Joined: Sun 23 May 2010, 19:16
Location: near here
Contact:

Standardise Temp dir for Puppy frugal (outside of savefile)

#1 Post by darkcity »

Does anyone else thin it would be useful to have a standard temp dir for Puppy outside of the savefile

it is a annoying having to config the temp directory for every program,

may a solution would be to have PupTempDir option,

the default for an installed puppy could be

/mnt/home/tmp

what do people think?

Peterm321
Posts: 411
Joined: Thu 29 Jan 2009, 14:09
Location: UK

#2 Post by Peterm321 »

darkcity wrote:it is a annoying having to config the temp directory for every program,

may a solution would be to have PupTempDir option,

the default for an installed puppy could be

/mnt/home/tmp

what do people think?
Perhaps assigning env variable TMPDIR in /etc/rc.d/rc.sysinit , /etc/rc.d/rc.local or /etc/profile could do this? http://stackoverflow.com/questions/3106 ... y-in-linux

User avatar
darkcity
Posts: 2534
Joined: Sun 23 May 2010, 19:16
Location: near here
Contact:

#3 Post by darkcity »

That's sounds like a proper way to go 8)

I wonder if Apps would pick up on that, maybe symlink the /tmp dir to /home/tmp :idea:

Peterm321
Posts: 411
Joined: Thu 29 Jan 2009, 14:09
Location: UK

#4 Post by Peterm321 »

darkcity wrote:I wonder if Apps would pick up on that, maybe symlink the /tmp dir to /home/tmp
You could see if apps are still opening files in the /tmp directory by using a program like lsof, but if you really want to keep temporary files out of /tmp altogether you may have to change /tmp to a symlink as you suggest. Some programs have /tmp hardcoded. If you change /tmp to a symlink in the middle of a session there may be issues. Probably best to change /tmp, if in fact you decide to do so, at the start of a session and reboot to be on a safer side.

User avatar
darkcity
Posts: 2534
Joined: Sun 23 May 2010, 19:16
Location: near here
Contact:

#5 Post by darkcity »

I might try and change it before X win is loaded. Thanks for your help 8)

User avatar
sunburnt
Posts: 5090
Joined: Wed 08 Jun 2005, 23:11
Location: Arizona, U.S.A.

#6 Post by sunburnt »

I believe that /tmp is outside of the Save file.
Type "df" in rxvt and you`ll see the line:

Code: Select all

tmpfs                   553784       372    553412   1% /tmp
If you put a file in /tmp and reboot it won`t be there.
This is good as /tmp is fast in ram, and the Save file`s slow being on a partition.

User avatar
darkcity
Posts: 2534
Joined: Sun 23 May 2010, 19:16
Location: near here
Contact:

#7 Post by darkcity »

The trouble is lots of programs put temporary files in /root/

which is inside the savefile - firefox is one example.

why don't use /tmp

---

what I'm trying to avoid is having to configure every program individually to use a location outside the savefile - also beginners won't know to do this. 8)

User avatar
sunburnt
Posts: 5090
Joined: Wed 08 Jun 2005, 23:11
Location: Arizona, U.S.A.

#8 Post by sunburnt »

Yep... And links don`t solve the slow Save access. This is a good example of poor programming and Linux`s legacy problems.
It`s a shame industry and the populace need to be told what to do. But obviously they can`t handle it on their own.

I`ve said many times that Linux files need to be organized into read-only and read-write directories.
And the read-write files divided into /tmp and /etc ( more or less...).

Peterm321
Posts: 411
Joined: Thu 29 Jan 2009, 14:09
Location: UK

#9 Post by Peterm321 »

darkcity wrote:The trouble is lots of programs put temporary files in /root/

which is inside the savefile - firefox is one example.

why don't use /tmp
I have read that many programs are not writing to /root/ in terms of hardcoding but rather they are writing to the directory stored in environment variable $HOME      Puppy Linux, being essentially a single user system defaults its $HOME to /root. But I think you may find that there is added to most puppy linuxes the "spot" user and there have been discussions in the murga forum about getting it to work with various apps with another home directory such as /mnt/home

http://www.murga-linux.com/puppy/viewto ... 52&t=71358

User avatar
darkcity
Posts: 2534
Joined: Sun 23 May 2010, 19:16
Location: near here
Contact:

#10 Post by darkcity »

Thanks for the information about Spot 8)

Ideally the solution wouldn't require using a different user.

the problem is separating out what's stored in
/root or $home

ie configuration files, personal files, temp files, data (like bookmarks)

Peterm321
Posts: 411
Joined: Thu 29 Jan 2009, 14:09
Location: UK

#11 Post by Peterm321 »

darkcity wrote:Ideally the solution wouldn't require using a different user.

the problem is separating out what's stored in
/root or $home

ie configuration files, personal files, temp files, data (like bookmarks)
Well IIRC Firefox (in reference to a pervious post of yours in this thread) uses the "$HOME/.mozilla/firefox" folder. I believe you can also change the profile with the eg "firefox-bin -profile <path>" commandline option.

Redefining $HOME will only affect the current shell and programs started from that shell. If you really want to kill all access to /root which I believe is in the savefile on systems that use a savefile, you can also consider the mount --bind command

Code: Select all

mount --bind <old dir> <new dir> 
Example:

Code: Select all

 cp   -a   /root    /tmp
mount --bind  /tmp/root   /root
NB make a copy of your /root (standard $HOME) in your /tmp directory then remap /tmp/root to /root. The effect should be system wide if I read the documentation correctly. Any settings would be lost between reboots unless the settings were synced back to the original /root or $HOME directory.

User avatar
darkcity
Posts: 2534
Joined: Sun 23 May 2010, 19:16
Location: near here
Contact:

#12 Post by darkcity »

Thanks for reply, I haven't got time to fully look into at the moment.

The things I want configuration files and things that are part of Puppy in /root but temp and personal file out of it.

I know how to achieve this, however it wouldn't be obvious to a beginner.

:twisted:

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

#13 Post by Karl Godt »

There is a difference in frugal and full installations having a /tmp dir .

/tmp in frugal mode normally is mounted as tmpfs into RAM, full installs PUPMODE=2 have /tmp mounted on the HD .

just a few links about this theme :

Ubuntu: Want to mount tmpfs on /tmp
/tmp size fix
A big tmp with small memory
Do not delete /tmp/* at shutdown

As for Puppy Lupu-5 :
Lupu uses /sbin/pup_event_backend_modprobe_protect --daemon,
which is nice code, but waits for input via cat /tmp/pipe .
If that connection gets lost for a short time or even mounted read-only for a short time,
that daemon does not work anymore and was able to hang my PC forever waiting for input in /etc/rc.d/rc.sysinit .

User avatar
darkcity
Posts: 2534
Joined: Sun 23 May 2010, 19:16
Location: near here
Contact:

#14 Post by darkcity »

should programs use /tmp by default then?

what about media programs that have big files?

does swp come into it?

need to look into pupmodes more . . .

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

#15 Post by Karl Godt »

Yes it seems there is some confusion on using the term "/tmp" on Puppy .

There is a difference in /initrd/pup_rw as temporary main folder and the simple /tmp directory .

/initrd/pup_rw acts on flash PUPMODE=13 as tmp directory in RAM .
tmp in the meaning of temporary until flushed to the save file by /sbin/pup_event_frontend_d running /usr/sbin/snapmergepuppy
every minutes defined by
/usr/sbin/eventmanager with variables stored in /etc/eventmanger configuration file .

I post the

Code: Select all

mount |grep tmp
of saluki-19

Code: Select all

source /etc/rc.d/PUPSTATE && echo $PUPMODE
12
as example :

tmpfs on /tmp type tmpfs (rw,relatime,size=1047368k)
shmfs on /dev/shm type tmpfs (rw,relatime,size=247096k)

The /init of initrd.gz and /etc/rc.s/rc.sysinit are responsible for calculating sizes .
free is showing
Mem: 1025304 total
Swap: 3164152 total

On PUPMODE=12 the save file is mounted as
/dev/loop1 on /initrd/pup_rw type ext4 (rw,noatime,user_xattr,barrier=1,data=ordered)

NOT temporary as on flash and writes like downloads go directly into the save-file and not to RAM first .

(shinobar has found a solution by directing seamonkey dl to some folder on partition by altering the seamonkey preferences i think)

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

#16 Post by Karl Godt »

Now I have booted racy-5.3 in PUPMODE=13 frugal installed on SDCard flash :

"mount |grep tmp" gives :

tmpfs on /initrd/pup_rw type tmpfs (rw,relatime,size=1303776k)
tmpfs on /initrd/mnt/tmpfs type tmpfs (rw,relatime,size=111640k)
shmfs on /dev/shm type tmpfs (rw,relatime,size=192808k)

where all folders on '/' inclusive /tmp are mounted also as /initrd/pup_rw, the top unionfs|aufs layer , so apparently no need to mount the main /tmp folder another time separately . Will have to check if the /tmp folder gets copied to the save file, which i think it shouldn't.

The main puppy_racy_5.3.sfs is copied to /initrd/mnt/tmpfs/ directory :
Q:

Code: Select all

ls /initrd/mnt/tmpfs
A: puppy_racy_5.3.sfs


The devx is not copied to ram .

The save-file is now mounted as :

/dev/loop1 on /initrd/pup_ro1 type ext3 (rw,noatime,errors=continue,barrier=0,data=ordered)


It is a little confusing to call the savefile pup_ro1 : as far as i saw the code, the save-file does not get remount,ro 'ed and remount,rw 'ed when snapmergepuppy is running or when the save at rc.shutdown is made.
The save-file is mounted rw all the time . (A possible risk imho.)


free shows :

Mem : 1025472 total
Swap: 1582076 total

(have disabled one swap in rc.sysinit to be reserved for Resume from Hibernation (which is not possible with stock Puppy kernels by Bk but from pemasu fex.)

Post Reply