Zuckerbude

not your average tech/non-tech blog - since 2007

VeraCrypt and Panfrost compile vs 1GB memory

November 10, 2020 Technical Ben Zucker

Recently I needed to build mesa on my OrangePi One Plus to get the most out of the current Panfrost support. However the building always failed because the board locked itself up. Some research showed that it most likely ran out of memory.

A bit later I tried building VeraCrypt on a NanoPi Neo3 and after a while run into the same issue.

Armbian does ship zram with each board to get help get around the memory lacking a bit. However in these cases it simply was not enough.

So what I had to do was to create some temporary swap space and make sure that the system uses it just in emergency case.

First check the currently active swaps:

root@nanopineo3:~# swapon
NAME TYPE SIZE USED PRIO
/dev/zram1 partition 492.6M 0B 5

As we can see zram is active. Since I wanted to keep zram in the future and needed the workaround only temporary as mentioned I simply got rid of it by executing

swapoff -a

Now I created a new swapfile. If possible plugin a USB stick or similar to not unnecessary reduce the health of your sd card. In my case I did not care about that factor:

dd if=/dev/zero of=/swap bs=1M count=2048
mkswap /swap
swapon /swap

This created a new 2G file, formatted it as swap and enabled it. Of course you could use fallocate or truncate for the first job too.

The last step was to tell the system not to use the swap space unless it has no choice but to do so.

sysctl vm.swappiness=1

Monitoring the memory usage while building clearly showed some spikes in usage that without the additional space killed the OS.