Linux guide on arm devices

From Gridcoin
Jump to: navigation, search

Setting up the core system

First of all you need a running ubuntu version on your RaspberryPi 2

You can use the Image from here http://www.finnie.org/software/raspberrypi/2015-04-06-ubuntu-trusty.zip The next steps are a summary from the original how to for setting up your sd card.

The image is without ssh so if you want to work remotely on the RPI you need to install it first with

 sudo apt-get install openssh-server 

The next step is needed, when you are using a sd card which is bigger then 4gb. There is no automated script for using the whole space. You need to run the following commands:

 sudo fdisk /dev/mmcblk0

You need to delete the second partition by pressing d and then 2. Then re-create the partition by pressing n, p, 2, enter, enter and to write the changes to the disk w.

Reboot the system, then:

sudo resize2fs /dev/mmcblk0p2

You need to add a swap-file. The easiest way is to install dphys-swapfile

sudo apt-get install dphys-swapfile

Using Pre-Compiled Binaries

You have a choice of using pre-compiled binaries or compiling them yourself. I highly recommend using the pre-compiled binaries. This makes it quick and easy to get new versions through the regular apt-get updating process of Ubuntu. Instructions for adding the Ubuntu PPA are at Linux_Downloads_(pre-compiled). If you do this, then you can skip down to the Creating the Config File section.

Dependencies

For the above Ubuntu-img:

sudo apt-get install ntp git build-essential libssl-dev libdb-dev libdb++-dev libboost-all-dev libqrencode-dev libcurl4-openssl-dev curl libzip-dev libzip2 libboost1.55-all-dev

Build Gridcoin Daemon

To be able to compile, you need to tweak the source until it is updated in the git repo. First of all, get the source.

cd ~
git clone https://github.com/gridcoin/Gridcoin-Research

NOTE: If you already have Gridcoin, do this:

git fetch --all
git reset --hard origin/master

If you have trouble updating source from git:

git config --global http.sslverify false

After downloading the source we go into tweaking it.

 nano Gridcoin-Research/src/curlbuild.h

At line 530 add || defined(__arm__) so you get

#  if defined(__i386__) || defined(__ppc__) || defined(__arm__)

then run

mkdir ~/Gridcoin-Research/src/obj && cd ~/Gridcoin-Research/src && chmod 755 leveldb/build_detect_platform && make -f makefile.unix USE_UPNP=-

The compiling will take some time. When its finished you find the gridcoinresearchd in the src/ folder. Do the following steps.

strip gridcoinresearchd

sudo install -m 755 gridcoinresearchd /usr/bin/gridcoinresearchd

mkdir ~/.GridcoinResearch

cd ~/

chmod 700 .GridcoinResearch

cd .GridcoinResearch

Creating config file

nano ~/.GridcoinResearch/gridcoinresearch.conf

Copy and paste the following into the file:

email=<your email, must match your BOINC projects>
server=1
daemon=1
rpcallowip=127.0.0.1
rpcuser=<username (anything you want, does not need to match BOINC)>
rpcpassword=<password (anything you want, does not need to match BOINC)>
addnode=node.gridcoin.us

If you chose the "nano" command line editor, press CTRL+O to write the file information, and then CTRL+X to exit. For any other editor, just save the file and exit. To test type:

   gridcoinresearchd

Wait for the server to start and then type:

   gridcoinresearchd getmininginfo

This should return the current difficulty and other network settings.

Blockchain snapshot (optional)

Right now, the snapshot doesn't work on ARM. Currently, whenever I try this, I get block errors with all the following blocks. Use the bootstrap instead.

If this is a clean installation, you can improve the time it takes to get into sync with the chain by downloading a snapshot. The snapshot is never perfectly up to date, but it will get you most of the way there. Save this file in your ~/.GridcoinResearch folder:

   http://download.gridcoin.us/download/downloadstake/signed/snapshot.zip

Extract the snapshot, making sure the 3 folders and the blk001.dat file are in the ~/.GridcoinResearch folder, not a snapshot sub-folder.

Restart the daemon.

Bootstrap startup (optional)

If this is a clean installation, you can improve the time it takes to get into sync with the chain by downloading a bootstrap. A bootstrap is more cryptographically secure than a snapshot, but takes longer to ingest. Snapshots currently do not work properly for ARM, so this is the only way to get a quick start.

Obtaining the bootstrap file. For now, you have to go to IRC and ask for the link. In the future, I hope it will be posted regularly in a more central location.

Stop your client. Uncompress the file to obtain a bootstrap.dat file and place it in ~/.GridcoinResearch . Start your client. It will ingest the file and create a blk0001.dat file. When it is completed, it will rename bootstrap.dat to bootstrap.old and continue with its startup. The bootstrap.old file can be deleted.

Known Issues and further Guides

If you get the error

terminate called after throwing an instance of 'std::runtime_error'
  what():  locale::facet::_S_create_c_locale name not valid
Aborted 

you need to

sudo locale-gen en_US en_US.UTF-8
sudo dpkg-reconfigure locales