Shazam1990
Posts: 1
Joined: Thu Mar 04, 2021 10:27 am

Xmrig on Raspberrypi OS 32-bit

Thu Mar 04, 2021 10:43 am

Steps to install Xmrig XMR miner on your raspberypi OS 32-bit.

1. sudo apt update && sudo apt full-upgrade
2. sudo apt-get clean
3. sudo shutdown -r now (system will reboot)
4. sudo apt-get install -y raspbian-nspawn-64
5. ds64-shell
6. sudo apt-get install git build-essential cmake libuv1-dev libssl-dev libhwloc-dev
7. git clone https://github.com/xmrig/xmrig.git
8. cd xmrig
9. mkdir build
10. cd build
11. cmake ..
12. make

This process will take some time so please be paitent. Once completed visit https://xmrig.com/wizard to create your config.json file.

13. place your config.json file in /xmrig/build

Now lets start your miner using your config.json settings
./xmrig -c

or to start manually...

14. ./xmrig --donate-level 1 -o xmrpool.eu:5555 -u 46792AW3DDgQAbVVS3jj4ZLFRqrGwAGGJ91Y9QSmjCCQ122BxBBa51ke1W9284auBcjS438ZdLD8ebDfpo7tk3M71wCfi7t -p YourWorkerName

You miner should now be running!

If like me you like automation, then the below instructions will be of interest to you..

The steps provided in this post as of 4th March 2021 still work very well.

I've been fiddling for 2 hours with this and finally achieved "Automine on boot". (may be useful to some)

Assumptions, the "xmrig" executable is in /home/pi/xmrig/build/, and you have a correct config.json file.

1. Follow this article to install and build everything.
2. In terminal run "chmod +x /home/pi/xmrig/build/xmrig"
3. In terminal run "touch /home/pi/xmrig.log"
4. In terminal run "sudo nano /lib/systemd/system/xmrig.service"
5. Paste:
[Unit]
Description=PiMiner
After=multi-user.target

[Service]
Type=idle
ExecStart=/usr/bin/ds64-run /home/pi/xmrig/build/xmrig -c -B --log-file="/home/pi/xmrig.log"

[Install]
WantedBy=multi-user.target

6. In terminal run "sudo systemctl daemon-reload"
7. In terminal run "sudo systemctl enable xmrig"
8. Either reboot the pi ("sudo reboot now") or in terminal run "sudo systemctl start xmrig"

The only issue is that you no longer see the mining console. You can run in terminal "tail /home/pi/xmrig.log" or view the entire log file. No nice GUI, but all the same logs are there. (I personally would welcome any suggestion with instruction, for how to do this if at all possible. i would then add such detail to this post)
Last edited by Shazam1990 on Fri Mar 05, 2021 4:31 pm, edited 1 time in total.

raspberrydaz
Posts: 1
Joined: Fri Mar 05, 2021 7:19 am

Re: Xmrig on Raspberrypi OS 32-bit

Fri Mar 05, 2021 7:29 am

Great concise write up and it's appreciated. My first day using a Pi today, and making progress. Everything worked quite well in this, except for the final automation. Each step seemed to complete ok, however both reboot, or "sudo systemctl start xmrig" failed to start xmrig. I checked CPU usage in top to confirm.

Apologies for my obvious lack of linux / debian knowledge. I'm not sure how to troubleshoot this further.

wh7qq
Posts: 1579
Joined: Thu Oct 09, 2014 2:50 am

Re: Xmrig on Raspberrypi OS 32-bit

Fri Mar 05, 2021 5:01 pm

I can't attest to the accuracy of the citation or it's applicability to the Arm processors but found it when I searched on Xmrig: https://support.alertlogic.com/hc/en-u ... nero-Miner. Be Careful!

Pepijnvdhoek
Posts: 1
Joined: Sat Mar 27, 2021 11:51 am

Re: Xmrig on Raspberrypi OS 32-bit

Sat Mar 27, 2021 11:53 am

Thanks a lot for your post!

Something went wrong when i'm doing this

Steps to install Xmrig XMR miner on your raspberypi OS 32-bit.

1. sudo apt update && sudo apt full-upgrade
2. sudo apt-get clean
3. sudo shutdown -r now (system will reboot)
4. sudo apt-get install -y raspbian-nspawn-64
5. ds64-shell
6. sudo apt-get install git build-essential cmake libuv1-dev libssl-dev libhwloc-dev
7. git clone https://github.com/xmrig/xmrig.git
8. cd xmrig
9. mkdir build
10. cd build
11. cmake ..
12. make

After coding sentence 11, cmake .. i got a error; bash: cmake : command not found. Could you help me? Thanks a lot buddy

newtoid
Posts: 1
Joined: Fri Apr 30, 2021 4:07 pm

Re: Xmrig on Raspberrypi OS 32-bit

Fri Apr 30, 2021 4:19 pm

Thanks for the steps - I went through this and set up on 4 Pis that I had sat doing nothing - it worked fine. I set up a monero wallet with the Freewallet app and I think I should be able to retire in about 3800 centuries :-)

In the config step, I gave each Pi a different worker name and added the same wallet address. I haven't seen anything happen in the wallet yet but I am seeing accepted transactions in the logs. I am going to fine-tune the pi config and hopefully, I will bring retirement forward by maybe 1000 centuries.

bassamanator
Posts: 119
Joined: Wed Jun 10, 2020 7:04 am

Re: Xmrig on Raspberrypi OS 32-bit

Sat May 01, 2021 2:11 am

@Shazam1990 What's the hash rate?
| Raspberry Pi 4-8GB | 2.0GHz | over_voltage@5 |
| Raspberry Pi OS 32bit |
| https://github.com/bassamanator/raspberrypi-scripts |

fabioneto
Posts: 1
Joined: Sat May 15, 2021 1:53 pm

Re: Xmrig on Raspberrypi OS 32-bit

Sat May 15, 2021 1:56 pm

Error after "cmake .." command
root@debian-buster-64:~/xmrig/build# cmake ..

-- The CXX compiler identification is unknown
CMake Error at CMakeLists.txt:2 (project):
No CMAKE_CXX_COMPILER could be found.

Tell CMake where to find the compiler by setting either the environment
variable "CXX" or the CMake cache entry CMAKE_CXX_COMPILER to the full path
to the compiler, or to the compiler name if it is in the PATH.


-- Configuring incomplete, errors occurred!
See also "/root/xmrig/CMakeFiles/CMakeOutput.log".
See also "/root/xmrig/CMakeFiles/CMakeError.log".
root@debian-buster-64:~/xmrig/build#

derkaramma

Re: Xmrig on Raspberrypi OS 32-bit

Tue May 18, 2021 9:26 pm

I'm having trouble. I have followed the steps multiple times and know im doing everything correctly but the ./xmrig command does not work. I notice that no matter how many time I try the script doesn't even get added to the xmrig folder. Does anyone have any solution? I have it working fine on my Mac but can't get that file to populate from the GitHub clone

jk101290
Posts: 1
Joined: Sat May 22, 2021 4:13 am

Re: Xmrig on Raspberrypi OS 32-bit

Sat May 22, 2021 4:32 am

Unfortunately can't get passed step 6.

Starting the container:

Code: Select all

ds64-shell
Connected to machine debian-buster-64. Press ^] three times within 1s to exit session.
Then try to get these libraries:

Code: Select all

sudo apt-get install git build-essential cmake libuv1-dev libssl-dev libhwloc-dev
And then when attempting to acquire any of those libraries I get

Code: Select all

Err:1 http://deb.debian.org/debian buster/main arm64 perl-modules-5.28 all 5.28.1-6
  Temporary failure resolving 'deb.debian.org'
  
E: Failed to fetch http://deb.debian.org/debian/pool/main/p/perl/perl-modules-5.28_5.28.1-6_all.deb  Temporary failure resolving 'deb.debian.org'
etc and so on and so forth. Does the same for apt update. This only happens while the container is on.

Seems like a "me" problem. Maybe because I'm running pihole and wireguard vpn on this pi.

Raspbian-nspawn-64 is apparently EOL so I can't open an issue there. I'll have to retry on a clean install.

Hoagie
Posts: 120
Joined: Sun Sep 23, 2012 7:19 pm

Re: Xmrig on Raspberrypi OS 32-bit

Sun May 23, 2021 7:57 am

