Full Guide to MinePeon

Going to borrow a bit from the wiki linked above:

Latest release: 0.2.2

The latest official release is available for | download at SourceForge.

Installation Part 1 – Get your pi running

  • Download the zip file containing the dd image from latest release from | Sourceforge and unzip it.
  • Write this image to the target SD card. The SD card will need to be 4GB or larger.

Linux

Replacing sdX with the location of the SD card, run:

dd bs=1M if=/path/to/MinePeon-2013-XX-XX.img of=/dev/sdX

Windows

  • Download the zip file from | Sourceforge and unzip it.
  • Download and install Win32DiskImager
  • Select the MinePeon-2013-XX-XX.img image file, select your SD card drive letter, and click Write
  • Eject the card from your computer, insert into the Raspberry Pi, plug in your network, and power it on.

First boot may take a bit of time, up to a minute because it has to generate your host_ssh keys. Subsequent boots should only take 10-15 seconds.

OS X

  • Download the zip file from | Sourceforge and unzip it.
  • Insert your SD card into the reader
  • Find out the path to the SD card using df -h:
 df -h

 Filesystem      Size   Used  Avail Capacity   iused     ifree %iused  Mounted on
 /dev/disk0s2   931Gi  514Gi  416Gi    56% 134878097 109102645   55%   /
 devfs          186Ki  186Ki    0Bi   100%       644         0  100%   /dev
 map -hosts       0Bi    0Bi    0Bi   100%         0         0  100%   /net
 map auto_home    0Bi    0Bi    0Bi   100%         0         0  100%   /home
 /dev/disk1s1    94Mi   24Mi   70Mi    26%       512         0  100%   /Volumes/Untitled

You can see the last line is showing the newly-inserted SD card. We will be using the /dev/disk1 parth of the filesystem name, dropping the s1 from the end.

  • Unmount the SD card:
 diskutil unmountDisk /dev/disk1
  • Copy the disk image onto the SD card:

sudo dd bs=1m if=/path/to/MinePeon-2013-XX-XX.img of=/dev/disk1

Now that you have the image ready to go lets go over some of the Hardware you’ll probably need.

If mining with many of the ASIC USB devices. It is highly recommended to get a good known working 2.0 compatible USB Hub. This will save you a ton of headaches in the end.

The most prevalent seems to be the D-Link DUB H7

http://www.dlink.com/us/en/home-solutions/connect/usb/dub-h7-7-port-usb-2-0-hub

ASIC USB Block Erupters are available at eBay and Bitmit.net

  • Plugs into standard USB port
  • Power Usage: 500-510 mA, 2.5 W
  • Bitcoin hashrate above 300 MH/sec
  • SMT machine assembly
  • Green LED indicates when a share is found

Login

Username: minepeon

Password: peon

Wired Ethernet Setup

Boot up the Pi and find your IP Address either headless or not.

Headless ssh into the Pi and run wicd-curses if you want to setup a static IP.

sudo wicd-curses

Press the right arrow key to go to config ->

sudo wicd-curses
password: peon
->

You will need to have an F10 key on your keyboard to save changes. If your like me this one just doesn’t do the job:

If you get stuck you can ssh into the Pi and run wicd from there.

Wireless Setup

If you have a wireless dongle plugged in you can also set it up wired first or directly with a keyboard and monitor.

sudo wicd-curses
Password: peon

The first thing after running wicd is to go to Preferences

SHIFT+P

You need to add wlan0 before you can scan for any available connections

Add wlan0

Press F10 to save the settings
Press -> (Right arrow on your keyboard.) to access the config screen.

Put an X in encryption then add your network key

Press F10 to save

On the Main screen Press SHIFT+R if you don’t see any connections available

Then press SHIFT+C to connect to the desired AP.

You should see obtaining IP address followed by the IP given to you unless you setup a Static IP in Preferences (SHIFT+P)

At this point you may want to update your clock the stock Pi has no Hardware Clock and your date is probably 1980. Note: The WebUi has a timezone setting but you get errors when viewing the WebUi for the first time:

Setup your location

timedatectl list-timezones

That lists all the available locales you can choose from

From the list enter your locale into the following command

timedatectl set-timezone <Zone>/<SubZone>

