The main things you'll want to back up are the contents of /etc, /var/lib/dpkg, /var/lib/apt/extended_states and the output of dpkg --get-selections "*" (the quotes are important). If you use aptitude to manage packages on your system, you will also want to back up /var/lib/aptitude/pkgstates.
https://www.howtoforge.com/tutorial/how-to-upgrade-debian-8-jessie-to-9-stretch/
https://linuxconfig.org/how-to-upgrade-debian-8-jessie-to-debian-9-stretch
launch aptitude in full-terminal mode and press g
Crtl+Alt+F1 - virt console
$ aptitude search '~i(!~ODebian)'
$ apt-forktracer | sort
#3rd party packages
dpkg --audit
#pending/unfinished packages
# aptitude search "~ahold"
--
# dpkg --get-selections | grep 'hold$'
The “hold” package state for apt-get can be changed using:
# echo package_name hold | dpkg --set-selections
Replace hold with install to unset the “hold” state.
--
check for non-debian packages and amend in /etc/apt/sources.list for stretch