A quick note on this. It needs a 64 bit CPU so won't work on older Pis or Pi zeros.

fruitoftheloom
Posts: 27225
Joined: Tue Mar 25, 2014 12:40 pm

Re: Xmrig on Raspberrypi OS 32-bit

Sun May 23, 2021 8:13 am

Hoagie wrote:
Sun May 23, 2021 7:57 am
A quick note on this. It needs a 64 bit CPU so won't work on older Pis or Pi zeros.

It will not *function* on BCM2835 & BCM2836 SoC Raspberry Pis:

https://github.com/sakaki-/raspbian-nspawn-64
Take what I advise as advice not the utopian holy grail, and it is gratis !!

mikatachan
Posts: 1
Joined: Wed Jul 14, 2021 7:39 pm

Re: Xmrig on Raspberrypi OS 32-bit

Wed Jul 14, 2021 7:59 pm

I figured out a different automation method using 2 shell scripts. This will run in the background so you can't see it, but it's good if you don't check up on your pi that often:

Script 1: Create an executable "xmrig.sh" (chmod -x ~/xmrig.sh) to open 64-bit terminal and run xmrig. Running as sudo to allow large pages and outputting a log file:

Code: Select all

#!/usr/bin/ds64-shell
cd ~/xmrig/build/
sudo ./xmrig -o PoolAddress -u YourWalletAddress -p YourWorkerName --log-file=xmrig_log.txt

Script 2: Create an executable restartxmrig.sh to test to see if a script is running:

Code: Select all

#!/bin/bash
getscript() {
  pgrep -lf ".[ /]$1( |\$)"
}
script1=xmrig.sh
if getscript "$script1" >/dev/null; then
  exit
  else
  ./xmrig.sh
fi

Finally create a crontab command to check every 5 min: */5 * * * * /home/pi/restartxmrig.sh. Cheers!

puccaso
Posts: 54
Joined: Mon Oct 29, 2018 9:56 pm

Re: Xmrig on Raspberrypi OS 32-bit

Wed Nov 03, 2021 9:08 pm

So im using the 64bit build on ubuntu 21.10
Single thread gives me 75 h/s, dual core gives MAX 120 h/s, so for 4 cores, this should do about 250 - but its seems impossible.

DarkHorseSki
Posts: 1
Joined: Sat Dec 04, 2021 11:58 pm

Re: Xmrig on Raspberrypi OS 32-bit

Sun Dec 05, 2021 12:02 am

So, how do I check the status of the miner once I have closed the SSH to the Raspberry Pi once? In other words, once I log back into the Pi, how can I tell if the miner is still mining and how can I get back to watching it mine?

stanely
Posts: 12
Joined: Fri Mar 13, 2020 2:26 am

Re: Xmrig on Raspberrypi OS 32-bit

Wed Jan 12, 2022 6:57 pm

I too had problems with getting apt-get to work. It errored out and anything after didn't work because commands were not found. As a testament to the saying, "Even a blind squirrel finds an acorn once in a while," and after much googling, I think I found the problem. I also sort of, kinda understand why. What fixed it was doing this after the "ds64-shell" command:

Code: Select all

sudo apt-get update --allow-releaseinfo-change
Reason is because the repository info changed and loads won't work because of security. You can see more here:

https://linuxtutorials.org/This-must-be ... r-details/

Hopefully it makes more sense to you.

After the above addition, the rest all worked, and the rPi image was built successfully. I'm mining with my Pi 4B. I only have 2GB RAM, and my hashrate looks to be around 40.

Thank you very much for this tutorial!!!

Heater
Posts: 19101
Joined: Tue Jul 17, 2012 3:02 pm

Re: Xmrig on Raspberrypi OS 32-bit

Wed Jan 12, 2022 7:12 pm

Did anyone make any money yet? Above the price they paid for the Pi?

What is it with all the desperate attempts to make money out of nothing?
Memory in C++ is a leaky abstraction .

lurk101
Posts: 1557
Joined: Mon Jan 27, 2020 2:35 pm
Location: Cumming, GA (US)

Re: Xmrig on Raspberrypi OS 32-bit

Wed Jan 12, 2022 10:53 pm

Heater wrote:
Wed Jan 12, 2022 7:12 pm
Did anyone make any money yet? Above the price they paid for the Pi?

What is it with all the desperate attempts to make money out of nothing?
You're not making money of nothing, you're converting energy to to virtual currency at a loss.
It took 60 years of very difficult engineering to go from the invention of transistors to the smartphone with no new physics involved in the process.

Daemon7
Posts: 1
Joined: Sun Jan 23, 2022 5:53 am

Re: Xmrig on Raspberrypi OS 32-bit

Sun Jan 23, 2022 5:58 am

newbie issue here. When I run step 11 "cmake .." I get the following error.

~/xmrig/build $ cmake ..
-- The CXX compiler identification is unknown
CMake Error at CMakeLists.txt:2 (project):
No CMAKE_CXX_COMPILER could be found.

Tell CMake where to find the compiler by setting either the environment
variable "CXX" or the CMake cache entry CMAKE_CXX_COMPILER to the full path
to the compiler, or to the compiler name if it is in the PATH.


-- Configuring incomplete, errors occurred!
See also "/home/pi/xmrig/build/CMakeFiles/CMakeOutput.log".
See also "/home/pi/xmrig/build/CMakeFiles/CMakeError.log".




and that error log contains this...

ompiling the CXX compiler identification source file "CMakeCXXCompilerId.cpp" failed.
Compiler: CMAKE_CXX_COMPILER-NOTFOUND
Build flags:
Id flags:

The output was:
No such file or directory



Any guidance would be greatly appreciated.

stanely
Posts: 12
Joined: Fri Mar 13, 2020 2:26 am

Re: Xmrig on Raspberrypi OS 32-bit

Mon Jan 24, 2022 2:41 pm

I've been playing around with my xmrig pi for a couple weeks and wanted to comment on profitability... or lack thereof.

As per the original instruction (with my apt-get fix), the stock xmrig gives a 2gb 4B pi around 40 H/s. Using the cryptocompare profitability calculator, https://www.cryptocompare.com/mining/calculator/xmr, with the following parameters:

40 H/s
7 Watts
0.1082 /kWh
0% pool fee
Yields a loss of $0.02 per day ($6.31/year)

This is not an ad for moneroocean, but... moneroocean has a fork of xmrig that profiles your hardware for hashrate using different algorithms, and then selects the most efficient one for your hardware. The pool automatically adjusts your jobs' difficulty to maximize your success performance and minimize network communication. The algorithm auto-selection means you might be mining in a different coin than the XMR. The pool automatically converts your mined shares into XMRs and tracks your income by showing your hardware's performance in the equivalent XMR hashrate.

So, using the method above, I compiled moneroocean's xmrig on my pi, and it turns out the pi is best suited for mining the Dero using the astrobwt algorithm. My equivalent XMR pay hashrate jumped from around 40 to around 300! Using this number in the calculator, I'm losing only $0.01 per day ($4.19/year).

Note that I did this test right after crypto currency values crashed, with the Monero worth only $137.54. Break even is a little over $200.

To get moneroocean's xmrig source you have to use this command in line 7 of the original post:

7. git clone https://github.com/moneroocean/xmrig.git

The rest is the same. I created a new directory for the moneroocean source (mkdir mo) so I could have both versions to compare.

stanely
Posts: 12
Joined: Fri Mar 13, 2020 2:26 am

Re: Xmrig on Raspberrypi OS 32-bit

Mon Jan 24, 2022 2:46 pm

Daemon7 wrote:
Sun Jan 23, 2022 5:58 am
newbie issue here. When I run step 11 "cmake .." I get the following error.

~/xmrig/build $ cmake ..
-- The CXX compiler identification is unknown
CMake Error at CMakeLists.txt:2 (project):
No CMAKE_CXX_COMPILER could be found.

Tell CMake where to find the compiler by setting either the environment
variable "CXX" or the CMake cache entry CMAKE_CXX_COMPILER to the full path
to the compiler, or to the compiler name if it is in the PATH.


-- Configuring incomplete, errors occurred!
See also "/home/pi/xmrig/build/CMakeFiles/CMakeOutput.log".
See also "/home/pi/xmrig/build/CMakeFiles/CMakeError.log".




and that error log contains this...

ompiling the CXX compiler identification source file "CMakeCXXCompilerId.cpp" failed.
Compiler: CMAKE_CXX_COMPILER-NOTFOUND
Build flags:
Id flags:

The output was:
No such file or directory



Any guidance would be greatly appreciated.
I think the reason is that you need to do this:

Code: Select all

sudo apt-get update --allow-releaseinfo-change
right after the ds64-shell in the original instructions. Please see my prior post.

Growingsphere52
Posts: 4
Joined: Wed Jul 29, 2020 1:04 am

Re: Xmrig on Raspberrypi OS 32-bit

Tue Feb 01, 2022 5:18 pm

That ds64-shell thing no longer works. I found a article that uses the 64bit os.
https://cryptoandpi.cf/blog/posts/minin ... pi-in-2022

Heater
Posts: 19101
Joined: Tue Jul 17, 2012 3:02 pm

Re: Xmrig on Raspberrypi OS 32-bit

Tue Feb 01, 2022 5:52 pm

lurk101 wrote:
Wed Jan 12, 2022 10:53 pm
Heater wrote:
Wed Jan 12, 2022 7:12 pm
Did anyone make any money yet? Above the price they paid for the Pi?

What is it with all the desperate attempts to make money out of nothing?
You're not making money of nothing, you're converting energy to to virtual currency at a loss.
Quite so. That is why I said "desperate attempts".

Interestingly nobody has replied to my question.
Memory in C++ is a leaky abstraction .

stanely
Posts: 12
Joined: Fri Mar 13, 2020 2:26 am

Re: Xmrig on Raspberrypi OS 32-bit

Tue Feb 01, 2022 6:04 pm

Growingsphere52 wrote:
Tue Feb 01, 2022 5:18 pm
That ds64-shell thing no longer works. I found a article that uses the 64bit os.
https://cryptoandpi.cf/blog/posts/minin ... pi-in-2022
The ds64-shell works fine for me, and it builds and runs xmrig as a 64-bit application. The instructions you linked look like result in a 32-bit application. What kind of hashrate are you getting with that approach?

stanely
Posts: 12
Joined: Fri Mar 13, 2020 2:26 am

Re: Xmrig on Raspberrypi OS 32-bit

Tue Feb 01, 2022 6:09 pm

Heater wrote:
Tue Feb 01, 2022 5:52 pm
lurk101 wrote:
Wed Jan 12, 2022 10:53 pm
Heater wrote:
Wed Jan 12, 2022 7:12 pm
Did anyone make any money yet? Above the price they paid for the Pi?

What is it with all the desperate attempts to make money out of nothing?
You're not making money of nothing, you're converting energy to to virtual currency at a loss.
Quite so. That is why I said "desperate attempts".

Interestingly nobody has replied to my question.
I made about $ -0.006 US. But the price of the XMR is down now like all other crypto. If it was back to over $ 200, I would be rolling in the pennies. :)

Like everyone else in this forum, I've got Pi's laying around from IOT projects. For me, the cost of the Pi itself is not a factor.

Why are you so mad about people having fun with their Pi?

Heater
Posts: 19101
Joined: Tue Jul 17, 2012 3:02 pm

Re: Xmrig on Raspberrypi OS 32-bit

Tue Feb 01, 2022 7:45 pm

stanely wrote:
Tue Feb 01, 2022 6:09 pm
I made about $ -0.006 US. But the price of the XMR is down now like all other crypto. If it was back to over $ 200, I would be rolling in the pennies. :)
Is that accounting for the cost of the electricity used?
stanely wrote:
Tue Feb 01, 2022 6:09 pm
Why are you so mad about people having fun with their Pi?
I'm not. I'm all for it.
stanely wrote:
Tue Feb 01, 2022 6:09 pm
For me, the cost of the Pi itself is not a factor.
There is the opportunity cost. One could be doing something more educational/inspiring/useful with the Pi. More importantly one could have been doing something more worthy with ones time than installing useless software.

Perhaps it's just that I don't see the fun in installing some software and then having it sit around doing achieving nothing for ages. About as much fun as watching paint dry.

More seriously I have a downer on the whole crypto currency thing as it's burning energy for no useful purpose. You know, pollution, CO2, global warming, and all that.
Memory in C++ is a leaky abstraction .

Return to “General discussion”