Saturday 2 February 2013

Pi Shaped Box at the door...

The Raspberry Pi config process seems to be a slow one, so I might as well document my steps. Because I wanted easy access to Adafruit code for hardware, I went with the Adafruit Pi lesson 1 and downloaded v02 of the Occidentalis distro, which unzipped itself to Occidentalis_v02.img in my iMac's downloads folder. I thought I followed the mostly graphical interface directions when I typed:

sudo dd if=Downloads/Occidentalis_v02.img of=/dev/disk3s1 bs=1m
2479+1 records in
2479+1 records out
2600000000 bytes transferred in 1353.109465 secs (1921500 bytes/sec)

in the iMac terminal to create the SD card file system. I got a huge warning about careless use of sudo, supplied my password and it looked like it worked, but it didn't. There were no signs of life from the Pi no matter how I connected it, except that the little red light came on. Then I noticed that the command line version of the instructions had a different form with rdisk3 instead of disk3s1. (Apparently about the raw disk, rather than the partition...) Trying it that way lead to a way faster write speed indicated in the activity monitor (14 MB/sec vs 2 MB/sec) but the output report looked much the same.

sudo dd bs=1m if=Downloads/Occidentalis_v02.img of=/dev/rdisk3
2479+1 records in
2479+1 records out
2600000000 bytes transferred in 180.307686 secs (14419796 bytes/sec)

So I was pleasantly surprised when I plugged in SD card, mouse and keyboard, HDMI, then power and it got me to the first blue screen. I followed the basic steps in that config, plus enabling SSH, then rebooted. It took 15 minutes or so to resize the blocks in the file system, then booted to the GUI. Yay!

Now I have a linux machine that runs like a slug! Make no mistake, the pi is not going to make you happy compared to the GUI you're used to unless you have been using really old hardware. The wired network worked right off, and the wifi works using the USB plug-in from Adafruit after appropriate edits in /etc/network/interfaces. I followed that success with a lot of messing about with XQuartz X11 on the iMac, iSSH on the iPad, and never really got a satisfactory result. I had trouble with X back in the 90's too... An ssh login with 

export DISPLAY=192.168.2.12:0
scratch &

allowed me to start an X session on iSSH on the iPad, which was really slow, but the equivalent didn't work on X11 on the iMac. Based on http://elinux.org/RPi_Remote_Access I ran:

sudo rm /etc/ssh/ssh_host_*
sudo dpkg-reconfigure openssh-server

to reset the RSA keys, but only after compromising the security of my iMac. So I took the offending RSA key out of ~/sellensr/.ssh/known_hosts on the iMac. (It looks like this was unnecessary: watching first boot of a fresh copy shows it generating a new set of keys that don't match the old keys.)

On the Pi I changed my pi password and edited /etc/hostname and etc/hosts to make the machine rwspi instead of raspberrypi and rebooted everything a few times until it took. I followed lesson 7 in hopes of a simpler path and typed:

sudo apt-get install tightvncserver
   [much verbiage ignored]
tightvncserver

in the terminal and supplied a password for the vnc server. Once everything was configured and safely shut down, I powered up the pi with nothing attached, except the wireless dongle in the USB port, and started a terminal session with the vanilla terminal program. I ssh'd into the pi and started the server like this:

ssh pi@rwspi.local
pi@rwspi.local's password: 
Linux rwspi 3.1.9adafruit+ #10 PREEMPT Thu Aug 30 20:07:05 EDT 2012 armv6l
[...]
Last login: Sat Feb  2 18:30:34 2013 from ricks-imac-3.local
pi@rwspi ~ $ tightvncserver :1

New 'X' desktop is rwspi:1

Starting applications specified in /home/pi/.vnc/xstartup
Log file is /home/pi/.vnc/rwspi:1.log


Then, I just ignored the terminal and ran the RealVNC VNC Viewer app to connect to rwspi.local:1 and got a window like this on the iMac screen.


I adjusted the settings to get a little better view at the expense of a a slower response. When I was done, I went back to the terminal and typed sudo shutdown now to kill everything gracefully. Apparently adding the -r option would get it to reboot.

So now I think I have a Raspberry Pi arrangement that allows me to sit comfortably at my desk and get the console on a top notch screen and keyboard. Somewhere in the middle there I was having problems with the cheap USB mouse and keyboard skipping and/or repeating, quite possibly due to low power, so I spent some time playing with a powered hub, which was also flake inducing, before finding out that there's an official approved hardware list. This saves me from all that hassle...

No comments:

Post a Comment