Raspberry Pi – Configuration notes

Attention: If you’re the type that gets hives thinking about technology, this post isn’t for you (and please don’t feel bad for just completely skipping it!)

I’ve finally managed to get myself a Raspberry Pi from the wonderful people at Solarbotics. As a technical guy, I’ve long struggled with trying to get Unix computers up and running.. I’ve always found the Unix documentation and tutorials tough to get through, primarily because they tend to make a lot of assumptions about what the reader might know. (A lot!) Usually I find this leads me in circles and spirals trying to sort out a problem related to some minor version change, or difference in configuration. Also, I think I’m pretty much checked out of digging through obscure technical documentation. Thankfully, because of this new class of hardware, there is a new class of writer building documentation now, and we have people like the Raspberry Pi founders, and countless other makers to thank for that.

So, now that I’ve got a specific need to be addressed, I’m going to give this a shot.

The following are some of the tutorials and instructions that’ve helped me solve the problems I’ve encountered in the configuration. The post is mainly a repository for my own use (any name-calling is aimed solely toward me, myself, and I), but I’ll keep it posted here to help others who may have the same issues. Because this isn’t a tutorial or even a fully fleshed out article, it’s possible that I haven’t fully explained something that you’re struggling with. I may have chosen not to because it’s part of my own knowledge, but I recognize that it may not be part of yours. Please give me a shout or drop me an email if you’d like more clarity about what I’ve written. Hope this helps!

First things first..

Purpose:

I wanted a little tiny computer to tuck in to a corner and that could be remote controlled from elsewhere on the internet, mainly for web browsing. Because this will be living at a borrowed offsite location, I didn’t want to take up a lot of space with an old laptop or something more intrusive. The Pi is a good choice because it’s itty bitty, and will easily tuck in to a corner with a wireless router, and won’t consume a shed load of electricity either..

So, there are two specific technical challenges that need to be addressed:

How do I get access to the desktop of the computer remotely? How do I connect to the computer when its IP Address may change at random?

The solutions are pretty straight forward in theory, but a little more complicated to put in to practice but I’ll be using the following to reach my goal…:

Virtual Network Computing (VNC) which I’ve been using for countless years to connect to my old windows machines Dynamic DNS, a way of letting the computer update its own internet address so that I can always find it..

Implementation:

I’m using the NOOBS distribution of Raspberry Pi. It came preinstalled on the Raspberry Pi 2 Bundle I got from Solarbotics. While setting up, I managed to change the password and figured I messed up because on my first reboot, I couldn’t log in.. Crap.

For the record, the default username is Pi (not Raspberry as I was thinking..)

Unnecessarily reinstalled NOOBS on my SD card, learning the following:

Don’t Panic. Douglas Adams taught us this, and I’d forgotten the rule. Rather than thinking through the problem, my first reaction was format, reinstall.

When you format the SD card through disk utilities on a mac, you have to unmount each of the mounted partitions on the disk.

each of the mounted partitions on the disk. Raspberry Pi NOOBS requires a FAT formatted disk to run. This information is a bit scarce on the internets.

The above linked NOOBS distro is a little larger than the Solarbotics supplied version. Not sure how, but it includes a few more options to install. Not necessary for a noobie, but may be useful if you want to play and explore with your new device.

Make sure you choose the right Keyboard and region when NOOBS is installing your OS. Changing the keyboard later is convoluted and frustrating. As is inadvertently typing the £ symbol instead of the # I was expecting..

Display problems

I had a couple of issues with my display, one that was relatively straight forward, and the second that was a little more befuddling.

Screen resolution greater than 700xSomething was displaying on a monitor that easily displays 1920 x 1080..

Turns out, the HDMI cable was loose on the Pi connection. Rule number 2 of computer troubleshooting, ALWAYS CHECK YOUR CABLES, DUMBASS. After mucking around with some VNC settings, somehow I managed to reduce the maximum resolution of the Pi so that there was black border of unused pixels surrounding the display area. <sigh>

Reinstalled OS again after failing google-fu and not finding a solution.

Problem persisted with new OS install, so somehow I managed to change something on the Pi Configuration itself..

This turned out to be the solution: http://www.opentechguides.com/how-to/article/raspberry-pi/28/raspi-display-setting.html

One thing the tutorial doesn’t mention is that the Overscan settings in step 4 exist in TWO places in the config file. The ones at the bottom were what fixed my problem in the end. I only learned this after several reboots and some head scratching

Also, the Pi Config file is called /boot/config.txt

And, I far prefer using Nano to VI for editing..

Backup, backup, backup..

Okay, I’ve started from scratch enough times, I’d like to backup the 4Gb SD card and create some checkpoints when I install new software or make changes.

Unfortunately it wasn’t as easy as just making an image in Disk Utility on the Mac without first Unmounting the boot and recovery partitions. Once you do though, you can click the SD card, and choose New Image from the icons at the top of the Disk Utility screen..

Install VNC on Raspberry Pi

There are loads of tutorials on this step, so I won’t record a complete step by step, but I find I always encounter issues beyond the provided tutorials, so I’ll record any additional issues I encounter.

I used this write up primarily: https://www.raspberrypi.org/documentation/remote-access/vnc/

But I failed to make things work properly.. Mostly because of my own ignorance I think..

Trying this instead: https://learn.adafruit.com/adafruit-raspberry-pi-lesson-7-remote-control-with-vnc/installing-vnc

(It should be noted that Adafruit has been making a huge contribution to the maker movement since they started out. they’re reputable, and well worth exploring if you’re at all smitten with building electronics)

Lessons:

To SSH from another unix machine (like a Mac), you’ll need to provide the appropriate user to connect use ssh pi@192.168.9.9 or whatever your address is to login as user pi

