Friday, 27 May 2016

Ingress, I've hung up my scanner

For about 3 years I've been playing a virtual reality game called Ingress, basically you have to travel to places and by travel I meant physically go there, capture portals and link 3 together as a triangle, everything under that triangle is then under control of your team, there are two teams, the resistance and enlightened, the enlightened want to work with aliens to accelerate humans, the resistance want it to continue as normal. The game is run by Niantic, an offshoot of Google and is free, except for some of the stuff in the store and the vast amount of petrol you use travelling to portals.

It was great, you got to find things that you didn't know about and added to a day out, what eventually happens is you go out to find portals, capture them and ignore everything else and this wasn't helped when they introduced a badge called the "Sojourner Badge". This is like an Ingress addict badge, it forces you to hack a portal every 24 hours and if you don't you go right back to the start of the hacking streak. I missed one day on holiday last year and has to start again and eventually got my black or onyx badge, I felt nothing.

And very recently, Niantic have introduced a cheat detect routine in their software that has managed to get legitimate players banned while known cheats and spoofers are allowed to carry on.

Then there's the portal issues, there are quite a few fake or obsolete portals out there, you report them and Niantic say there is no evidence to support the removal. One local portal was a church until 2 years ago, it's now a block of flats, no evidence. There are obvious fake portals and so much more and it's stopped being fun to play. I do blame the Sojourner badge, it made me hack every 24 hours and it then became something I had to do as opposed to something I wanted to do.

I've gone for a name change from Agent37168, my old Geek Squad badge number to Th3MajorTom and that has not helped.

So, it's time to hang up the scanner for now, I've uninstalled the software and sent my account deletion email, it will take some time to come through and I may change my mind but at the moment I've had enough.

Thanks to Niantic for taking the fun out of the game.

Sunday, 8 May 2016

Another slice of PI

Today is not a good day, my old faithful Asus EEBox which has been running almost constantly since 2008 decided to curl up and die, it's been running as a file server all this time amongst other things. The onboard had drive was just used to boot the OS, all data is store on two external 5TB drives.

It was time to replace it and to see if a Raspberry Pi was up to the job. The Raspberry Pi I got was as part of a starter kit from PC World, it included a case, power supply, ethernet lead and micro USB lead.I downloaded Rapbian and wrote to the image to a card as shown on the website.

I plugged everything, got some lights on the Pis but nothing on the ethernet socket, it was time to move it to the TV, unplug my other Pi and see what was happening, to my surprise it booted up and it all worked, I logged in via ssh and ran sudo raspi-config, set it all up, rebooted and reconnect. I took it back to where it's going to be located and again, no ethernet lights. After much buggering round it looks like the supplied micro USB lead isn't up to the job, there's too much of a voltage drop, the PI was now alive. I connected the external drives and set up fstab to mount the drives automatically, set up some samba shares and an nfs share, rebooted and was unable to connect to the nfs shares, again some research continued and it seems that there's an issue on Raspbian which means that the rcpbind service doesn't start automatically.

I decided to get round this in a most unelegant way, I added some entries into the rc.local file with:

sudo nano /etc/rc.local

This lot got pasted in just before the "exit 0" bit at the bottom

service smbd stop

service nfs-kernel-server stop

mount -U b8828e80-d5c4-4747-a3f6-82eda807a34d /mnt/data

mount -U dc3e664f-27da-4e62-b1ba-f5a220a836a6 /mnt/backups/

rpcbind -w

service nfs-kernel-server restart

exportfs -rav
service smbd restart

Not all of it may be needed but it does work, I decided to mount my external drives here too, just in 
case one failed to mount on bootup, the pi isn't going to have a screen or keyboard connected and would hang at the boot screen.

You just need to make the file executable with:

sudo chmod +x /etc/rc.local

After that it all worked quite nicely and I'm managing to play some music stored on the pi and watch some videos at the same time.

Just in case you didn't know, you can install the required nfs files with:

sudo apt-get install nfs-common nfs-kernel-server

And Samba can be installed with:

sudo apt-get install samba samba-common-bin  

Following up on this as the external drives started to fill up I began to get problems with the little Pi running out of memory and crashing. Ok, it's not got a lot of memory but it worked well to start with so I decided to upgrade the firmware, setup the memory, remove the swapfile and move the OS to an external drive, in this case it's a 32GB USB drive.

Let's remove the swapfile first with the following:

sudo dphys-swapfile swapoff
sudo dphys-swapfile uninstall
sudo update-rc.d dphys-swapfile remove

Next up, we need to update the firmware with

sudo apt-get install rpi-update

and then

sudo rpi-update

Once it's all done, reboot and let's sort the memory, this time we run the config utility

sudo raspi-config

Select advanced options

Then the memory split option

Change this to 16 and select OK

Then Finish and reboot

And now we come to moving the OS onto an external drive, as mentioned before this is a 32GB USB drive, plug it in and run

dmesg | tail

It should show the USB device at the end, in my case it identified it as /dev/sda

Time to wipe it and sort out the filesystem with:

sudo fdisk /dev/sda (or whatever your USB device shows)

 Then it's "d" to delete the partition, "n" for a new partition, followed by "p" for primary, then select the defaults for the next three questions and finally "w" to write the partition.

Now we format it with:

sudo mkfs.ext4 /dev/sd?1

And then we mount it to a temporary folder with

sudo mkdir /mnt/temp
sudo chmod 0777 /mnt/temp
sudo mount /dev/sda? /mnt/temp

Once that's done it's time to copy all the files over but first we need to install rsync:

sudo apt-get install rsync

sudo rsync -axv / /mnt/temp

It will take some time for this to complete, so go and have a coffee.

Now we need to tell the pi to boot the OS from the stick, the micro SD card needs to stay in as it will initially start from this and then load everything from the USB stick.

Let's backup the config file first with:

sudo cp /boot/cmdline.txt /boot/cmdline.orig

Next we'll edit with

sudo nano /boot/cmdline.txt

The original looks like this:

dwc_otg.lpm_enable=0 console=serial0,115200 console=tty1 root=/dev/mmcblk0p2 rootfstype=ext4 elevator=deadline rootwait

It's all on one line, we need to change the root=/dev/... bit to read root=/dev/sda1 or whatever your USB stick shows, we also need to add a delay to the end with rootdelay=5, it should look like the one below in the end.

dwc_otg.lpm_enable=0 console=ttyAMA0,115200 kgdboc=ttyAMA0,115200 console=tty1 root=/dev/sda1 rootfstype=ext4 elevator=deadline rootwait rootdelay=5

Save it and then we need to edit fstab with:

sudo nano /etc/fstab

The following entry needs to be added:

/dev/sda1    /   ext4    defaults,noatime  0       1

And the line referring to the sd card needs to be commented out, mine looks like this now

proc            /proc           proc    defaults          0       0
/dev/mmcblk0p1  /boot           vfat    defaults          0       2
# /dev/mmcblk0p2  /               ext4    defaults,noatime  0       1

/dev/sda1    /   ext4    defaults,noatime  0       1

Save it and then it's time to reboot and it should all now be running off the USB stick with a bit more memory.

It's now running quite well with those big drives plugged in, every hour the data drive is backed up to the backup drive with a cron job and data is also sent to a remote location once a week, it really is a good little machine.

Many thanks to the Raspberry Pi forums for the help in this.