RonR
Posts: 2380
Joined: Tue Apr 12, 2016 10:29 pm
Location: US

Upgrading Raspberry Pi OS Buster to Bullseye for Testing Purposes

Mon Aug 16, 2021 7:10 pm

The attached script will upgrade Raspberry Pi OS Buster (32-bit or 64-bit) to Bullseye.

Answer 'Yes' to any questions during the process. Be patient as it's a lengthy process.

It's best to run this script on a fresh installation of Raspberry Pi OS Buster.
Do *NOT* use this script without having a reliable backup of the system it's being run on!

Problems are a possibility as Raspberry Pi OS Bullseye is an unfinished/unreleased OS.
Attachments
buster2bullseye.zip
(923 Bytes) Downloaded 1043 times
Last edited by RonR on Sun Aug 22, 2021 8:11 am, edited 1 time in total.

User avatar
CaptainMidnight
Posts: 249
Joined: Sun Nov 03, 2019 4:32 pm
Location: UK

Re: Upgrading Raspberry Pi OS Buster to Bullseye for Testing Purposes

Mon Aug 16, 2021 7:39 pm

Thanks RonR, I've been playing around with some initial test upgrades to Bullseye, but it's always interesting looking through your scripts and picking up some ideas...

Edit: worked better than my first attempts, all looks ok.
"Never get out of the boat." Absolutely goddamn right!
Unless you were goin' all the way...

bls
Posts: 1682
Joined: Mon Oct 22, 2018 11:25 pm
Location: Seattle, WA

Re: Upgrading Raspberry Pi OS Buster to Bullseye for Testing Purposes

Tue Aug 17, 2021 12:26 am

RonR, this is great! I used it upgrade a 64-bit RasPiOS sdm-customized image to Bullseye in a systemd-nspawn session.

Worked like a charm...Looks like there are a few things to chase down, but it booted and runs. Now I have a working ready-to-run 64-bit Bullseye image for early testing.

Thanks for sharing!
Pi tools:
Quickly and easily build customized-just-for-you SSDs/SD Cards: https://github.com/gitbls/sdm
Easily run and manage your network's DHCP/DNS servers on a Pi: https://github.com/gitbls/ndm
Easy and secure strongSwan VPN installer/manager: https://github.com/gitbls/pistrong
Lightweight Virtual VNC Config: https://github.com/gitbls/RPiVNCHowTo

User avatar
craigevil
Posts: 248
Joined: Wed Jan 27, 2021 5:22 am
Location: OZ

Re: Upgrading Raspberry Pi OS Buster to Bullseye for Testing Purposes

Tue Aug 17, 2021 1:42 am

A RPIOS/Debian Bullseye sources.list with the links to relevant docs.

Code: Select all

# Raspberry PI OS Buster repository
deb https://archive.raspberrypi.org/debian/ buster main

# Raspberry PI OS Bullseye repository
deb https://archive.raspberrypi.org/debian/ bullseye main

# Bullseye https://www.debian.org/releases/bullseye/arm64/release-notes/ch-upgrading.en.html
 deb https://deb.debian.org/debian/ bullseye main contrib non-free
# deb-src https://deb.debian.org/debian/ bullseye main contrib non-free

# Bullseye Security https://www.debian.org/releases/bullseye/arm64/release-notes/ch-information.en.html#security-archive
 deb https://deb.debian.org/debian-security bullseye-security main contrib non-free
# deb-src https://deb.debian.org/debian-security bullseye-security main contrib non-free

# Bullseye Updates https://wiki.debian.org/DebianBullseye#FAQ
 deb https://deb.debian.org/debian bullseye-updates main contrib non-free
# deb-src https://deb.debian.org/debian bullseye-updates main contrib non-free

# Bullseye Backports  https://backports.debian.org/
# deb https://deb.debian.org/debian/ bullseye-backports main contrib non-free
# deb-src https://deb.debian.org/debian/ bullseye-backports main contrib non-free