For myself it would be

timedatectl set-timezone America/Denver

Now to update the Time

sudo ntpd -s

Alternatively you can set the date with:

sudo date -S "yyyymmdd hh:mm:ss"

To check the date

[minepeon@minepeon ~]$ date
Mon Aug 12 22:04:21 MDT 2013

Now to get mining

The easiest method is to open any web browser on your Network and type in the IP of your Pi

Login with minepeon / peon and go to the pools page load your settings and click save it should restart the service and begin mining

You can check the progress either via the webpage or ssh. I prefer ssh.

ssh into the Pi

sudo screen -r

sudo screen -r

If you notice something wrong or the screen cannot attach run the following sets of commands.

Check the status of cgminer:

sudo systemctl status cgminer.service

Stop cgminer

sudo systemctl stop cgminer.service

Start cgminer:

sudo systemctl start cgminer.service

If you prefer bfgminer

sudo systemctl stop cgminer.service
sudo systemctl disable cgminer.service
sudo systemctl enable bfgminer.service
sudo systemctl start bfgminer.service

Unfortunately with the 3.x.x series bfgminer and cgminer went two different ways as to how they use USB, bfgminer still works but you may need to edit;-

/usr/lib/systemd/system/bfgminer.service

And put your options into it.

This is one setup:

ExecStart=/usr/bin/screen -dmS bfgminer /opt/minepeon/bin/bfgminer -S all –icarus-options 115200:1:1 –icarus-timing 3.0=100 –api-listen –api-allow W:172.0.0.1 –sharelog /opt/minepeon/log/share.log -c /opt/minepeon/etc/miner.conf

Don’t forget to reload systemd

systemctl daemon-reload

Re-Sizing the SD Card

sudo fdisk /dev/mmcblk0

In fdisk,

Press ‘p’ to print the partition table, take note of the number in the Start column of the row starting ‘/dev/mmcblk0p2′
Press ‘d’ to delete a partition then enter ’2′ to choose the second partition
Press ‘n’ to create a new partition, all the default options are fine:

Choose ‘primary’ partition type
Partition number 2
The starting block should be same number you took note of in step 1 (It should be the default number so press Enter)
The default ending block should be the last available block on the SD card, this will vary depending on what size SD card you have (Press Enter)

4. Press ‘w’ to write the new partition table and return to the bash prompt

Reboot now to force the kernel to recognize the new partition table.

sudo reboot

Now you need to re-size the file system

sudo resize2fs /dev/mmcblk0p2
df -h

Should now show something like:

[minepeon@minepeon ~]$ df -h
Filesystem      Size  Used Avail Use% Mounted on
/dev/root        15G  1.2G   13G   9% /
devtmpfs        210M     0  210M   0% /dev
tmpfs           218M     0  218M   0% /dev/shm
tmpfs           218M  264K  218M   1% /run
tmpfs           218M     0  218M   0% /sys/fs/cgroup
tmpfs           218M     0  218M   0% /tmp
/dev/mmcblk0p1   94M   24M   71M  26% /boot

For the very brave or those that just like breaking things. You can always try out some of the Beta builds as they  develop.

Trying out Beta Software is done at your own risk.

How to update MinePeon

cd /opt/minepeon/
git pull

And it will update the binaries and;-

cd /opt/minepeon/http/
git pull

If you get errors when pulling the files this can help:

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

This will update the WebUI.

Remember though, this is beta software and you will probably get problems.

Thomas updated some more installation steps here

sudo su
mkdir /opt/minepeon/etc/backup
chmod 660 $(find /opt/minepeon/etc -type f)
chmod 770 $(find /opt/minepeon/etc -type d)
chmod 770 $(find /opt/minepeon/var -type d)
chmod 777 -R /opt/minepeon/etc/backup
chown -R http.http /opt/minepeon/etc

mkdir /opt/minepeon/http/rrd/ /opt/minepeon/http/phpliteAdmin/
chmod -R 770 /opt/minepeon/http/rrd/ /opt/minepeon/http/phpliteAdmin/
chown -R minepeon.http /opt/minepeon/http/rrd/ /opt/minepeon/http/phpliteAdmin/

