[Steem on RPi] How to Build steem for ARM64

in Steemit Dev Group3 years ago (edited)

I @etainclub am the developer of the PLAY STEEM mobile apps.

Related Posts

image.png

I successfully built the steemit/steem source for ARM64 which means steem witness node can be run on arm devices such as Raspberry Pi.

What I am trying now is to run a witness node on RPi 4B (8gb).

If you have been following my posts, you know what I am doing.

Here I will explain how to build the steem source for arm64.

Then I will explain how to make a docker image to use.

What I did

I modified the steem source code, mainly

  • removed equihash related codes
  • removed stacktrace codes
  • removed pow, pow2 codes

The modified version of source is in the repo:
https://github.com/EtainLove/steem/tree/0.23.x-arm64

There is a new branch, 0.23.x-arm64.

Failure

Here is the instruction as to how to build the steem.
https://github.com/steemit/steem/blob/master/doc/building.md

I failed to build the steem on RPi 4. It seems it requires more CPU cores and RAM. The build process was stuck around 74%.

1st Success

I tried to build the steem source on more high-end ARM board, which is Nvidia AGX Xavier which has 8 CPU and 32GB RAM.

Here the os is Ubuntu 18.04, but I built the source in a docker container based on ubuntu 18.04.

The build processes were successful, so I could build both steemd and cli_wallet.

Wow!

Dockerfile to build

https://github.com/steemfans/steem-docker-ex
I modified @ety001's the docker file to make a docker image to run a witness node.

Here is the repo of the modified Dockerfile:
https://github.com/EtainLove/steem-docker-ex

The changes are

  • base docker image for ARM64
  • new steem repo for ARM64
    That's it.

Failed to build on Apple M1 (MacBook Air)

Even thought M1 chip is based on ARM and has 8 CPU cores and 16G ram, it failed to build the steem. It is also stuck around 74% of the building process.

Docker Buildx on AMD64 pc

I tried to use docker buildx on AMD64 linux pc which is able to build multi-architecture images such as one for ARM64.
The machine is Intel i7-8550U having 8 CPU cores and 16G RAM.

You need to install the latest docker. My docker version is 20.10.8, build 3967b7d, which includes buildx.

If you do the following, you will see this.

$ docker buildx ls
default default running linux/amd64, linux/386

It says, you cannot build arm64 image on your machine. You need to do something specially to build arm64 image on amd64 machine.

The detailed procedure is here:
https://medium.com/@artur.klauser/building-multi-architecture-docker-images-with-buildx-27d80f7e2408

In a nutshell, install the following docker image for qmenu-user-static

$ docker run --rm --privileged multiarch/qemu-user-static --reset -p yes

Then run the following again and check you see arm64 in the platform list.

$ docker buildx ls
default * docker                  
  default default         running linux/amd64, linux/386, linux/arm64, linux/riscv64, linux/ppc64le, linux/s390x, linux/arm/v7, linux/arm/v6

Now you can build arm64 image on your machine.

So let's get started!

  1. download the steem-docker-ex repo from here:
    https://github.com/EtainLove/steem-docker-ex

  2. move to the repo and do the following

$ cd dkr
$ docker buildx build --platform linux/arm64 -t steem:latest .

Don't forget the . at the end of the last command.

Then you will get steem:latest docker image for arm64 architecture!

$ docker images
REPOSITORY                   TAG                 IMAGE ID       CREATED         SIZE
steem                        latest              e01a246b0d11   11 hours ago    1.55GB
$ docker inspect steem:latest
...
 "Architecture": "arm64",
        "Os": "linux",
        "Size": 1547274011,
        "VirtualSize": 1547274011,
        "GraphDriver": {
...

Copy the image to RPi4

Then what do do?

You need to copy the built docker image (steem:latest) to your RPi4.

  1. First you have to save the image as a tar file
$ docker save steem:latest > steem-arm64.tar
  1. Then, copy the resulting file to your RPi
$ scp steem-arm64.tar ubuntu@rpi (your rpi's ip)
  1. Load the image from the file.
    This command should be done in RPi where the tar file exists
$ docker load < steem-arm64.tar

The you will see the image

$ docker images
REPOSITORY                   TAG                 IMAGE ID       CREATED         SIZE
steem                        latest              e01a246b0d11   11 hours ago    1.55GB

Screenshots

Here are screenshots of working (no replay, syncing from the genesis).
I will use recent block_log to quickly sync. Wish me luck!

Thank You All

@ety001
@starlord28
@joviansummer
@steemchiller
@steem-agora

Resteem / Vote / Follow / Comment / Support

cc.
@steemcurator01
@steemitblog

Sort:  

Congrats on getting there!

@starlord

Haha. Got my tag wrong.

download the steem-docker-ex repo from here:
https://github.com/EtainLove/steem-docker-ex

Brought this up on discord today(On @ety001's repo though). The run.sh file has links to nodes that are now controlled by HIVE. So, even if you try to replay the blocks, you'd end up getting to FEB 2020 fairly quickly and then slows down even more. Additionally, the remote wallet points to a HIVE public node. So, if you plan on running the remote_wallet command to use the cli_wallet, then you would be publishing things to the HIVE network and not Steem. I'm not sure what the current steem web socket public node is. So, might want to get in touch with someone else to know the exact url.

sorry for the wrong mention. I corrected it.

What I am trying is not relaying, ety001 provides latest snapshot of witness block data. If I copy the data into the blockchain folder, then the rpi tries to sync from the data. I guess it will sync in a few minutes.

Yeah, wallet things seem weird. I forked @ety001's steem-docker-ex. I could generate a brain key not on rpi4 but on my linux machine (it was not working in Apple M1).

Thanks to the info. I will look into the cli_wallet stuff.

별도로 관련 내용을 포스팅하긴 했습니다만, 올리신 스크린샷을 보면 blockchain version이 0.23.0이라고 보이는데 현재 증인 목록을 보면 0.23.1이라고 나옵니다. 이 부분은 문제가 없을지 모르겠네요.

지금은 주로 업보팅/오토보팅에 주력하고 있지만, 나중에 여유가 되면 저도 하나 구동해보고 싶다는 생각이 듭니다!

그 부분은 저도 아리송하네요. steem 리포에서 최신 소스를 가져다 빌드를 한 거라서요. 아마 docker image 만든 사람이 버전을 올려서 만든게 아닐까 합니다. 소스는 동일하고요. 참고로 저는 master 브랜치가 아니라 0.23.x을 가져다가 빌드한 것입니다.

블록 파일 다운로드가 끝나면 동기화를 해볼 수 있을거 같습니다. 얼마 안남았네요.

고맙습니다.

아 그렇군요. 도커 이미지가 0.23.x 브랜치와 동일한 소스라면 문제 없을 것 같습니다. 결과가 기대됩니다. 흥미진진하군요.

thanks!

This post has been featured in the latest edition of Steem News...

Great efforts @etainclub, well done.

Coin Marketplace

STEEM 0.21
TRX 0.13
JST 0.030
BTC 68156.06
ETH 3517.56
USDT 1.00
SBD 2.81