# Bullseye Proposed Updates https://wiki.debian.org/StableProposedUpdates
# deb https://deb.debian.org/debian/ bullseye-proposed-updates main contrib non-free 
# deb-src https://deb.debian.org/debian/ bullseye-proposed-updates main contrib non-free
My actual sources.list
inxi -r
Repos: Active apt repos in: /etc/apt/sources.list
1: deb https://deb.debian.org/debian unstable main contrib non-free
2: deb https://deb.debian.org/debian experimental main contrib non-free
3: deb https://incoming.debian.org/debian-buildd buildd-unstable main contrib non-free
Active apt repos in: /etc/apt/sources.list.d/github-cli.list
1: deb [arch=arm64 signed-by=/usr/share/keyrings/githubcli-archive-keyring.gpg] https://cli.github.com/packages stable main
Active apt repos in: /etc/apt/sources.list.d/raspi.list
1: deb https://archive.raspberrypi.org/debian/ buster main
2: deb https://archive.raspberrypi.org/debian/ bullseye main

Very nice update script!
Raspberry PI 400 Raspberry Pi OS (Debian Bookworm/sid) Kernel: 5.10.63-v8+ aarch64 DE: MATE Ram 4GB
Debian - "If you can't apt install something, it isn't useful or doesn't exist"

User avatar
Milliways
Posts: 739
Joined: Fri Apr 25, 2014 12:18 am
Location: Sydney, Australia

Re: Upgrading Raspberry Pi OS Buster to Bullseye for Testing Purposes

Tue Aug 17, 2021 4:53 am

RonR wrote:
Mon Aug 16, 2021 7:10 pm
The attached script will upgrade Raspberry Pi OS Buster (32-bit or 64-bit) to Bullseye.

Answer 'Yes' to any questions during the process. Be patient as it's a lengthy process.

It's best to run this script on a fresh installation of Raspberry Pi OS Buster.
Do *NOT* use this script without having a reliable backup of the system it's being run on!

Problems are a possibility as Raspberry Pi OS Bullseye is an unfinished/unreleased OS.
I already had a Bullseye installation which I have been updating for some months, but the latest seemed to break WiFi.

I decided to try this on top of my working Buster image.
It seemed to work well, and didn't take too long.

I updated and was told "48 packages can be upgraded. Run 'apt list --upgradable' to see them."

Upgrade showed:-

Code: Select all

The following packages have been kept back:
  libasound2-data libcairo-gobject2 libgtk2.0-bin libpulsedsp plymouth-label qpdfview-translations qt5-style-plugins
0 upgraded, 0 newly installed, 0 to remove and 7 not upgraded.
I note that python3 is still at 3.7, although my latest upgrade of my other Bullseye system installed 3.9 over 3.8

RonR
Posts: 2380
Joined: Tue Apr 12, 2016 10:29 pm
Location: US

Re: Upgrading Raspberry Pi OS Buster to Bullseye for Testing Purposes

Tue Aug 17, 2021 5:02 am

bls wrote:
Tue Aug 17, 2021 12:26 am
RonR, this is great! I used it upgrade a 64-bit RasPiOS sdm-customized image to Bullseye in a systemd-nspawn session.

Worked like a charm...Looks like there are a few things to chase down, but it booted and runs. Now I have a working ready-to-run 64-bit Bullseye image for early testing.

Thanks for sharing!

I used Image File Utilities to upgrade copies of 2021-05-07-raspios-buster-arm*.img to 2021-05-07-raspios-bullseye-arm*.img:

1. image-shrink to add a couple of GB of free space to the image file while upgrading

2. image-chroot to chroot into the image file

3. buster2bullseye to upgrade the image file from Buster to Bullseye

4. image-shrink to remove the excess free space from the image file

RonR
Posts: 2380
Joined: Tue Apr 12, 2016 10:29 pm
Location: US

Re: Upgrading Raspberry Pi OS Buster to Bullseye for Testing Purposes

Tue Aug 17, 2021 5:13 am

Milliways wrote:
Tue Aug 17, 2021 4:53 am
RonR wrote:
Mon Aug 16, 2021 7:10 pm
The attached script will upgrade Raspberry Pi OS Buster (32-bit or 64-bit) to Bullseye.

Answer 'Yes' to any questions during the process. Be patient as it's a lengthy process.

It's best to run this script on a fresh installation of Raspberry Pi OS Buster.
Do *NOT* use this script without having a reliable backup of the system it's being run on!

