Migrating from Raspberry Pi 3B+ to 4B

I have been using Home Assistant for a couple of years and just migrated from a Raspberry Pi 3B+ (running Stretch with Python 3.5 installed) to a Raspberry PI 4 by moving my SD card and SSD drive without a clean image install with no loss of data. Previously I had successfully migrated from the Raspberry PI 2 model B to the 3B+ without a clean image install and no loss of data so I thought I would try the same for the 3B+ to the 4B migration. For the whole time I have been running Home Assistant on Raspian with a venv and using a PiDrive mSATA interface board from the original kickstarter campaign with a mydigitalSSD BP4E 128GB mSATA SSD installled on it. The PiDrive is in the Raspberry Pi form factor and plugs into the 40 pi connector, but all the power and interface is done through the USB cable/connection. I actually plugged in a powered hub on the model 2 and 3B+ so the SSD would work correctly. I did not connect the PiDrive to the hub. I have always have had to boot from the SD card and then it runs the OS from the SSD. I believe that is the case for the Raspberry Pi 4B at the present time. I can say that the the Raspberry PI 4B is a great improvement but I only realized a 25% improvement in the SSD performance because the PiDrive interface is USB 2.0. The following is a summary of the process I used a best as I can remember.

Steps on the Raspberry 3B+ system:

  1. Upgrade to Buster from Stretch ( this also solves the Piwheel issue and upgrades to python 3.7 so hopefully I should be good for a while. I followed the instructions found at Raspberrypi.org

sudo apt update
sudo apt dist-upgrade

After rebooting into Buster OS:

sudo apt purge timidity lxmusic gnome-disk-utility deluge-gtk evince wicd wicd-gtk clipit usermode gucharmap gnome-system-tools pavucontrol

  1. I had then to re-install the homeassistant and appdaemon (using hadashboard) venv at /srv/homeassistant and /srv/appdaemon, respectively becasue they were still on Python 3.5. I followed the instructions for the manual installation , but I did not have to create the homeassistant account since that was not affected. I did rename the old /srv/homeassistant and /srv/appdaemondirectories first as a backup.

  2. I shutdown and removed the power from the 3 B+.

  3. I then removed the SD card, PiDrive and keyboard/mouse USB dongle from the 3B+.

Steps on the Raspberry Pi 4B:

  1. I installed the SD card, PiDrive and keyboard/mouse USB dongle from the 3B+ into the 4B. I did not plug the PiDrive onto the 40 pin header but just plugged the PiDrive USB cable into the USB 3.0 port the 4B because USB 3.0 ports have more power sourcing capability than 2.0 ports (according the specs anyways). The 4B case that came with the CanaKit did not have a space for the PiDrive to be plugged on top of the Raspberry Pi board and I did not want to block the air from the included cooling fan in the cover. So the PiDrive is just sitting next to the 4B case.

  2. I connected the CanaKit power supply and micro HDMI to HDMI cable into the 4K TV. I also connected the ethernet cable since I have always used a static IP with the wired network connection. I did not switch to a WiFI network connection when I migrated from a 2 to a 3B+

  3. I then applied power using the USB switch and lo and behold it booted up in the desktop interface, but only at 1080p HD and the menu did not have the Screen Configuration menu item under the Preferences menu. More on this later.

  4. I then did the usual sudo apt update and sudo apt upgrade and rebooted. This is where I wasted a lot of time because the ethernet and wifi networks were stopped and I tried several things to try to remedy the problem including many many reboots. [NOTE: The network connection issue has been resolved in a newer version of the kernel. I am now running kernel version: Linux raspberrypi 4.19.66-v7l+ #1253 SMP Thu Aug 15 12:02:08 BST 2019 and do not need to use the delay work arounds shown below. See https://github.com/raspberrypi/linux/pull/3121] Searching the internet I found this. And yes the network comes up fine from a cold start or unplugging and re-plugging the ethernet cable in after it comes up from a reboot. I believe the final conclusion of the discussion was that it was a hardware issue. Well I tried rebooting my Raspberry pi with an a clean image on a new SD card without the PiDrive and the network would come up every reboot. I believe it is some kind of USB power issue?? The good news is that the fix found in the discussion worked for me. That is to add

(sleep 30s; ethtool -r eth0;) &

to the in /etc/rc.local file. Then I added this to my /etc/systemd/system/[email protected] file immediately under the [Service] line so the network is up when Home Assistant starts.

ExecStartPre=/bin/sleep 35

  1. More on the getting a 4k desktop displayed. The steps I followed are:
    a. Enabled GL Driver using

sudo raspi-config


xrandr -s 3840x2160


sudo apt install arandr

Installing arandr was what provided the Screen Configuration menu item. I am not sure all these steps are needed. Maybe just installing arandr?