July 25, 2020

Raspberry Pi

I have had a Raspberry Pi sitting in a box for several years. So, I am going to drag it out and start my Raspberry Pi experience.

It is marked Raspberry Pi 2 Model B V1.1 2014. Date codes on chips look like 2014, so I have probably had this thing for at least 5 years without using it.

The first thing to do is to find a micro-SD card for it and then download some appropriate Linux distribution onto it.

The Raspberry Pi download site tells me that Raspbian is now called Raspberry Pi OS and is some form of Debian Buster. There are 3 choices. I pick the big one (which is 2.5G), which is Raspberry Pi OS with desktop and recommended software. While it is downloading, I scrounge around for a micro-SD card.

I find a new in package 8G Sandisk card, and the download ends up giving me:

-rw-rw-r-- 1 tom tom 2645200349 Jul 25 16:06 2020-05-27-raspios-buster-full-armhf.zip
Now I do this on my Fedora 30 desktop:
ls -l 2020*
-rw-r--r-- 1 tom tom 7365197824 May 27 00:46 2020-05-27-raspios-buster-full-armhf.img
-rw-rw-r-- 1 tom tom 2645200349 Jul 25 16:06 2020-05-27-raspios-buster-full-armhf.zip
It looks like this will just fit on my 8G card. I put the card into my USB card reader. It detects and mounts the useless VFAT partition as /dev/sdf1. This is important to get right, so I don't do some stupid thing and dd the raspberry image onto my system hard drive. Now I do:
umount /dev/sdf1
dd bs=4M if=2020-05-27-raspios-buster-full-armhf.img of=/dev/sdf conv=fsync
This takes a while, but hey -- I am moving 8G of stuff over USB. When it is done, I would think I could put the card into the raspberry, but keep reading.

Enable ssh

I discover this important tip by searching for "first time setup headless". I have no intention of hooking up a keyboard, mouse, and monitor. I don't even have an HDMI monitor that isn't in use.

Apparently ssh will not be enabled by default, but the claim is that if I write an empty file named "ssh" to the root directory, it will enable sshd on the first boot. This is wrong. The file needs to be in the boot partition, as I learn by following this bad advice and wasting time. So, I do the following. I unplug and replug the card in my card reader. Fedora detects and mounts both boot and rootfs for me. Then I do:

cd /run/media/tom/boot
touch ssh
umount /dev/sdf
And just for entertainment:
fdisk -l /dev/sdf
Disk /dev/sdf: 7.4 GiB, 7948206080 bytes, 15523840 sectors
Disklabel type: dos
Device     Boot  Start      End  Sectors  Size Id Type
/dev/sdf1         8192   532479   524288  256M  c W95 FAT32 (LBA)
/dev/sdf2       532480 14385151 13852672  6.6G 83 Linux


The claim is that I power this via USB. One source recommends a 2.0 or even a 2.5 amp power supply -- but says that you may get away with 1.0 amp for light use. I plan to just use this headless. My only real option is the supply for my Samsung phone, which is labeled at 2.0 amps.

The article above talks about powering it via pins on the GPIO header. Clearly the thing needs a barrel jack. Provision for a serial console would not hurt either.

Fire it up

I connect a network cable and power from my Samsung phone supply. Lights blink. The red light comes on, and the green light blinks furiously. I expect it to do DHCP, so I am running Wireshark, and indeed I see it get on the network and set itself up as I can ping it, but it refuses ssh connections. So Tom's hardware had bogus information about that ssh file in the root directory.

Actually, the problem is the imbeciles at Tom's hardware don't know the root partition from the boot partition, the file belongs in the boot partition. I was suspicious of this from the start -- and I was right. Here is the official word from the documentation:

3. Enable SSH on a headless Raspberry Pi.
For headless setup, SSH can be enabled by placing a file named ssh, without any extension, onto the boot partition of the SD card from another computer. When the Pi boots, it looks for the ssh file. If it is found, SSH is enabled and the file is deleted. The content of the file does not matter; it could contain text, or nothing at all.
Happily for me, I don't have to "dd" the whole image to the card and start over. I just put the ssh file into the root partition, boot it again, and it is responding to ssh.


This is one of those linux systems that has bought into the "sudo for everything", which I hate. I login as user pi, password "raspberry". The usual trick is "sudo su" to get a root shell. Then I can set a root password and this will act like a normal linux system. And there is one other step:

Go to /etc/ssh/sshd_config change the line as below

PermitRootLogin yes #(i just added this to the bottom of the file)
After this I do "service sshd restart". I also set the same password for root and for "pi". And now life is good.

This is a hot topic for some people, and I don't know why. I am an old hand in the Fedora world and there is none of this sudo nonsense. But it takes all kinds to make a world.

Install packages

The first thing I need is picocom and it ain't there. So, I'll have to install it. 8G of stuff and they leave out something this basic. This is a debian system, so "apt" is the game.
apt-get update
apt-get install picocom
That was easy and took less than 30 seconds.

My first project

I have a GPS gadget connected to a USB to serial converter. I plug it in and happily it gets set up as /dev/ttyUSB0. Then I do:
picocom -b 9600 /dev/ttyUSB0
And it works! I am looking at the NMEA messages pouring forth from my GPS gadget. With this running on a little headless computer, I can stick this out in my yard (with all due care to finding long enough network and power cables) and see if the antenna does better than in my house.


It looks like a civilized and full up linux system. And it was not that hard to set up, despite some misleading information. Most importantly, I think I can use it for what I want.

Have any comments? Questions? Drop me a line!

Tom's electronics pages / tom@mmto.org