And if you want to experiment with importing and exporting backups:

To update Arch run:

sudo pacman -Syu

To get zip run:

sudo pacman -S zip

You can always check up on the status in the Bitcointalk.org MinePeon thread it really is the best place for news on the upcoming editions and to get troubleshooting help. Remember most errors are power related or USB Hub issues.

Troubleshooting:

We’ll start with power.

The Pi needs a 5v 1Amp power supply. It is designed to these specs and it breaks down like this:

The Core unit of the Pi Model B runs up to approximately 700mA (Milliamps) the USB Ports on the Pi are rated to output up to 140mA each. Lets add that up.

700mA + 140mA + 140mA = 980mA or .98A this leaves just enough room for any spikes at 5v 1A supplied through the micro USB connector.

Remember it is good practice to plug everything into the Pi
prior to applying power.

Back feeding power:

On occasion some USB Powered Hubs feed power through the Upstream port. (See the wiki article USB hub) this is called back powering. A good hub typically won’t do this. It is safe for the Pi but you have to remember that the power supply for the hub needs to feed all the devices connected to it and the supplies are typically minimal output for the amount of ports they have.

Let’s take a simple 4 Port Hub. It usually comes with a 5v 2Amp power supply. This is typical for most USB devices that run between 100mA and 500mA. 4 x 500mA = 2A if you get a spike beyond this you may get disconnects. But for overall functionality they work well.

ASIC and power:

The Asic USB devices are rated between 500mA and 510mA. If you connect 4 to the HUB and try to back feed power to the Pi you now have (510mA x 4) + 980mA = 3.02A a 5v 2A supply just can’t handle all that.

So why not just connect the Power supply to the other end of the Pi?

Well it’s just bad practice. 2 – 5v supplies could cause heating issues with the Pi and you can still experience spikes when things disconnect. It’s better to slice the cable going to the Hub and cut the Red power line as it isn’t needed at this point. This will provide power to the HUB independently from the Pi.

Now back to the ASIC’s and HUB power. Remember each ASIC needs up to 510mA so 6 devices should have about a 3.02A supply. Most supplies are rated at 5%+- so 3A should typically handle the extra 2mA.

Running ASIC’s from the Pi USB. At first the Pi might be able to power one up. But it should only output 140mA this is not enough to sustain an ASIC for very long. But what if you connect a 5v 2A supply through the Micro USB to power the Pi. Well the Pi ignores the extra Amp so it’s useless to do so. If the USB device tries to steal more power than 140mA typically you get the Pi to reboot itself. This also happens when unplugging USB devices while the Pi is running it spikes and down goes the Pi.

Incompatible HUBS

Issues with 1.1, some 2.0, and 3.0 hubs are the most common. Currently 3.0 Hubs just won’t work with the Pi. Some other issues are that they may work for a while but eventually you’ll get some errors like the following:

These were some of the errors I started receiving with rerr-=7 and such. The solution came when I changed out an older 4 port hub with a better one and the errors never came back. Note: these errors wouldn’t happen for until several hours after starting up cgminer. But they consistently came back until I put in a different hub.


Configuration and various Settings:

To change your WebUI password:

sudo htpasswd -c /opt/minepeon/etc/password minepeon

Resetting the WebUi password:

Reset webUI password to default: ssh into pi and do

echo 'minepeon:$apr1$DcY4Nshh$qoM20SzA2h2tBKyKUuAsg/' > /opt/minepeon/etc/uipassword

Changing default login password

ssh into pi and use

passwd

Delete MinePeon graph data:

Upon installing the latest version of MinePeon the graphs show previous history. To delete it:

