Coding with Titans

so breaking things happens constantly, but never on purpose

HowTo: OS upgrade on Raspberry Pi 4

The process of system upgrade is very easy and was already described here. This is a really great guide. I just want to add few comments, that affected my installation.

The main actions to perform to install latest version of Raspbian are:

  1. Go to raspberrypi.org and check the latest OS codename.

  2. Verify, if this version is not already installed on the Raspberry using cat /etc/os-release command.

$ cat /etc/os-release

PRETTY_NAME="Raspbian GNU/Linux 9 (stretch)"
NAME="Raspbian GNU/Linux"
VERSION_ID="9"
VERSION="9 (stretch)"
VERSION_CODENAME=stretch
ID=raspbian
ID_LIKE=debian
HOME_URL="http://www.raspbian.org/"
SUPPORT_URL="http://www.raspbian.org/RaspbianForums"
BUG_REPORT_URL="http://www.raspbian.org/RaspbianBugs"
In my case then I will upgrade from `stretch` to `buster` edition.
  1. Update all packages to the latest calling:
sudo apt update
and then:
sudo apt dist-upgrade
After this process, you should have upgraded everything to latest for you current OS version.
  1. Now is the time to point to the latest system version. It’s required to update paths to package repositories by editing two files:

    • /etc/apt/sources.list
    • /etc/apt/sources.list.d/raspi.list

    and replacing the old system name (stretch) with the new name (buster).

  2. Initilize the system binaries and kernel update using command:

sudo apt dist-upgrade
This might take some time and free space (depending on the number of packages that were installed on the class of the microSD card).
During this process popups might show up, asking about all kinds of nasty things:

  * if services should, be restarted
  * if WINS server configuration should be also obtained from DNS (samba)
  * if some obsolete packages should be upgraded to latest versions (PostgreSQL 9.6 to 11.0)
  * if your manually edited files should be overwritten or kept (nginx)
  
So it's wiser to stay in front of the shell otherwise the whole process won't complete.
  1. Cleanup, when the installation completes.

    Remove unnecessary packages, that left around:

sudo apt autoremove
Clear packages caches:
sudo apt autoclean
  1. Reboot to apply new kernel and all recent changes.

And I should finish at this point. Unfortunately my Gitea service couldn’t start. Instead of a running website, I have seen a BAD GATEWAY and digging deeper turned out as a segmentation fault crash of the gitea executable.

$ strace ./gitea-latest web

execve("./gitea-latest", ["./gitea-latest", "web"], 0x7edc57d4 /* 16 vars */) = 0
brk(NULL)                               = 0x914000
brk(0x914d18)                           = 0x914000
--- SIGSEGV {si_signo=SIGSEGV, si_code=SEGV_MAPERR, si_addr=0x24} ---
+++ killed by SIGSEGV +++
Segmentation fault

I got really surprised as there was even a bug #3271 submitted 2 weeks earlier. Thankfully with the solution. As the last step I had to execute following command to update kernel to latest available (developed!) version. Doing this is something I would highly discourage on a regular basis, but in my case, it really helped and fixed the issue.

sudo rpi-update

And it changed the kernel from:

$ uname -a
Linux TytanARM 4.19.75-v7+ #1270 SMP Tue Sep 24 18:45:11 BST 2019 armv7l GNU/Linux

into:

$ uname -a
Linux TytanARM 4.19.80-v7+ #1274 SMP Mon Oct 21 16:23:10 BST 2019 armv7l GNU/Linux

Very good. Another problem solved!