Timeout with the Raspberry Pi 2

There is a website called EstateSales ( https://estatesales.org/ ) where you can bid for all sorts of stuff (new, used, etc.) and I believe they have a presence in most US states if not the larger cities.

I bidded on a Raspberry Pi 2 (status not tested) and got it for $2. If I add the gas to drive to the pickup location and back, maybe the total would come to about $8. I then bought a USB WiFi card for $4 on Ebay since the Pi 2 does not come with a WiFi inbuilt chip on the board.

Below are my notes from the “experience”:

– – – – This section is only if you can’t get the Pi on the network via its Ethernet interface – – –

– My first issue was that the Pi came with a HDMI port for which I didn’t have the cable, but fortunately my German friend left a Monitor with a VGA-to-HDMI cable attached. I connected it to the Pi as well as a USB keyboard and powered the Pi using its USB port connected to a USB port on my desktop PC.

– Second issue was that I didn’t know the password of the pi user since it was pre-owned so I had to intercept the boot process (the splash screen says to press the SHIFT key), append “init=/bin/bash” to the “kernel” line, and then issue a “mount -o rw,remount /” followed by a password reset for the pi and root users.
– – – – – – – – – – – – – – – – – – – – – –

– Connect through a console (HDMI Monitor and USB keyboard). If you decide not to get a WiFi card and you don’t want to attach the Pi via an Ethernet cable to your router, you can do the following to get access to the Pi from a Windows PC that you have connected to it via its Ethernet port (I couldn’t get it to access the Internet via ICS for some reason).
– Set ethernet interface eth0 to dhcp in /etc/network/interfaces
– Connect it to a Windows PC via an ethernet cable
– Configure ICS on say the WIFI interface of the Windows PC with the Ethernet as the “home network” (ICS then pops-up the message that it will assign 192.168.137.1 to the Ethernet interface on the PC)
– Run “arp -a” on the Windows PC and look for all IPs in the 192.168.137.x (one of them will be the IP assigned to the raspberry by ICS)
– The interface on this specific Pi has the MAC address b8-27-eb-90-b3-30 which is also visible in the “arp -a” output
– SSH to the Pi IP address and login with the root or pi user

– NOTE: ping the broadcast IP of the IP address assigned to the Windows Ethernet interface may help get the MAC/IP assigned to the Raspberry Pi to show up in the output of the “arp -a” command e.g., “ping 192.168.137.255”

– NOTE: if you can’t get the Pi to be assigned an IP address via ICS, do the following:

  1. Make sure ICS service is running on the Windows PC (restart it if necessary)
  2. Disable ICS on the NIC that is being shared via ICS (e.g., the WiFi NIC) then re-enable ICS

NOTE: watch out for the SD card on which the O/S is installed. It is very easy to eject it without noticing – if you are on the console, you will see it start to display “read errors” on the SD card and essentially stops working. If you are just attempting to boot up the Pi, it won’t boot at all since the O/S is on the SD card.

Issue three: The much older kernel on the Pi (I think it was 3.18 from year 2016) did not have drivers for the Ralink WiFi (USB) card I got off E-Bay. I was able to upgrade the O/S to a 4.19 kernel, but later decided I would just install a completely new Pi distribution by using the https://www.raspberrypi.org/software/ Windows Raspberry Pi Imager (there is a version for Ubuntu as well). The Imager prompts to select a O/S distro/version and the target Storage (I inserted the SD card into my Windows laptop using a Micro SD Adapter) and it will then download the selected image and (over)write it to the the SD card so backup its contents first if you need them.
The latest version as at 05/26/2021 is the 1.1GB Raspberry Pi OS (32-bit) released 2021-03-04 (includes the Pi Desktop).
There is also a 0.4GB Raspberry Pi OS Lite (32-bit) with no desktop environment released on the same date (2021-03-04)

– In order to access the instance via SSH, you need to enable the SSH service first:
sudo systemctl enable ssh
sudo systemctl start ssh

– I decided to configure the Pi to boot into multi-user mode (CLI with network services) instead of graphical mode which will consume more system resources:
sudo systemctl set-default multi-user


My particular Ralink WiFI USB card had the MAC address 00:E0:2D:90:70:34
Sample network interface file content: https://gist.github.com/spikeheap/7857064

– Configure the WiFI network you intend the system to join in the file /etc/wpa_supplicant/wpa_supplicant.conf :

ctrl_interface=DIR=/var/run/wpa_supplicant GROUP=netdev
update_config=1
country=US

network={
ssid=”IA”
psk=”my-Super-Password”
}

– Configure the network interfaces in the file /etc/network/interfaces

source-directory /etc/network/interfaces.d

auto lo
iface lo inet loopback

alow-hotplug wlan0
auto wlan0
iface wlan0 inet dhcp
wpa-conf /etc/wpa_supplicant/wpa_supplicant.conf

auto eth0
iface eth0 inet dhcp

– Reconfigure the WiFI start the card:
sudo wpa_cli -i wlan0 reconfigure
sudo ifdown wlan0
sudo ifup wlan0

– Restart the networking service if necessary:
sudo systemctl restart networking

– Troubleshooting: To scan and check WiFI networks, use the command “sudo iwlist wlan0 scan” and check the essid field. This field should be the same as what you entered in the ssid field in the /etc/wpa_supplicant/wpa_supplicant.conf file .

root@raspberrypi:~# lsusb
Bus 001 Device 002: ID 0424:9514 Standard Microsystems Corp.
Bus 001 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
Bus 001 Device 003: ID 0424:ec00 Standard Microsystems Corp.
Bus 001 Device 004: ID 1c4f:0002 SiGma Micro Keyboard TRACER Gamma Ivory
Bus 001 Device 005: ID 0bda:c811 Realtek Semiconductor Corp. <—- needs drivers
Bus 001 Device 006: ID 148f:7601 Ralink Technology, Corp. <—- supported out of the box by the 2021-03-04 distro


Just for fun: I also had a Realtek WiFi USB card as well that is normally connected to my Windows Desktop PC so I can avoid using an Ethernet cable to connect it to the Internet router which is somewhere else in the house. You can see it is detected from the output of the “lsusb” command above but the Pi OS did not have in-built drivers for it. You can install the drivers as follows:

sudo wget http://downloads.fars-robotics.net/wifi-drivers/install-wifi -O /usr/bin/install-wifi
sudo chmod +x /usr/bin/install-wifi
sudo /usr/bin/install-wifi
(this script detects the card, downloads and install the appropriate driver and configures the card. In this case, it downloaded the driver file 8821cu-5.10.17-1403.tar.gz)

– Some Links

http://downloads.fars-robotics.net/ (lots of commands related to setting up networking on the Pi)
http://downloads.fars-robotics.net/wifi-drivers/ (drivers for Realtek cards)
https://www.raspberrypi.org/forums/viewtopic.php?p=1133815#p1133815 (where I got the reference to the install-wifi script)

Pi 2 with the WiFI USB card