Problems are a possibility as Raspberry Pi OS Bullseye is an unfinished/unreleased OS.
I already had a Bullseye installation which I have been updating for some months, but the latest seemed to break WiFi.

I decided to try this on top of my working Buster image.
It seemed to work well, and didn't take too long.

I updated and was told "48 packages can be upgraded. Run 'apt list --upgradable' to see them."

Upgrade showed:-

Code: Select all

The following packages have been kept back:
  libasound2-data libcairo-gobject2 libgtk2.0-bin libpulsedsp plymouth-label qpdfview-translations qt5-style-plugins
0 upgraded, 0 newly installed, 0 to remove and 7 not upgraded.
I note that python3 is still at 3.7, although my latest upgrade of my other Bullseye system installed 3.9 over 3.8

None of those problems here.

buster2bullseye is not intended to update an existing Bullseye installation (you must have removed the check for Buster).

Immediately after running buster2bullseye on a Buster installation:

Code: Select all

root@raspberrypi:~# apt update
Hit:1 http://archive.raspberrypi.org/debian bullseye InRelease
Hit:2 http://raspbian.raspberrypi.org/raspbian bullseye InRelease
Reading package lists... Done
Building dependency tree... Done
Reading state information... Done
All packages are up to date.

root@raspberrypi:~# python3 --version
Python 3.9.2

Try starting from a clean Buster installation.

ralphrmartin
Posts: 19
Joined: Sat May 06, 2017 3:42 pm

Re: Upgrading Raspberry Pi OS Buster to Bullseye for Testing Purposes

Wed Aug 18, 2021 7:23 pm

For extra credit, how about a script to also upgrade (or even cross-grade) from 32-bit to 64-bit?

emma1997
Posts: 1598
Joined: Sun Nov 08, 2015 7:00 pm
Location: New England (not that old one)

Re: Upgrading Raspberry Pi OS Buster to Bullseye for Testing Purposes

Wed Aug 18, 2021 10:29 pm

James164 wrote:
Tue Aug 17, 2021 5:42 am
Looks like there are a few things to chase down, but it booted and runs.
bls wrote:
Tue Aug 17, 2021 12:26 am
.Looks like there are a few things to chase down, but it booted and runs.
Looks like there's a few echos in here. Or maybe James plans to return at a later date and tack on a link or two?

User avatar
pi-anazazi
Posts: 988
Joined: Fri Feb 13, 2015 9:22 pm
Location: EU

Re: Upgrading Raspberry Pi OS Buster to Bullseye for Testing Purposes

Thu Aug 19, 2021 9:27 am

Upgraded in the past by changing repo names and apt update and apt full-upgrade. What does the script on-top/other?
Kind regards

anazazi

User avatar
craigevil
Posts: 248
Joined: Wed Jan 27, 2021 5:22 am
Location: OZ

Re: Upgrading Raspberry Pi OS Buster to Bullseye for Testing Purposes

Thu Aug 19, 2021 3:43 pm

ralphrmartin wrote:
Wed Aug 18, 2021 7:23 pm
For extra credit, how about a script to also upgrade (or even cross-grade) from 32-bit to 64-bit?
You can't actually upgrade or whatever it would be to arm64 from armhf.

But you can do this:

Code: Select all

dpkg --add-architecture arm64
And add

Code: Select all

arm_64bit=1
to /etc/boot/config.txt

https://wiki.debian.org/Multiarch
Raspberry PI 400 Raspberry Pi OS (Debian Bookworm/sid) Kernel: 5.10.63-v8+ aarch64 DE: MATE Ram 4GB
Debian - "If you can't apt install something, it isn't useful or doesn't exist"

twojstary
Posts: 16
Joined: Mon Feb 27, 2017 11:21 pm

Re: Upgrading Raspberry Pi OS Buster to Bullseye for Testing Purposes

Thu Aug 19, 2021 8:00 pm

Debian Bullseye is out of testing now: https://www.debian.org/News/2021/20210814

I don't see an image for Raspbian Bullseye under https://downloads.raspberrypi.org/raspi ... hf/images/, anyone have any idea how long the packagers for Raspbian take?

