I was looking for a way to install Xen 4.8 in Jessie because in some of the newest Processors Intel series called Skylake the default version of Xen Hypervisor on Jessie (4.4) results in endless booting loops.
NOTE: If you already had the Xen 4.4(original installed) no worries the version 4.4 will not be uninstalled but the new version 4.8 will be the only one active.

This short howto is based on this link which is also been recommended by Hetzner provider in Germany.

You have to pin stretch and stretch-updates to 499, jessie and jessie-updates to 500, then install xen-hypervisor-4.8-amd64 manually from stretch:

cat <<EOF | sudo tee /etc/apt/preferences.d/stretch-manual-only
Package: *
Pin: release n=jessie-updates
Pin-Priority: 500
Package: *
Pin: release n=jessie
Pin-Priority: 500
Package: *
Pin: release n=stretch-updates
Pin-Priority: 499
Package: *
Pin: release n=stretch
Pin-Priority: 499

Create a sources list for stretch:
sed -e 's/ \(stable\|jessie\)/ stretch/ig' /etc/apt/sources.list > /etc/apt/sources.list.d/debian-stretch.list
aptitude update

Those are the needed packages for Xen 4.8:
aptitude install xen-utils-common/stretch xen-utils-4.8/stretch xen-tools xen-hypervisor-4.8-amd64/stretch libncurses5/stretch libncursesw5/stretch libtinfo5/stretch

Possible output of command, but can also be different.
The following packages will be upgraded:
libxen-4.8 xen-hypervisor-4.8-amd64 xen-utils-4.8 xen-utils-common
Do you want to continue? [Y/n/?]

You also answer ‘Y‘ to this one.
Make sure all the packages are now up-to-date:
aptitude -y dist-upgrade
Continue with changing the boot order in grub:
dpkg-divert --divert /etc/grub.d/08_linux_xen --rename /etc/grub.d/20_linux_xen

Check grub menu entries in order with:
grep -i "menuentry '" /boot/grub/grub.cfg|sed -r "s|--class .*$||g"|nl -v 0
Now the first line should be
0 menuentry 'Debian GNU/Linux, with Xen hypervisor'
Reboot and have fun 😉

%d bloggers like this: