Search This Blog

Wednesday, January 24, 2024

Raspberry Pi: How to mine Monero

As I was looking for projects for Raspberry Pi I found a video on Youtube that NetworkChuck had posted. One project that I wanted to try for a few days was to mine cryptocurrency on the device, mostly to see if it was possible and learn what the process looks like. While the Pi 5 is the most powerful yet, it does not compare to dedicated mining machines. Simply put, it was interesting to learn but not a profitable venture in the slightest.

Some things to consider are the following:

- You are part of a miner pool, since your hardware might be weak you pool your resources with others and thus share the rewards with the pool

- There is a minimum payment threshold before the currency is sent to your wallet, I mined for 4-5 days straight and did not see any results in the wallet.

Download and install the wallet

I used the basic GUI wallet from Monero, they have a regular installer for Windows.

You install it like any other app, keep in mind that you can avoid the 90gb storage by running it in simple mode. It will take a while to sync the so called blockchain when starting up the wallet, but you avoid having to deal with 90gb of storage. A server somewhere else will be handling this for you, so it is also less anonymous if that is important for you.

Pro tip: Store your account recovery details, passwords etc. safely.

In your wallet you can find your wallet address under the account tab, use this when you start your Monero miner on the Raspberry Pi 5 later.

To install the miner

First I created a folder called monero.

Then went into the folder, ran the following code from the terminal:

sudo apt install git build-essential cmake libuv1-dev libssl-dev libhwloc-dev -y

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

cd xmrig

mkdir build && cd build

cmake ..

make

To start the miner 

Be in the build folder and enter the command below. You define which pool, which address and what you want to name your miner in case you have several computers mining at the same time.

./xmrig -o gulf.moneroocean.stream:10128 -u <wallet adress goes here> -p pi5

While it is mining you can press H to check your hashrate, higher is better. To see what you have contributed press S. Press C to check your connection, such as your difficulty.

To stop the miner

Ctrl + C, like any other command in a terminal

Friday, January 19, 2024

Raspberry Pi 5: Ubuntu server installation

Prerequisites

To get Ubuntu Server on Raspberry Pi it was actually as easy as just getting the Raspberry Pi imager from the official website.

Install it and run it directly.

Choose device (raspberry pi 5), choose OS (other general-purpose OS -> Ubuntu -> Ubuntu Server)

Choose a device to flash it to.

You will have options to include into your file, these are important. You want to set up wifi, make sure SSH is active and set an admin login, this is used later when you SSH in with PowerShell and when you login to the server with RDP. 

Flash the OS to the SD card, you are now done with the first step.

First time booting Ubuntu Server on Raspberry Pi 5

Put the SD card in the device. Keyboard, mouse and monitor is optional as you can manage the device wirelessly and remotely right away if you performed the options detailed in part 1.

Go to your router and find the IP address of the device, this is used in next step.

Open PowerShell and write ssh admin@192.168.0.X where admin is the user name and X is the last part of the IP address. Confirm with password. SSH is a secure alternative to Telnet.

You will then be taken to an admin prompt that takes linux commands.
You might want to start with the following command:

sudo apt-get update && sudo apt-get upgrade

Make sure to confirm if it prompts you.  

GUI and RDP to Ubuntu Server

The last step was to configure a desktop experience and RDP.

For the deskop experience I simply ran two commands, it would seem that the first one is required.

sudo apt install ubuntu-desktop-minimal

sudo apt-get install xfce4

If prompted, I went with the option lightdm and I restarted all serviced that asked me too, some which also disconnected me from the internet.

For the RDP I first ran the following command:

sudo apt install xrdp -y

Followed by this command that shows you if the installation went alright.

sudo systemctl status xrdp

After that I could RDP using the built-in solution on Windows. Some sources claim you need to fix ssl certs and restart the service, but I could start it right away.

Configure your RDP from your Windows computer

Configure a RDP link on your desktop with the following steps:

1. Open remote desktop connection from your start menu

2. Pick "show options"

3. Computer should be the IP address, user name is the one you entered at the flashing of the image

4. Save as, place it in a good location. Now you can use it and just entering your password.

When you login using RDP you will be greeted with a more familiar desktop experience.


Enjoy!

Windows 11: Hosting a Minecraft Bedrock server

This post will cover various steps to get a Minecraft server running on Windows 11.

For my experiment I was running it on an old laptop with x64 processor, it can also run bedrock server on the ARM-architecture and Ubuntu Server. For the sake of this post we will in other words just assume that you are running Win 11 and want to install the Bedrock server.

Prerequisites

I downloaded the server first and noticed that I was missing the Visual C++ Redistributable.
So my recommendation is to download both.



Once both are installed you need extract the bedrock zip-file as well, and place the extracted folder in a place that you are familiar with. I created a C:\Minecraft\ folder in which I placed it.

Configuring your server

As I already have a world on another computer, I wanted to transfer this world and keep it on the server instead.

To find your world, go to %localappdata% then go to 

...\Packages\Microsoft.MinecraftUWP_8wekyb3d8bbwe\LocalState\games\com.mojang\minecraftWorlds