As for stability, Bullseye has been more stable than buster in my experience. Wifi stability is the same still seeing occasional ARP response failures when under heavy IP load (by inbound UDP traffic to RPi).

Of note in Bullseye:
Systemd is actually becoming usable with 247.3 in this release since the aged 241-7 with plenty of needed options for normal operation. Of note: ExecCondition, which allows for the conditional starting of services.
Pulseaudio 15.0 didn't make it for this release, it's still on 14.2.
Bluez is at 5.55-3.1, 6 releases behind the current 5.60.

User avatar
davidcoton
Posts: 6515
Joined: Mon Sep 01, 2014 2:37 pm
Location: Cambridge, UK

Re: Upgrading Raspberry Pi OS Buster to Bullseye for Testing Purposes

Thu Aug 19, 2021 9:39 pm

twojstary wrote:
Thu Aug 19, 2021 8:00 pm
Debian Bullseye is out of testing now: https://www.debian.org/News/2021/20210814

I don't see an image for Raspbian Bullseye under https://downloads.raspberrypi.org/raspi ... hf/images/, anyone have any idea how long the packagers for Raspbian take?
See viewtopic.php?f=66&t=317787#p1902031 and the replies there. (Ignore Dougie's link, it is not relevant.)
Location: 345th cell on the right of the 210th row of L2 cache

klricks
Posts: 7963
Joined: Sat Jan 12, 2013 3:01 am
Location: Grants Pass, OR, USA
Contact: Website

Re: Upgrading Raspberry Pi OS Buster to Bullseye for Testing Purposes

Thu Aug 19, 2021 10:08 pm

twojstary wrote:
Thu Aug 19, 2021 8:00 pm
...
I don't see an image for Raspbian Bullseye under https://downloads.raspberrypi.org/raspi ... hf/images/, anyone have any idea how long the packagers for Raspbian take?

.....
Based on past release history, 2 to 4 months: viewtopic.php?p=1899779#p1899779
Unless specified otherwise my response is based on the latest and fully updated RPiOS Buster w/ Desktop OS.

tinker2much
Posts: 307
Joined: Wed Jun 20, 2018 12:38 am

Re: Upgrading Raspberry Pi OS Buster to Bullseye for Testing Purposes

Sat Aug 21, 2021 2:55 pm

I ran this last night and it worked great. Does take forever, even on an SSD. I haven't yet run it enough to know what, if any, gaps remain in bullseye.

