I've read a lot of people posting on various Monero forums wanting to mine Monero on the Raspberry Pi, or other ARM SBC's. Out of curiosity, I decided to compile a release on XMRig for the Pi, and while the performance wasn't great, (15-20 H/s) running in RandomX "light mode", I figured it wouldn't hurt to post a tutorial on how to do this, and perhaps others could improve on my work!
In order to mine on the raspberry pi, you need to have a chroot environment set up, so that you can use aarch64 applications, such as XMRig. If setting up a chroot and compiling the software isn't something you want to spend time doing, simply download my pre-built raspberry pi image, and flash it to a 16GB card. It has ssh enabled (default password raspberry), and will auto load a chroot with xmrig, simply run
./xmrig --help
to see the available options.You can create this chroot by running the below commands, modified from this XMRig issues post.
sudo apt install -y debootstrap schroot
cat << EOF | sudo tee /etc/schroot/chroot.d/pi64
[pi64]
description=VC4 arm64 testing
type=directory
directory=/srv/chroot/pi64
users=pi
root-groups=root
profile=desktop
personality=linux
preserve-environment=true
EOF
sudo debootstrap --arch arm64 stable /srv/chroot/pi64
sudo schroot -c pi64 -- apt install -y sudo gcc libssl-dev libuv1-dev libnuma-dev libhwloc-dev cmake
From there, you can run cat << EOF | sudo tee /etc/schroot/chroot.d/pi64
[pi64]
description=VC4 arm64 testing
type=directory
directory=/srv/chroot/pi64
users=pi
root-groups=root
profile=desktop
personality=linux
preserve-environment=true
EOF
sudo debootstrap --arch arm64 stable /srv/chroot/pi64
sudo schroot -c pi64 -- apt install -y sudo gcc libssl-dev libuv1-dev libnuma-dev libhwloc-dev cmake
schroot -c pi64
to enter your new chroot environment, which can now support the compilation and running of 64-bit programs like XMRig!
Once we're in the chroot environment, we pretty closely follow the build process on the official XMRig github. Simply run these commands in the new chroot environment to build a copy of XMRig.
sudo apt-get install git build-essential cmake libuv1-dev libssl-dev libhwloc-dev
git clone https://github.com/xmrig/xmrig.git
cd xmrig && mkdir build && cd build
cmake ..
make
Now, you have a fully working XMRig binary in the build directory, which you can use to mine Monero, Dero, or anything else! Leave a comment if you have any questions, or if you have another ARM board/mining software that you would like to see a tutorial for. I plan on doing a whole series of these, so if there's anything in particular you want to see, please recommend it. In addition, if you either are willing to donate a board, or donate enough for me to buy a specific board, I'll put it at the front of my priority queue to do a post on!
Donation links:
BTC - 1FtH4gHhHAA3zUu1L6QUaZH35QddxPTZru
XMR - 82Z27uhsegj5MJe8jbBMh78cWtepCREXC7tA6byatvWAGDi47x55e383ykdYoYSry6W6dr5dA4RisQMQT1sWa2CxCWiPXqD
SIA - a4abf2f42d333c181d493608f09f25c00871aaab81c2ea536082f9aaeb65177f16bc7165dad6
Please a monero randomx mining pool thank you
ReplyDeleteTry out https://xmr.2miners.com
DeleteWhen running: sudo debootstrap --arch arm64 stable /srv/chroot/pi64
ReplyDeleteI get: Unable to execute target architecture
Any ideas?
This comment has been removed by the author.
DeleteFirst you need to run the command below:
Deletesudo apt-get install -y raspbian-nspawn-64
You'll be prompted to enable 64-bit. Select Yes, hit Enter and reboot the system. Then you should be good to go and run:
sudo debootstrap --arch arm64 stable /srv/chroot/pi64
Hi, what version of Raspberry are you using?
ReplyDeleteThanks
How can i access the config to setuo internetconnection?
ReplyDeleteThanks for sharing Ian, nice write up and it works :-)
ReplyDeletehi, thanks for posting this. I have downloaded flashed and installed the image you provided but it won't let me login with raspberry as the pw, pls can you confirm login and pw again. Thanks
ReplyDeleterequesting Arweave miner please?
ReplyDeleteHello, when I run "MAKE" ends by mistake.
ReplyDeletemake[2]: *** [CMakeFiles/xmrig.dir/build.make:2429: CMakeFiles/xmrig.dir/src/crypto/cn/CnHash.cpp.o] Error 1
make[1]: *** [CMakeFiles/Makefile2:118: CMakeFiles/xmrig.dir/all] Error 2
make: *** [Makefile:84: all] Error 2
So, in theory one could use the arm64 on a Google Pixel line and mine... interesting.
ReplyDeletecat << EOF | sudo tee /etc/schroot/chroot.d/pi64
ReplyDelete> [pi64]
> description=VC4 arm64 testing
> type=directory
> directory=/srv/chroot/pi64
> users=pi
> root-groups=root
> profile=desktop
> personality=linux
> preserve-environment=true
> EOF
[pi64]
description=VC4 arm64 testing
type=directory
directory=/srv/chroot/pi64
users=pi
root-groups=root
profile=desktop
personality=linux
preserve-environment=true
root@160053:/home/pi/Python# sudo debootstrap --arch arm64 stable /srv/chroot/pi64
*************E: Unable to execute target architecture************
root@160053:/home/pi/Python# sudo schroot -c pi64 -- apt install -y sudo gcc libssl-dev libuv1-dev libnuma-dev libhwloc-dev cmake
is it possible to automatically start the minder when booting the pi up? so it wouldnt be neccessary to connect to it per ssh?
ReplyDelete