or whatever your address is to login as user Starting VNC is as simple as using vncserver :1 This starts the server, and allows you to create different sessions by incrementing the :[number]. As you’ll see below, this is limited by your router configuration..

This starts the server, and allows you to create different sessions by incrementing the :[number]. As you’ll see below, this is limited by your router configuration.. There are a few different ways to connect to the Pi from another computer. I chose to use RealVNC viewer and just connect. You can use Mac Screen Sharing, but at the moment I don’t mind having another software package do the work..

There were a couple of things conspicuously missing from the first tutorial..

When connecting to the vnc server with the viewer, use the format [IP address]:[Session Number]. In the case of the adafruit tutorial, we create session number 1, so when I connect to my pi it’s address 192.168.9.9:1 that I use to connect.

Annd Success!

Now to change the default resolution on my VNC window to match my laptop resolution 1680×1050.

The first tutorial sets up a script to automatically start the VNC service when you boot your Pi. If this is desirable, it’d be worth trying out. After a bit of thought though, I’d rather not have a whole pile of access methods hanging off my machine while it’s just sitting on the internets. So for now I think I’ll just start it using SSH (as is shown in tutorial 2) with the simple command vncserver :1. It’s pretty easy and gives me the option of running it or not regardless of who is monitoring it on the home side.

Dynamic DNS – Letting the computer tell you where it lives..

So, I’ve looked a couple of options for dynamic DNS services.

DynDNS.org was what I used decades ago, but they’ve since gone to a pay model.. This application isn’t so mission critical that this is necessary

Looked at NO-IP but I wasn’t quite able to make things work correctly at first try.. The service is actually pretty good but I ended up looking at..

DuckDNS instead through the recommendations of a couple of kind Redditors.

If you haven’t had a chance to explore Reddit, I would highly recommend it. There are a tonne of subreddits that you could while away a lifetime with, but when you’re trying to accomplish something specific or have unique interests like the Raspberry Pi there is surely a community of other inspired users that are always willing to help..

Lessons:

Authentication through Persona, a Mozilla initiative, will fail on the Pi’s Epiphany web browser

on the Pi’s Epiphany web browser Reddit Authentication works great though!

DuckDNS instructions aren’t readily available when you’re not logged in. This makes it tough to research what steps you might have to perform before you commit to logging in, but it’s not really too intrusive.

To get install instructions for your platform, and once you’re logged in, choose the platform option (“Operating system” in this case), then chose the drop-down menu item for the domain you want to configure.

If you get to the point where you download the Linux GUI version, make sure you move it to the home folder on your Pi (that’s the Pi folder by default). Following the instructions while it’s in the downloads folder will fail your config!

I wasn’t able to get the GUI version to launch through the CHMOD line, but I could navigate to it with the file browser in the GUI and double-click, then choose execute.

Your Token is listed in the setup instructions, sandwiched between too screen shots look closely to find it, you may

I get the [Error] Duck DNS did not update correctly when I complete the configuration. You also get an error when your IP address hasn’t changed so I’m hoping this may be the same issue as the machine has already been registered with the current IP.

Also, I’ve changed my default CRON updating to 720 minutes (12 hours) because IP addresses on home internet packages don’t update all that often. If I’m locked out for a half day, this won’t kill me. (I used the CRON instructions on the DuckDNS website to learn that crontab -e will let me edit this)

will let me edit this) To this point I’ve been using internet sharing from my laptop because the router is in a bedroom and I didn’t want to sit on a bed to configure this all. Now it’s time to try this out properly and I’ll have to move it and see if I can get all this working remotely.

Errrgh.. Turns out there are PI instructions on the duckDNS website. I didn’t notice them because the button only says “Pi” and is really tiny. On the “let’s test the script” step I get the error: Warning: F ailed to create the file /root/duckdns/duck.log: No such file or

Warning: directory . The file is legitimately not there (because I didn’t follow instructions from the start), so I just created a blank text file at /root/duckdns and called it duck.log (I also created the duckdns directory)… Make sure you choose your domain from the dropdown box at the bottom of the page. This will generate all the instructions for you.



Router Configuration

In order for a dynamic DNS address to work, port forwarding is required to make sure that the internet router and/or modem send internet traffic to the right device. It picks up the public ip address of your modem and this just directs stuff from the router to the Pi..

For Tight VNC the following ports are listed as required:

Application Start

Port End

Port Protocol TightVNC 5900 5900 TCP TightVNC 5800 5800 TCP

But that’s not all..

If you start your VNC Server with something like vncserver :1, (as suggested by the Adafruit instructions) the server will use port 5901 for your connection, vncserver :2 will use 5902 and so on. So unless you use vncserver:0 and it actually works (I haven’t tried) the above rules will prove insufficient, so in practice, this is actually what I’ve set on my own router to ensure that it’ll take connections from 1 to 5..

This is what I ended up using for port settings:

Application Start

Port End

Port Protocol TightVNC 5900 5905 TCP TightVNC 5800 5805 TCP SSH 22 22 TCP

I should read the error messages more thoroughly, as they would have easily provided the solution.

Conclusion..

So, this has taken me the better part of 7 hours to muck around with and set up (with the odd interruption for this and that).. It seems like an inordinate amount of time, but bear in mind I’m learning all about linux and working with the new hardware, and a completely new flavour of Unix at the same time.

This is actually a pretty straight forward and a great learning experience. With this experience now, I’m pretty confident the exercise wouldn’t take more than an hour of manipulation time to set up (not counting computer time for installing the OS and such)

Hopefully this will be helpful for those of you who’re going through your own setup process, and save you a bit of time yourself! And seriously, try to figure things out, but if you’re really stuck and google lets you down, drop me a note and let’s see if we can work out the problem together!