(I used it in combination with another of your great utilities - MultiBoot - so it's just an additional partition on a large SSD.)

ralphrmartin
Posts: 19
Joined: Sat May 06, 2017 3:42 pm

Re: Upgrading Raspberry Pi OS Buster to Bullseye for Testing Purposes

Sat Aug 21, 2021 2:56 pm

craigevil wrote:
Thu Aug 19, 2021 3:43 pm
You can't actually upgrade or whatever it would be to arm64 from armhf.
See
https://wiki.debian.org/CrossGrading
at least for 32-bt to 64-bit intel systems.

User avatar
rpdom
Posts: 19035
Joined: Sun May 06, 2012 5:17 am
Location: Chelmsford, Essex, UK

Re: Upgrading Raspberry Pi OS Buster to Bullseye for Testing Purposes

Sat Aug 21, 2021 3:48 pm

ralphrmartin wrote:
Sat Aug 21, 2021 2:56 pm
craigevil wrote:
Thu Aug 19, 2021 3:43 pm
You can't actually upgrade or whatever it would be to arm64 from armhf.
See
https://wiki.debian.org/CrossGrading
at least for 32-bt to 64-bit intel systems.
Hmm, I might give that a go with a spare 3B+. It'll need a few Pi specific changes though. I'll start with Lite and move to Desktop if I can find a spare monitor.
Unreadable squiggle

User avatar
Botspot
Posts: 1769
Joined: Thu Jan 17, 2019 9:47 pm
Location: Texas
Contact: Website

Re: Upgrading Raspberry Pi OS Buster to Bullseye for Testing Purposes

Sat Aug 21, 2021 7:16 pm

This script does not work properly if the userland is 32-bit but the kernel is 64-bit.
Consider changing your script to use a method like this:

Code: Select all

if [ "$(od -An -t x1 -j 4 -N 1 "$(readlink -f /sbin/init)")" = ' 02' ];then
  arch=64
elif [ "$(od -An -t x1 -j 4 -N 1 "$(readlink -f /sbin/init)")" = ' 01' ];then
  arch=32
else
  errexit "Failed to detect OS CPU architecture! Something is very wrong."
fi
Pi-Apps - #1 most popular Raspberry Pi app store with >500,000 users.
Includes the Zoom desktop app, 3 ways to run Minecraft, 7 web browsers, appearance themes, and 72 more.
More info: https://github.com/Botspot/pi-apps

RonR
Posts: 2380
Joined: Tue Apr 12, 2016 10:29 pm
Location: US

Re: Upgrading Raspberry Pi OS Buster to Bullseye for Testing Purposes

Sat Aug 21, 2021 9:28 pm

Botspot wrote:
Sat Aug 21, 2021 7:16 pm
This script does not work properly if the userland is 32-bit but the kernel is 64-bit.
Consider changing your script to use a method like this:

Code: Select all

if [ "$(od -An -t x1 -j 4 -N 1 "$(readlink -f /sbin/init)")" = ' 02' ];then
  arch=64
elif [ "$(od -An -t x1 -j 4 -N 1 "$(readlink -f /sbin/init)")" = ' 01' ];then
  arch=32
else
  errexit "Failed to detect OS CPU architecture! Something is very wrong."
fi

Consider this simple solution instead:

1. Remove the 'arm_64bit=1' line you added in /boot/config.txt

2. Run 'sudo ./buster2bullseye'

3. Add the 'arm_64bit=1' line back into /boot/config.txt

RonR
Posts: 2380
Joined: Tue Apr 12, 2016 10:29 pm
Location: US

Re: Upgrading Raspberry Pi OS Buster to Bullseye for Testing Purposes

Sun Aug 22, 2021 1:55 am

tinker2much wrote:
Sat Aug 21, 2021 2:55 pm
I ran this last night and it worked great. Does take forever, even on an SSD.

Using the Bullseye system you've now created, it's easy to upgrade a Buster image file to Bullseye so you don't have to keep going through the process:

Code: Select all

pi@raspberrypi:~# sudo image-shrink 2021-05-07-raspios-buster-armhf.img 2000

Shrink 2021-05-07-raspios-buster-armhf.img [Additional MB = 2000] (y/n)? y
...

pi@raspberrypi:~# sudo image-chroot 2021-05-07-raspios-buster-armhf.img

chroot to 2021-05-07-raspios-buster-armhf.img (y/n)? y

Attempting to chroot to 2021-05-07-raspios-buster-armhf.img
Host root filesystem is available at /host-root-fs
Use exit or ^D to terminate chroot

root@raspberrypi:/# /host-root-fs/pathto/buster2bullseye
...

root@raspberrypi:/# exit
exit

Exited chroot to 2021-05-07-raspios-buster-armhf.img

pi@raspberrypi:~# sudo image-shrink 2021-05-07-raspios-buster-armhf.img 0

Shrink 2021-05-07-raspios-buster-armhf.img [Additional MB = 0] (y/n)? y
...

pi@raspberrypi:~# mv 2021-05-07-raspios-buster-armhf.img 2021-05-07-raspios-bullseye-armhf.img

User avatar
Botspot
Posts: 1769
Joined: Thu Jan 17, 2019 9:47 pm
Location: Texas
Contact: Website

Re: Upgrading Raspberry Pi OS Buster to Bullseye for Testing Purposes

Sun Aug 22, 2021 2:53 am

RonR wrote:
Sat Aug 21, 2021 9:28 pm
Botspot wrote:
Sat Aug 21, 2021 7:16 pm
This script does not work properly if the userland is 32-bit but the kernel is 64-bit.
Consider changing your script to use a method like this:

Code: Select all

if [ "$(od -An -t x1 -j 4 -N 1 "$(readlink -f /sbin/init)")" = ' 02' ];then
  arch=64
elif [ "$(od -An -t x1 -j 4 -N 1 "$(readlink -f /sbin/init)")" = ' 01' ];then
  arch=32
else
  errexit "Failed to detect OS CPU architecture! Something is very wrong."
fi

Consider this simple solution instead:

1. Remove the 'arm_64bit=1' line you added in /boot/config.txt

2. Run 'sudo ./buster2bullseye'

3. Add the 'arm_64bit=1' line back into /boot/config.txt
Sure, I could work around the flaw in your script by editing a file twice and rebooting twice, but what about the average person who didn't read your script first before running it, didn't identify the flaw I identified, and didn't refrain from running your script which now added the wrong repositories - effectively breaking all apt updates and installations?
This seems like the kind of failure that you would want to fix.

And yes, running the 64-bit kernel on a 32-bit OS is not uncommon: it turns out a large portion of daily RPi users have the 64-bit kernel enabled on their 32-bit systems. (yes I have proof)
Pi-Apps - #1 most popular Raspberry Pi app store with >500,000 users.
Includes the Zoom desktop app, 3 ways to run Minecraft, 7 web browsers, appearance themes, and 72 more.
More info: https://github.com/Botspot/pi-apps

RonR
Posts: 2380
Joined: Tue Apr 12, 2016 10:29 pm
Location: US

Re: Upgrading Raspberry Pi OS Buster to Bullseye for Testing Purposes

Sun Aug 22, 2021 8:12 am

buster2bullseye.zip (in the first post of this topic) has been updated.

This update adds support for 32-bit Raspberry Pi OS installations where the user added 'arm_64bit=1' to /boot/config.txt.

jeremym
Posts: 3
Joined: Thu Jan 14, 2021 4:27 pm

Re: Upgrading Raspberry Pi OS Buster to Bullseye for Testing Purposes

Mon Aug 23, 2021 9:27 am

Firstly, thank you for posting the script RonR.

Please forgive my ignorance, but after using this script will my Pi automatically receive any changed packages, when the Raspberry Pi OS is officially upgraded to Bullseye? I note the sources are different to RonR's, after the upgrade.

Code: Select all

apt update
Hit:1 http://archive.raspberrypi.org/debian bullseye InRelease
Hit:2 http://deb.debian.org/debian bullseye InRelease
Hit:3 http://packages.azlux.fr/debian buster InRelease
Get:4 http://deb.debian.org/debian bullseye-updates InRelease [36.8 kB]
Fetched 36.8 kB in 2s (15.8 kB/s)
Reading package lists... Done
Building dependency tree... Done
Reading state information... Done
All packages are up to date.

Code: Select all

http://packages.azlux.fr/debian buster InRelease
is the source for Log2Ram.

I've used the script to upgrade ten Raspberry Pi 4's, running the 64-bit lite beta to do folding@home work, without any issues. But as there aren't any customisations, I expected that.

I'm a bit more cautious about using the script to upgrade my Pi Zero, which is my recursive DNS server (running PiHole, Unbound & Log2Ram). Has anyone used the scripts to upgrade their DNS server?

RonR
Posts: 2380
Joined: Tue Apr 12, 2016 10:29 pm
Location: US

Re: Upgrading Raspberry Pi OS Buster to Bullseye for Testing Purposes

Mon Aug 23, 2021 6:09 pm

jeremym wrote:
Mon Aug 23, 2021 9:27 am

Code: Select all

http://packages.azlux.fr/debian buster InRelease
is the source for Log2Ram.

Only Raspberry Pi OS package sources are changed from Buster to Bullseye by the script.

If you have third party packages installed that are currently coming from Buster repositories but have Bullseye versions available, you would need to change those sources if you wish those packages to be upgraded.

Play it safe and create a backup before making any changes.

Spaco
Posts: 1
Joined: Thu Aug 26, 2021 4:26 pm

Re: Upgrading Raspberry Pi OS Buster to Bullseye for Testing Purposes

Thu Aug 26, 2021 4:35 pm

Great script! One observation, the install gcc-8-base actually ends up removing a bunch of packages which I don't think are correctly replaced, e.g. libc-dev. This breaks a lot of things once you're up and running on bullseye, i.e. most build processes. I had to fix it by hand.

Apparently, this is due to transitional libraries missing for the gcc8 to gcc10 upgrade path. This explains it better:
https://salsa.debian.org/rpavlik/gcc-10-compat

Return to “Advanced users”