Saturday, 17 March 2018

Switch your Raspberry Pi 3 to use a hard drive

I have a Pi 3 that is a DNS, web, email etc server and it's gone through a few SD cards and gets bogged down in high wait % in top sometimes.  It has a USB drive for storage for Storj etc and I was reading how you can boot a Pi 3 with a hard drive to speed things up and hopefully be a bit more reliable than the SD cards have been.

So I found this article

Now a bunch of gotchas came up.

Firstly the boot USB option is a OTP setting.  This means once it's set, it for good on your device. Read up on this before doing it!

 I had a spare drive so I restored a Jessie image to the drive and plugged it in after  setting the option


and it seem to boot (it's headless) but the drive was accessing, the network was flashing etc. Seems pretty easy.

Ok lets try and migrate the current SD card and drive to a new drive.

So some points to note here.  I tried the SDCard again to get DNS etc back up while I moved data around and it would not boot. Seems you need to remove the line we added earlier


from /boot/config.txt or the SD card won't boot again. That's a bit annoying.

So I imaged the SDCard and restored this to the drive and tried to boot this and it started but then did not complete booting. OK silly move, need to modify the /etc/fstab on the root partition and the /boot/cmdline to say sda rather than the mmc device that is the SDCard.

Once that was done it booted OK.  We're getting there. Tried to use raspi-config to exapnd the root partition but that doesn't know what the drive is and only works on SDCards.  Doh. Back to the PC and expand with GParted and finish copying the data over and we're in business.

So in short to move you RaPi3 to a harddrive:

Image your SDCard and restore this to the new harddrive. 
Expand the harddrive root partiion with GParted or similar.
Modify the /etc/fstab and /boot/cmdline on the new drive to use sda rather than the mmc device ( I had 3 entries)
On the PI, set the "program_usb_boot_mode=1" option in /boot/config.txt and reboot.
Shut the Pi down and remove the SDCard and plug in the USB drive and it should boot.

Hope that saves some frustration :-)

Saturday, 20 May 2017

A simple video card upgrade... not so much

I wanted to get a new video card and found a deal on a Sapphire RX580 and thought great, going from a RX390 to a RX580 should be easy. Both are AMD, both are just rehashes of an older card so drivers are established.

But no, seems the Sapphire card is cheap for a reason...

So started up in Linux and it booted to the point where it said switching to amdgpufb, then blank screen.  HDMI was UP (the card has two HDMI ports and one goes to an AV system for sound).  It's all working but you can't see anything. crtrl-alt-delete and try again.

Change kernel line options in grub to include nomodeset and it boots and you can see (apart from about 2 minutes of tearing when it tries to start gdm)

Logs look fine looks amdgpu is starting OK and recognising it as an RX480 which it is based on. Doh, wrong firmware.  OK so update from TONGA to POLARIS10 firmware blobs int he kernel. My kernel doesn't use ramdisk it just boots and includes all the firmware for video, wifi etc.  Not the linux way but it works and it's quick.

Boot again, but still blank screen and now firmware loads and the card looks to be running. Hmmm...

Boot into windows and just make sure and the card is fine.

Run make menuconfig on the kernel and check for options but everything is just amdgpu generic not specific to a model.  Found a firmware option related to EDID and checked the docs on this in /usr/src/linux/Documenation/EDID/Howto.txt.  This talks about video starting but cards not reading EDID from the monitor correctly and stopping at a blank screen when start KMS.  OK sounds promising...

Making a EDID file is as simple as running make in that directory to use the default ones.

Copy 1920x1080.bin to /lib/firmware and add that to the kernel blobs and reboot. Still no good.

Google comes to the rescue to find an Arch Linux article (damn these guys document well) which is similar to Gentoo and it mentions you need to turn on this firmware at boot with a kernel option


and sure enough it boots and video stays on.

So if you have a Sapphire RX580 (pulse in my case) and linux and have blank video issues try this. I'm sorry to sapphire if it's a general RX580 thing but I didn't find any other posts etc on this issue so I'm guessing not.

I can post line by line if anyone comes across this and it doesn't make sense to them.

Saturday, 29 April 2017

Gridseed dual mining on minera

This is something that caught my interest a few years ago and has been sitting in the garage churning out tiny fractions of a bitcoin regularly.

Bitcoin spiked back up to $1700 recently and previously it wasn't worth the power to mine but might be now.  I buy my etc stuff with bitcoin.