sudo rm -f /opt/minpeon/var/rrd/* .

Understanding the Donation Settings:

The donation settings on MinePeon actually have a few purposes.

This quote may help describe it best.

Quote=MineForeman One of the most common features asked for is to be able to mine using different settings at different times of the day. There are many reasons to want to do this, my reason is that I want to be able to mine with one account for part of the day and them mine with another account for the rest. That way I can divvy up the hashrate of a single device over multiple users if there are many people who have shares in a device.

In order to do this the miner needs to switch configuration and this is what is proving to be problematic so fat I have tried;-

1. Switching the configuration using the API

2. Switching the configuration file and the using the API to restart the miner

3. Switching the configuration file and using the API to stop the miner and the OS to restart it (this is where it is now)

4. Switching the configuration file and using the OS to kill and restart the miner (this is what is on my workbench at the moment)

Please remember, this is Beta software and it is under constant, heavy development to get things right.

Every hour a cron job runs from:

/opt/minepeon/etc/cron.d/hourly/donate

The script looks like this:

#!/usr/bin/php
<!--?php 

include('miner.inc.php'); 
include('timezone.inc.php'); 

$donation = file_get_contents("/opt/minepeon/etc/donation"); 
$hour = date('H'); 

$configfile = "/opt/minepeon/etc/miner.conf"; 
$dontatefile = "/opt/minepeon/etc/miner.conf.donate"; 
$tempfile = "/opt/minepeon/etc/miner.conf.tmp"; 

echo $donation . $hour; 

if ($donation --> 0 and $hour == 12) {

copy($configfile, $tempfile);
copy($dontatefile, $configfile);
cgminer("restart", "");
sleep(5);
copy($tempfile, $configfile);
sleep($donation * 60);

cgminer("quit", "");

}

What it actually does is;-

1. Check to see if it is noon

2. If it is noon check to see if there are any donation minutes set.

3. IF there are any donation minutes set do this;-

3.1 Move the miner config file to a temporary one

3.2 Move the donation config file into place

3.3 Restart the miner (with the donation config file)

3.4 Move the 'original' config file back into place.

3.5 Mine for X minutes (as set by donation)

3.6 Restart the miner (with the original config file)

The easiest way if you do not wish to donate :( is to set Donation Minutes to Zero from the webpage.

The overall function if you wish is to copy the donate file and rename it. You could then edit the new file with your settings and a different config to mine different pools at different times of day.

For example:

Copy the donation config to another file

sudo cp /opt/minepeon/etc/miner.conf.donate /opt/minepeon/etc/miner.conf.mypools

Edit this config with your settings

sudo nano /opt/minepeon/etc/miner.conf.mypools

Copy the cron file to another file

sudo cp /opt/minepeon/etc/cron.d/hourly/donate /opt/minepeon/etc/cron.d/hourly/mypools

Edit it’s settings and mark hour to what you want if you wanted to switch every hour for 10 minutes

sudo nano /opt/minepeon/etc/cron.d/hourly/mypools
#!/usr/bin/php
<!--?php  

include('miner.inc.php');  
include('timezone.inc.php');  

$hour = date('H');  
$configfile = "/opt/minepeon/etc/miner.conf";  
$dontatefile = "/opt/minepeon/etc/miner.conf.mypools";  
$tempfile = "/opt/minepeon/etc/miner.conf.mypoolstmp";  

echo $hour;  

if ($hour <> 12) {

copy($configfile, $tempfile);
copy($dontatefile, $configfile);
cgminer("restart", "");
sleep(5);
copy($tempfile, $configfile);
sleep(10 * 60);

cgminer("quit", "");

}

This will have the same effect except it will go off every hour except noon.

You will notice I removed

$donation = file_get_contents("/opt/minepeon/etc/donation");

And hard set the line to restart in 10 minutes

sleep(10 * 60);

You can play with these settings to your hearts content.

cgminer.service:

To understand how cgminer.service works as the Pi boots up you can always review the parameters.

nano /usr/lib/systemd/system/cgminer.service

I will be updating this post from time to time feel free to come back and check for more MinePeon tid bits.

This entry was posted in Blog, Tutorials. Bookmark the permalink.

4 Responses to Full Guide to MinePeon

  1. btc_buddha says:

    One small but important correction. Up above in the section “To change your WebUI password” it reads:

    sudo htpasswd -c /opt/minepeon/etc/password minepeon

    but it SHOULD be

    sudo htpasswd -c /opt/minepeon/etc/uipassword minepeon

  2. semperfidelis316 says:

    In SSH I use sudo screen -r but it reads, “There is no screen to be resumed.”

    Is there another way to bring up the cgminer progress? Or am I missing something?

  3. Psudo36 says:

    BLESS YOU. Your correction to the command did the trick.

Leave a Reply