In DietPi /tmp
is mounted to RAM with default size of 50% of RAM.
In some instances (https://github.com/Fourdee/DietPi/issues/1023#issuecomment-309731931), software installations on 512MB < RAM will run into this issue.
We need to either:
/tmp
from default to > 80% (still wont fix this for 256MB devices)/tmp
RAM mount on 512MB or lower devices.Completed with solution:
Applied during patch and during 1st run of DietPi.
Due to: https://github.com/Fourdee/DietPi/issues/1566#issuecomment-369296662
2 options:
/tmp
to 1.5GB
, which with our standard 2GB-RAM swapdisk size, should be fine and allow for swap/tmp
as tmpfs
with devices on 1GB or less memory. Performance impact expected (eg: APT unpack/configure as per Mono install)@Fourdee
- Disable
/tmp
RAM mount on 512MB or lower devices.
Have mentioned personally dislike to do this some times ago.
We give away some sort of protection for sd card life time.
Question (without skill):
We now "build" swapfile and size directly before install software. When install mono
e.g. 2GB.
Is it not possible to put downloaded mono
installation direct to swap
and then install / extract it?
So we can keep tmpfs
for all devices?
@k-plan
Is it not possible to put downloaded mono installation direct to swap and then install / extract it?
So we can keep tmpfs for all devices?
Cant see a way of changing the APT/DPKG directory used during extraction. But Option 1 would cover all devices and allow /tmp
as tmpfs
https://github.com/Fourdee/DietPi/issues/1027#issuecomment-369346584
Reference, mono install:
root@DietPi:~# G_TREESIZE /tmp
501.4 MB /tmp
# many of these
-rw------- 1 root root 123M Feb 28 18:02 mono_aot_EhsfHq
- Disable /tmp as tmpfs with devices on 1GB or less memory.
:cry: :fearful:
option 3
:
- Force a size of /tmp to 1.5GB, which with our standard 2GB-RAM swapdisk size, should be fine and allow for swap
Hmm ... question is, at which point this can be done?
/tmp
RAM mount on 512MB?mono
has selected to be installed? (dynamic)If 2. - is impossible, I will vote for "option 3
"
@k-plan
question is, at which point this can be done?
During 1st run of boot script. But i'll patch this for v6.3 and existing systems if we go ahead.
So we could:
/tmp
./tmp
Question 2:
Reference, mono install:
root@DietPi:~# G_TREESIZE /tmp 501.4 MB /tmp # many of these -rw------- 1 root root 123M Feb 28 18:02 mono_aot_EhsfHq
Will / can this mono installation :hankey: be deleted after installation?
If so, and I think it is, one more vote for option 3
... sorry
@k-plan
Will this mono installation ๐ฉ be deleted after installation?
lol yep, After reboot
@k-plan
If RAM < 2GB, and swapfile size is default (2GB-RAM), we could force a size of 1.0/1.5?GB
Example, on a 512MB RAM system:
/tmp
/tmp
), start of swapping/tmp
has upto 1GB available still via swap./tmp
is full, swap should still have 500MB left over.In other words, we should be fine setting a higher /tmp
size than RAM, as long as the swapfile is large enough to accommodate it, should swapping occur.
@Fourdee
Jep agree, we could just set /tmp to 50% of RAM+swap instead if just RAM size. It is a shame, that dpkg does not handle this unpacking into /tmp more efficient, e.g. unpack single package, afterwards remove files laid out on/tmp, before unpacking the next. I mean /tmp just fills, because of the huge amount of dependencies of mono-devel
etc.
I also searched the web quite a while for a possibility to change the unpack directory, but sadly found nothing, not within apt, nor dpkg config files/options, nor setting $TMPDIR (used by dpkg for tmp files/folders, but during my tests not for the unpacked packages...).
As this could happen on every large installation or if users decide to lower/disable their swap file, maybe we could catch this specific error during G_AGI and inform users, to increase their swap size?
notes:
tmpfs size = RAM + Swapfilesize / 2
root@DietPi:~# /DietPi/dietpi/func/dietpi-set_dphys-swapfile 0
[ OK ] Root access verified.
DietPi
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
Mode: Disable swapfile
[ INFO ] DietPi-dphys-swapfile | Deleting existing swapfile (/var/swap)
[ INFO ] DietPi-dphys-swapfile | Setting /tmp tmpfs size: 488M
[ OK ] DietPi-dphys-swapfile | mount -o remount,size=488M tmpfs /tmp
[ INFO ] DietPi-dphys-swapfile | Completed
root@DietPi:~# /DietPi/dietpi/func/dietpi-set_dphys-swapfile 500
[ OK ] Root access verified.
[ INFO ] DietPi-dphys-swapfile | Size = 500 MB
[ INFO ] DietPi-dphys-swapfile | Location = /var/swap
[ INFO ] DietPi-dphys-swapfile | Deleting existing swapfile (/var/swap)
want /var/swap=500MByte, generating swapfile ... of 500MBytes
[ INFO ] DietPi-dphys-swapfile | Setting /tmp tmpfs size: 738M
[ OK ] DietPi-dphys-swapfile | mount -o remount,size=738M tmpfs /tmp
[ INFO ] DietPi-dphys-swapfile | Completed
root@DietPi:~# /DietPi/dietpi/func/dietpi-set_dphys-swapfile 1
[ OK ] Root access verified.
[ INFO ] DietPi-dphys-swapfile | Size = 1072 MB
[ INFO ] DietPi-dphys-swapfile | Location = /var/swap
[ INFO ] DietPi-dphys-swapfile | Deleting existing swapfile (/var/swap)
want /var/swap=1072MByte, generating swapfile ... of 1072MBytes
[ INFO ] DietPi-dphys-swapfile | Setting /tmp tmpfs size: 1024M
[ OK ] DietPi-dphys-swapfile | mount -o remount,size=1024M tmpfs /tmp
[ INFO ] DietPi-dphys-swapfile | Completed
๐ฏ๏ธ So by default /DietPi/dietpi/func/dietpi-set_dphys-swapfile 1
(auto swapfile size of 2GB-RAM).
Examples:
/tmp
size is 1GB. Swapfile = 1.74~GB/tmp
size is 1GB. Swapfile = 1GB/tmp
size is 1GB. Swapfile = 0/tmp
size is 2GB. Swapfile = 0@Fourdee
Thanks for declaration. Yes, I have imagine. it will work like this.
provocative question from a user point of view:
mono
?Fourdee:
But i'll patch this for v6.3 and existing systems if ...
MichaIng:
.... if users decide to lower/disable their swap file, maybe we ....
Good points and they point into the direction I like go:
Idea / approach :
mono
to 2GB-RAM swap file
and /tmp
mono
dietpi.txt
will do during initial setupIf we can get this to run:
_edit:
Sorry @Fourdee , I am a little bit late, but it take some time to write it down in denglisch._
Completed.
~Actually no patch:~
/DietPi/dietpi/func/dietpi-set_dphys-swapfile $(grep -m1 '^AUTO_SETUP_SWAPFILE_SIZE=' /DietPi/dietpi.txt | sed 's/.*=//')
AUTO_SETUP_SWAPFILE_SIZE
is updated with swapfile size after script exec. EG: replacing auto 1
.
If auto was used originally, the swapfile size re-apply will have same effect. We'll keep existing user swapfile size and simply reapply.
Guys/Girls how to solve that after long time install and /tmp full ?
@reeslo
Please check what fills your /tmp. That should only be used temporarily for relatively small file sizes. Or is there any specific install that fails, which writes lots of files to /tmp?
G_TREESIZE /tmp
I thanks for reply, I found that was the swap file. And I do this https://dietpi.com/phpbb/viewtopic.php?p=18433#p18433 but seem not fix my problem, my pi is not responding.. I have to investigate, its looks like other issue. :/
I have send a bug remport Bug report sent, reference code: c303265e-fe6f-4af8-890c-e21620b589b9
@reeslo
I checked your bug report. Indeed every looks pretty fine, swap file is there, nearly unused, even physical RAM mostly free.
I see you have wpa_supplicant.service enabled, without having an WiFi card, and even if, ifupdown invokes wpa_supplicant ondemand per-interface. Hence you should disable it: systemctl disable wpa_supplicant
Another minor thing to satisfy Dropbear about a missing log file: > /var/log/lastlog
What is the actual issue? What you mean by Pi is not responding, as you are able to login and send a bug report at least? At best open a new issue for that.
@MichaIng thanks for reply, my pb was pi not responding, after reboot I see swap full, then I change swap file destination, but without reboot, pi not responding after hours.. I reboot one more time, and at now pi is up (16 hours). If I have anymore my pi not responding I make investigation, like your suggestions.
Thanks and sorry for my english ๐ฌ
@MichaIng there is no more freezer (2 days ultime), I think I've solved the issue by changing swap file location to /root/my_swap !
Most helpful comment
@MichaIng there is no more freezer (2 days ultime), I think I've solved the issue by changing swap file location to /root/my_swap !