Within this directory each world has its own folder. Move this folder to your server computer.
You will have configuration file in your bedrock server folder in which you can point towards this world.

Getting your server online and available

If you don't make any changes and just run the bedrock_server.exe right of the bat, it becomes instantly available in the Minecraft client on another computer on the same network. Basically it is considered a LAN server and it is not available online for others to join.

Joining the server

To join the server on regular LAN, just open your Minecraft Bedrock client on the computer you intend to play from and make sure you are on the same network. Then you should find the world in the "server" section in the game.


Review: SanDisk Extreme 128GB and Kingston DataTraveler Micro Metal 256GB

As part of my Raspberry Pi 5 inital experimentation, I got some high quality hardware as well.

I decided to test the hardware using CrystalDiskMark.
These are the results of some quick testing.

Kingston DataTraveler Micro Metal 256GB:




SanDisk Extreme 128GB:



As you can see, the SD card performs well where the USB drive is not, and vice versa. I am currently running my Ubuntu Server off of the SD-card and using the USB drive as extra storage.

Raspberry Pi 5: Installing Windows 11

Previously I have had a Raspberry Pi 3b+  and after that I had a Raspberry Pi 4, 8GB, both which I ran Windows 10 on. Times have changed and I got the next generation of this single board computer now. During my research I found out that there now are people that have managed to get Windows 11 Enterprise running on a Raspberry Pi 5. 

Keep in mind that the platform uses ARM processor so that you will get that version of Windows, but it is also supposed to have a built-in system that can simulate the x64 architecture.

One of my experiments that I have planned, is to keep a Minecraft Bedrock server running on my Raspberry Pi 5 that will be installed with Windows 11.

The hardware

For this project I got the following hardware which set me back €178 or 1999 SEK.
The following is a breakdown of the costs converted to EUR.

SanDisk Extreme microSD card (128gb) €27

Kingston DataTraveler Micro Metal (256gb) €22

Raspberry Pi 5 (8gb) €76

Original case with fan €9

Charger €11

Import fee/VAT €33

I bought my Raspberry Pi 5 from The Pi Hut. The purchase experience was relatively smooth, but the transport time was super slow (keep in mind that I had already been waiting quite some time since my pre-purchase). Then the Pi got stuck in transit because I had to pay €30 in import fees as well. It was shipped around 29:th of December and has to this date not yet arrived. Something to keep in mind when you pick your point of purchase in other words.

The installation process

For this experiment, I followed this video to get Windows 11 on Raspberry Pi 5.

You will need UEFI-files (the files used for booting up pretty much) which can be downloaded here
Once downloaded, unzip the archive and place the files on your SD-card. The SD-card needs to be formatted as FAT32, I had trouble flashing it so had to partition it to a part that was smaller than 32GB.

Download the Win11 Enterprise ARM64 image as well from this link, this is what you flash to the USB.
As of January 2024 I used the following settings: Windows 11, latest build, ARM64 architecture, Enterprise edition and English (UK) as language.

You will need the WoR (Windows on Raspberry) program, this contains the script that allows flashing of the iso. Download and then extract contents to a new folder that you name to something intelligible.

Start WoR.exe as admin, go through the guide, make sure to choose Raspberry Pi 3. This is because boot files and main OS are kept separately at this stage. This step took a long time, so make sure to start early.

Put the SD card and the USB into the Raspberry Pi and your peripherals, then boot it up. After that it is pretty much a standard Windows 11 experience, but you are not running an activated version so you will miss out on certain customization.

Verdict

Well, after a lot of struggle I managed to get it running. The experience albeit familiar, it was also extremely slow, you can not do anything practical with this setup at this point. There can be minutes of delay after pressing a key and SFC /scannow and the DISM restorehealth commands can take hours, just to fail. Getting a bedrock server on this setup would not be feasible, neither RDP or Enable-PSRemoting worked.

Perhaps in the future there will be a better experience, but for now my recommendation is to not run with this setup. It was a good experiment.


Sunday, January 14, 2024

Windows 11: Change boot logo follow-up

Fix for missing A: drive during HackBGRT image replacement

This post is a follow-up for the original post that I made, that you can find here. I had just downloaded HackBGRT again after the computer had been trying out different OS:es and had a complete reformatting of the harddrive. This time the changing of the boot logo would not work because I experienced issues during the replacement of the image itself.

When the cmd window that HackBGRT opens up you eventually should be able to see the A: drive using the file explorer from Paints "open file" function. On my computer this time the A: drive would not show up. This post is simply a quick description of how I could work around it.

1. First I ran the script like normal, but I couldn't find the A: drive so I just saved the image over the default image that HackBGRT comes with. Then I exited the script and rebooted, it had at least updated the attached image but not my image. This means that the script is working.

2. I saved my image in a location that was easy to access.

3. Open PowerShell as admin and entered the following commands:
diskpart
sel disk 0
list part
sel part 0 (or whatever number corresponds to your EFI drive)
assign letter=A
exit

4. Still in admin PowerShell I entered the following code to copy the image and overwrite the one in A:
Copy-Item -Path C:\temp\splash.bmp -Destination A:\EFI\HackBGRT\ -Force

5. Reboot the computer and see if the logo has changed.