Bitcoin Forum

Bitcoin => Bitcoin Technical Support => Topic started by: JorisK on January 03, 2020, 12:09:38 PM



Title: Full node on Raspberry 3: Out of memory
Post by: JorisK on January 03, 2020, 12:09:38 PM
Hi,

As the topic states:

1. I have a Raspberry 3+
2. I downloaded the binaries from bitcoincore.org
3. I have a simple bitcoin.conf which only states it should run as a daemon.
4. Everything fully updated.

And this happens:
2020-01-03T11:59:38Z UpdateTip: new best=00000000000000e90ef3bf0107078c5b16c1fd576ba131ee75ecda4ad4531eae height=235028 version=0x00000002 log2_work=69.96869 tx=17366192 date='2013-05-07T20:21:55Z' progress=0.035347 cache=660.8MiB(5855425txo)
2020-01-03T12:00:02Z Error: Out of memory. Terminating.

Anyone any clue?



Title: Re: Full node on Raspberry 3: Out of memory
Post by: DaveF on January 03, 2020, 01:10:17 PM
There is an entire discussion on running on a RPi here: https://bitcointalk.org/index.php?topic=5196287.0 (https://bitcointalk.org/index.php?topic=5196287.0)

It's not simple but you can do it with some tinkering.

-Dave


Title: Re: Full node on Raspberry 3: Out of memory
Post by: ABCbits on January 03, 2020, 07:06:03 PM
You need to configure your Bitcoin Core to use less resource. Try this answer https://bitcoin.stackexchange.com/a/50743 (https://bitcoin.stackexchange.com/a/50743)


Title: Re: Full node on Raspberry 3: Out of memory
Post by: DaCryptoRaccoon on January 03, 2020, 09:04:02 PM
It looks like compile may run out of memory.

You could try 'free -m' option to check your free memory then if you need to you can add some swap space with the code below.

You many need to use sudo command for the swap space.

To add a 1gb swap file, in /swapfile:


Code:
sudo dd if=/dev/zero of=/swapfile bs=1024M count=1000
sudo mkswap /swapfile
sudo swapon /swapfile


After compiling turn OFF swap

Code:
Code:
sudo swapoff /swapfile
sudo rm /swapfile


Title: Re: Full node on Raspberry 3: Out of memory
Post by: Carlton Banks on January 04, 2020, 08:37:50 AM
add a 1gb swap file

if you can avoid it, don't create the swapfile on the SD card but instead on an external disk, preferably an SSD (swapping memory pages between the swapfile and RAM is a performance bottleneck). The constant writing to the SD card will kill the card far quicker than you would expect otherwise.


Title: Re: Full node on Raspberry 3: Out of memory
Post by: BitcoinFX on January 04, 2020, 11:13:20 AM
It looks like compile may run out of memory.

You could try 'free -m' option to check your free memory then if you need to you can add some swap space with the code below.

You many need to use sudo command for the swap space.

To add a 1gb swap file, in /swapfile:


Code:
sudo dd if=/dev/zero of=/swapfile bs=1024M count=1000
sudo mkswap /swapfile
sudo swapon /swapfile


After compiling turn OFF swap

Code:
Code:
sudo swapoff /swapfile
sudo rm /swapfile

I'd be inclined to make the swapfile persistent, I usually do ...

Code:
sudo dd if=/dev/zero of=/swapfile bs=64M count=16

where count=4 = 256 MB , count=8 = 512 MB , count=16 = 1G , count=32 = 2G etc.

Code:
sudo chmod 600 /swapfile

Code:
sudo mkswap /swapfile
sudo swapon /swapfile

make swapfile persistent ...

Code:
sudo nano /etc/fstab

add at base of file ...

Code:
/swapfile   none    swap    sw    0   0

...

also for server ...

Code:
sudo nano /etc/sysctl.conf

add at base of file ...

Code:
vm.swappiness = 60
vm.vfs_cache_pressure = 50

desktop !
vm.swappiness = 10

check with ...

Code:
cat /proc/sys/vm/vfs_cache_pressure
cat /proc/sys/vm/swappiness

other useful commands ...

check for existing swapfile ...

Code:
sudo swapon -s

filesystem (diskspace) ...

Code:
df -h

...

running ...

Code:
top

in a new terminal window (or Screen) is always useful for monitoring %CPU and %MEM to gain a better indication of what is actually happening.

I've not run an RPi in a while, although as Carlton has said an SSD is the safer bet.

 :)


Title: Re: Full node on Raspberry 3: Out of memory
Post by: JorisK on January 04, 2020, 12:09:50 PM
You need to configure your Bitcoin Core to use less resource. Try this answer https://bitcoin.stackexchange.com/a/50743 (https://bitcoin.stackexchange.com/a/50743)

Awesome, I left out the mempool and lowered the signaturecache as well, and now memory usage flows around 500MB (I have 1GB).

Looks like I can move on, many thanks everyone!