My original setup uses a raspberry pi with minera ( to have a simple web based front end for 6 gridseed minis.  These are a unit with 5 gridseed chips together.  The gridseed chip can mine SHA256 (bitcoin etc) and scrypt (litecoin, doge etc) and both at the same time.

These just sat quietly mining scrypt which a site called converts to Bitcoin and adds to your wallet. All very easy.

I could never get them to mine bitcoin or dual mine both and gave up but revisiting it showed it wasn't really that hard with the right mining client. I haven't got the nice front end to work yet.  That's the last step.

To get Bitcoin (SHA256) to work, SSH to your raspberry pi with Minera and you run

screen sudo /var/www/minera/minera-bin/cgminer-dmaxl-zeus --sha256 -o stratum+tcp:// --user nickbrooker.1 --pass x --gridseed-options freq=800 --widescreen

You can use my details if you want to give me some extra BTC :-)

The cunning part is this software sets up local UDP listeners when running on SHA256 to allow a second copy to connect via UDP to the scrypt side.

 cgminer version 4.3.5-scrypt.2 - Started: [2017-04-29 10:44:40]
 (5s):0.000 (1m):0.000 (5m):0.000 (15m):0.000 (avg):0.000h/s
 A:0  R:0  HW:1  WU:883.5/m | ST: 5  SS: 0  NB: 1  LW: 48  GF: 0  RF: 0
 Connected to diff 2.05K with stratum as user nickbrooker.1
 Block: 12519e6d...  Diff:522G  Started: [10:44:40]  Best share: 1.69K
 [U]SB management [P]ool management [S]ettings [D]isplay options [Q]uit
 0: GSD 8D8638654955:  800 MHz  SHA256        | 1.331G / 4.684Gh/s WU:130.9/m
 1: GSD 8D8848665055:  800 MHz  SHA256        | 1.322G / 4.684Gh/s WU:98.2/m
 2: GSD 8D8307735055:  800 MHz  SHA256        | 1.346G / 4.684Gh/s WU:98.2/m
 3: GSD 8D8340625055:  800 MHz  SHA256        | 1.376G / 4.684Gh/s WU:163.6/m
 4: GSD 6D8527885750:  800 MHz  SHA256        | 1.317G / 4.684Gh/s WU:261.8/m
 5: GSD 6D7631994853:  800 MHz  SHA256        | 564.5M / 2.342Gh/s WU:130.9/m
 [2017-04-29 10:44:35] Gridseed device found, firmware v01140113, driver v3.8.5.20140210.02, ID 8D8307735055
 [2017-04-29 10:44:35] GSD2: System reseting
 [2017-04-29 10:44:35] GSD2: Set GC3355 core frequency to 800 MHz
 [2017-04-29 10:44:36] GridSeed options: 'freq=800'
 [2017-04-29 10:44:36] Gridseed device found, firmware v01140113, driver v3.8.5.20140210.02, ID 8D8340625055
 [2017-04-29 10:44:36] GSD3: System reseting
 [2017-04-29 10:44:36] GSD3: Set GC3355 core frequency to 800 MHz
 [2017-04-29 10:44:37] GridSeed options: 'freq=800'
 [2017-04-29 10:44:37] Gridseed device found, firmware v01140113, driver v3.8.5.20140210.02, ID 6D8527885750
 [2017-04-29 10:44:37] GSD4: System reseting
 [2017-04-29 10:44:38] GSD4: Set GC3355 core frequency to 800 MHz
 [2017-04-29 10:44:38] GridSeed options: 'freq=800'
 [2017-04-29 10:44:38] Gridseed device found, firmware v01140113, driver v3.8.5.20140210.02, ID 6D7631994853
 [2017-04-29 10:44:38] GSD5: System reseting
 [2017-04-29 10:44:39] GSD5: Set GC3355 core frequency to 800 MHz
 [2017-04-29 10:44:39] Create scrypt proxy on 3350/UDP for GSD0
 [2017-04-29 10:44:39] GridSeed GSD0 opened on usb:1:11
 [2017-04-29 10:44:39] Create scrypt proxy on 3351/UDP for GSD1
 [2017-04-29 10:44:39] GridSeed GSD1 opened on usb:1:9
 [2017-04-29 10:44:39] Create scrypt proxy on 3352/UDP for GSD2
 [2017-04-29 10:44:39] GridSeed GSD2 opened on usb:1:7
 [2017-04-29 10:44:39] Create scrypt proxy on 3353/UDP for GSD3
 [2017-04-29 10:44:39] GridSeed GSD3 opened on usb:1:12
 [2017-04-29 10:44:39] Create scrypt proxy on 3354/UDP for GSD4
 [2017-04-29 10:44:39] GridSeed GSD4 opened on usb:1:10
 [2017-04-29 10:44:39] Create scrypt proxy on 3355/UDP for GSD5
 [2017-04-29 10:44:39] GridSeed GSD5 opened on usb:1:8
 [2017-04-29 10:44:39] Probing for an alive pool
 [2017-04-29 10:44:40] Pool 0 difficulty changed to 2048

 [2017-04-29 10:44:40] Network diff set to 522G

