Upgrade existing Debian Jessie to Buster without re-image
How to do in-place upgrade without data loss
I have a old Raspberry Pi 3 running for many years, it still running on jessie and everything goes well, except I want to install some software which does not exist on jessie.
Since jessie, there are two major releases stretch and buster. It is time to upgrade to my Raspberry Pi OS to keep it up to date.
The official recommendation for major release is re-image.
As this is a major version upgrade, we recommend using a clean image.
However I do not want to re-image SD card since I have exist service running and it take me a lot of time tweak exist system configuration. I do not want to re-configure everything…
Since Raspberry Pi OS is based on Debian, Debian support in-place major release upgrade. This is also mentioned in Raspberry Pi blog raspbian-stretch
Upgrading an existing Jessie image is possible, but is not guaranteed to work in every circumstance. If you wish to try upgrading a Jessie image to Stretch, we strongly recommend taking a backup first – we can accept no responsibility for loss of data from a failed update.
I will take the risk to try this in-place upgrade.
Since there are two major releases, I need upgrade to stretch
, then upgrade to buster
.
jessie to stretch in place upgrade without data loss
Replace jessie
with stretch
in /etc/apt/sources.list
and /etc/apt/sources.list.d/raspi.list
:
$ sudo sed -i 's/jessie/stretch/g' /etc/apt/sources.list
$ sudo sed -i 's/jessie/stretch/g' /etc/apt/sources.list.d/raspi.list
$ sudo apt-get update
$ sudo apt-get -y dist-upgrade
Answer yes
or no
to prompts based your settings.
Note
You do not need follow raspbian blog raspbian-stretch answer yes
to anything.
It will replace your changed config to original config file. You will lost your changes!
e.g. You may make changes in /etc/sysctl.conf
, upgrade process will detect this change and will ask you replace it or keep it:
Configuration file '/etc/sysctl.conf'
==> Modified (by you or by a script) since installation.
==> Package distributor has shipped an updated version.
What would you like to do about it ? Your options are:
Y or I : install the package maintainer's version
N or O : keep your currently-installed version
D : show the differences between the versions
Z : start a shell to examine the situation
The default action is to keep your current version.
After dist-upgrade
, you may optional install font to fix missing Chinese and Japanese fonts:
$ sudo apt-get install -y fonts-droid-fallback
If you are not using PulseAudio for anything other than Bluetooth audio, remove it from the image by entering
$ sudo apt-get -y purge "pulseaudio*"
The last step is clean apt, remove un-used packages and reboot:
$ sudo apt-get autoremove
$ sudo reboot
stretch to buster in place upgrade without data loss
Similar with jessie
to buster
, I need replace apt source:
$ sudo sed -i 's/stretch/buster/g' /etc/apt/sources.list
$ sudo sed -i 's/stretch/buster/g' /etc/apt/sources.list.d/raspi.list
Then update:
$ sudo apt-get update
$ sudo apt-get -y dist-upgrade
However I got following error this time:
Errors were encountered while processing:
/tmp/apt-dpkg-install-pxzIiX/152-firmware-misc-nonfree_1%3a20190114-1+rpt4_all.deb
E: Sub-process /usr/bin/dpkg returned an error code (1)
I re-run sudo apt-get -y dist-upgrade
and got following errors:
$ sudo apt-get -y dist-upgrade
Reading package lists... Done
Building dependency tree
Reading state information... Done
You might want to run 'apt --fix-broken install' to correct these.
The following packages have unmet dependencies:
firmware-ralink : Depends: firmware-misc-nonfree but it is not installed
N: Ignoring file '50unattended-upgrades.ucftmp' in directory '/etc/apt/apt.conf.d/' as it has an invalid filename extension
E: Unmet dependencies. Try 'apt --fix-broken install' with no packages (or specify a solution).
Follow the instruction, I hope apt --fix-broken install
can fix problem:
$ sudo apt --fix-broken install
Reading package lists... Done
Building dependency tree
Reading state information... Done
Correcting dependencies... Done
The following packages were automatically installed and are no longer required:
firmware-misc-nonfree firmware-ralink g++-6 gnupg-agent libaio1 libbabeltrace-ctf1 libbind9-140 libboost-filesystem1.62.0 libboost-iostreams1.62.0 libboost-system1.62.0
libcdio13 libcomerr2 libdns-export162 libdns162 libdrm-freedreno1 libevent-2.0-5 libfile-copy-recursive-perl libglew2.0 libhiredis0.13 libicu57 libisc-export160 libisc160
libisccc140 libisccfg140 libiso9660-8 libjim0.76 liblwres141 libmpfr4 libperl5.24 libprocps6 libpython3.5 libpython3.5-dev libpython3.5-minimal libpython3.5-stdlib libssl1.0.2
libstdc++-6-dev libtxc-dxtn-s2tc0 libunistring0 libva-x11-1 libwebpmux2 lynx-cur python-apt python3-pyasn1 python3.5 python3.5-dev python3.5-minimal python3.5-venv rename
rsync sgml-base xml-core
Use 'sudo apt autoremove' to remove them.
The following additional packages will be installed:
firmware-misc-nonfree
The following NEW packages will be installed:
firmware-misc-nonfree
0 upgraded, 1 newly installed, 0 to remove and 0 not upgraded.
Looks good, then I re-run sudo apt-get -y dist-upgrade
again,
everything goes well this time.
After dist-upgrade
success, clean apt and reboot:
$ sudo apt-get autoremove
$ sudo reboot
After reboot, check the release info, you got buster
:
$ lsb_release -a
No LSB modules are available.
Distributor ID: Raspbian
Description: Raspbian GNU/Linux 10 (buster)
Release: 10
Codename: buster
References
- jessie to stretch dist-upgrade command output (package changes)
- stretch to buster dist-upgrade command output (package changes)
- raspbian-stretch release announce
- Buster – the new version of Raspbian
Feedback
Was this page helpful?
Glad to hear it!
Sorry to hear that.