Upgrading Raspbian from jessie to buster (and fixing the wifi)
A long time ago, I bought a Raspberry Pi 2. I’ve been using it as a bastion host and ARM compilation machine for some time. I figured it was time to update it to the latest version of Raspbian.
Upgrading
- Upgrade all the jessie packages
% apt-get update % apt-get upgrade % apt-get dist-upgrade
- Switch to stretch package sources
% sudo grep -rl jessie /etc/apt/ | sudo xargs sed -i 's/jessie/stretch/g'
- Upgrade all the stretch packages
% apt-get update % apt-get upgrade % apt-get dist-upgrade
- Reboot
- Switch to buster package sources
% sudo grep -rl stretch /etc/apt/ | sudo xargs sed -i 's/stretch/buster/g'
- Upgrade all the buster packages
% apt-get update % apt-get upgrade % apt-get dist-upgrade
- Reboot
I have an 8GB microSD card, so I had to do a dance of running out of space, removing unused packages, purging my cache, etc. I also uninstalled GUI packages with
% apt-get remove x11-common --purge
The general process I followed when I ran out of space was
% apt-get autoremove --purge
% apt-get autoclean
Fixing networking
At some point, I either purged the firmware for my USB wifi adapter or it was otherwise lost. I reinstalled it with
% apt install firmware-ralink
To make things non-terrible, I also had to fix the ifup
configuration by
adding the relevant configurations in /etc/networking/interfaces.d
:
#/etc/network/interfaces.d/eth0
auto eth0
allow-hotplug eth0
iface eth0 inet dhcp
#/etc/network/interfaces.d/wlan0
auto wlan0
allow-hotplug wlan0
iface wlan0 inet dhcp
wpa-conf /etc/wpa_supplicant/wpa_supplicant.conf
Here’s wpa_supplicant.conf
just in case it’s marginally useful:
#/etc/wpa_supplicant/wpa_supplicant.conf
ctrl_interface=DIR=/var/run/wpa_supplicant GROUP=netdev
update_config=1
country=US
network={
ssid="SSID_HERE"
psk="PASSWORD_HERE"
key_mgmt=WPA-PSK
}
I don’t remember the exact error message, it was something to the effect of the
relevant device file not being found. There was no direct hint that firmware
was missing, though, as the relevant kernel modules were appropriately loaded
according to lsusb
and lsmod
.
If you need to connect via serial, wire it up according to this diagram