So disconnect from screen  (Ctrl A, Ctrl D) and start

screen sudo /var/www/minera/minera-bin/cgminer-dmaxl-zeus --scrypt  -o stratum+tcp:// -u nickbrooker.1 -p x --widescreen

It will check local host and connect to the ports automatically.

cgminer version 4.3.5-scrypt.2 - Started: [2017-04-29 10:24:30]
 (5s):883.0K (1m):106.3K (5m):21.89K (15m):7.333K (avg):1.489Mh/s
 A:512  R:0  HW:0  WU:15.3/m | ST: 3  SS: 0  NB: 1  LW: 26  GF: 0  RF: 0
 Connected to diff 512 with stratum as user nickbrooker.1
 Block: 8dd69347...  Diff:146K  Started: [10:24:30]  Best share: 710
 [U]SB management [P]ool management [S]ettings [D]isplay options [Q]uit
 0: GSD 8D8638654955:  800 MHz  DUAL / SCRYPT | 136.8K / 260.8Kh/s WU:0.0/m
 1: GSD 8D8848665055:  800 MHz  DUAL / SCRYPT | 136.8K / 260.9Kh/s WU:0.0/m 
 2: GSD 8D8307735055:  800 MHz  DUAL / SCRYPT | 145.1K / 272.6Kh/s WU:15.3/m
 3: GSD 8D8340625055:  800 MHz  DUAL / SCRYPT | 136.9K / 260.9Kh/s WU: 0.0/m
 4: GSD 6D8527885750:  800 MHz  DUAL / SCRYPT | 136.9K / 261.1Kh/s WU: 0.0/m
 5: GSD 6D7631994853:  800 MHz  DUAL / SCRYPT | 136.8K / 260.8Kh/s WU: 0.0/m
 [2017-04-29 10:24:27] Started cgminer 4.3.5-scrypt.2
 [2017-04-29 10:24:27] Found scrypt proxy on 3350/UDP
 [2017-04-29 10:24:27] Found scrypt proxy on 3351/UDP
 [2017-04-29 10:24:27] Found scrypt proxy on 3352/UDP
 [2017-04-29 10:24:27] Found scrypt proxy on 3353/UDP
 [2017-04-29 10:24:27] Found scrypt proxy on 3354/UDP
 [2017-04-29 10:24:27] Found scrypt proxy on 3355/UDP
 [2017-04-29 10:24:28] Gridseed GSD0 opened on 3350/UDP
 [2017-04-29 10:24:28] Gridseed GSD1 opened on 3351/UDP
 [2017-04-29 10:24:28] Gridseed GSD2 opened on 3352/UDP
 [2017-04-29 10:24:28] Gridseed GSD3 opened on 3353/UDP
 [2017-04-29 10:24:28] Gridseed GSD4 opened on 3354/UDP
 [2017-04-29 10:24:28] Gridseed GSD5 opened on 3355/UDP
 [2017-04-29 10:24:28] Probing for an alive pool

So now they are happily mining away on both scrypt and SHA256.  You're never really going to make money on this unless you are exceedingly lucky and mine solo and solve a bunch of blocks. It just a fun thing to do.

Update:  seems one thing to be careful of is power supplies. I have 6 of these gridseed minis and they draw 6 watts in scrypt and I read 30 watts in SHA256 but it may be more.  I have a 12V 30A power supply that just expired and was a bit toastie.

Tuesday, 4 April 2017

Windows 8.1 over Windows 7

This one may save someone some time. One of the kid's computers was on windows 7 and I thought it might be nice to try going to 8 as they've put the countdown on windows 7.

I tried the DVD from within Windows 7 and booting the DVD. Booting from the DVD won't let you update and from within Windows it failed after it got to 100%.

I had recently installed an SSD and disabled superfetch and Windows search services. After trying a few other things I re-enabled these and it worked.

Monday, 12 December 2016

Linux kernel 4.9 amdgpu blank screen in Gentoo

After updating to kernel 4.9 I ended up with a blank screen after grub.

Booted back to 4.8 and checked logs and found a firmware file was showing as erroring and load not loading:


So I had to add that to firmware load files in the generic device drivers of the kernel and now all works.

It had a firmware file


before so the k one is new in 4.9.

Sunday, 13 November 2016

LG LED IPS 24MP68VQ-P monitor review (sort of)

I thought it was time for a new monitor and a local sale gave me the incentive. The main reason I wanted a new monitor was primarily Freesync for gaming and watching video.

After reading reviews I had a couple of favourites. This LG and a Viewsonic fitted my specs and price.

On the night the LG was there and had quite a hefty discount and I like LG gear.  I think it's the quieter, less flashy (dare I say better?) sibling of Samsung.

Going from a 2009 or so Viewsonic 24 VX monitor to this LG is quite a revelation. I'm not saying the Viewsonic is bad, it's just an LCD panel that is older technology. I would happily buy another Viewsonic.

First off the size. Same viewable size but the LG is barely bigger than the panel. I could have gotten a 27" LG taking the same space as the old monitor.  It's barely 15mm  deep. The base is also smaller as the monitor is lighter hence more desk space returned.

Brightness/contrast:  panel technology has moved on a lot in seven years it seems. It is so much brighter and still black is black, so better contrast.  The colour accuracy, if the included output sheet is to be believed, is a huge improvement as well.

Gaming/video: once I found the freesync switch (see cons later) it makes quite a difference if you have a new AMD video card (CGN 3 and up so RX9 300 +)  Gaming is sharper and watching video (especially fullHD BD etc) no longer tears.  It is just nicer.

The cons: the controls of this monitor are by a little joystick facing down under the panel. This is a bit fiddly and not very descriptive. Settings like Freesync were off and you'd think they would default to on since they won't work unless the video card supports them. So nothing major.

To be fair most new monitors would provide these but I'm quite stunned how for not much money you get what is normal today and is such an improvement over what was OK 5 years ago.  I guess it's like cars.

So if you have an old monitor, go do yourself a favour and find yourself something like this and upgrade.  It's smaller, better to look at and uses less power.

Tuesday, 27 September 2016

Why I'm driving to work again

Well today is my first day of driving to work in over 7 months.

Yet another train/track fault last night was the final straw.  Why is Auckland transport making new tracks when it can't even maintain what it has already? Too many times it's "OK get off here, go and find a bus" or trains just vanish from the timetable.

For public transport to succeed it needs to be cheap, reliable and easy.  Auckland transport is reasonably priced is 0.5 out of 3.

Make it free and get people to use it, then either add a small charge or remove  some of the council bloat and put that towards public transport. Once more people use it then it should get more frequent.  Again as no-one had forethought, some tracks a single lines so you can only have one train tieing up the line beyond Penrose to Onehunga for example.  That needs to change to twin lines everywhere and trains to the airport and north shore to at least Albany. Don’t try and milk it to make money just make it good. Every household contributes $1000 a year or so in rates for it if I recall correctly.

It needs to be easy.  Needs to be a no brainer to use.  I take the train because each time I've taken the bus it's been like being a passenger in a rally car and it's impossible to read etc. Whoever thought that any park and ride is big enough obviously doesn't use them. All the ones I know about are full early and New Lynn doesn't even have one. And just little things like the times they run.  I would get to town at 8:32.  Great, not many people take 28 minutes to get to their offices. I gained almost an hour in my day today by driving.

I'm generally for small government but public transport is something that needs to be right for a city to function. You should be able to jump on something go to an event or out for dinner and know you can get home safely even if you've had a few drinks.

If you can't do it properly just make the main roads bigger and give up.  Let Uber rule transport and give me a third of my rates back.

I do miss an hour reading each day though.

Yes, TL:DR.

Switch your Raspberry Pi 3 to use a hard drive

I have a Pi 3 that is a DNS, web, email etc server and it's gone through a few SD cards and gets bogged down in high wait % in top somet...