Skip to content

Instantly share code, notes, and snippets.

@waja
Last active September 16, 2020 08:04
Show Gist options
  • Save waja/58f499f71c799b752b5b6532f57d2b92 to your computer and use it in GitHub Desktop.
Save waja/58f499f71c799b752b5b6532f57d2b92 to your computer and use it in GitHub Desktop.
# Crossgrade jessie over to amd64 along https://stbuehler.de/blog/article/2017/06/28/debian_stretch__upgrade_32-bit_to_64-bit.html,
# but on jessie downloading the correct packages is a bit more complicated
aptitude search ~M | cut -c5- | cut -d' ' -f1 > aptitude.auto
dpkg -l | grep '^ii' | awk '{print $2}' > packages
dpkg --print-architecture
dpkg --print-foreign-architectures
dpkg --add-architecture amd64
apt-get update
apt-get --no-install-recommends install linux-image-amd64:amd64
reboot
uname -r
apt-get clean
apt-get -y --no-install-recommends --download-only install dash:amd64 bash:amd64
dpkg --install /var/cache/apt/archives/*.deb
dpkg --install /var/cache/apt/archives/dash_*.deb /var/cache/apt/archives/bash_*.deb
apt-get clean
apt-get -y --no-install-recommends --download-only install dpkg:amd64 apt:amd64 aptitude:amd64 apt-utils:amd64
dpkg --install /var/cache/apt/archives/*.deb
dpkg --install /var/cache/apt/archives/dpkg_*.deb
dpkg --print-architecture
dpkg --print-foreign-architectures
cd /var/cache/apt/archives/ && \
apt-get download $(dpkg -l | grep '^.i' | grep -vE " (amd64|all) " | sed s/:i386// | awk '{print $2":amd64"}'|xargs) && \
apt-get download libblas-common:amd64 && \
mv /var/cache/apt/archives/libapache2-mod-*.deb /tmp/ && \
dpkg --install /var/cache/apt/archives/lib*.deb /var/cache/apt/archives/perl*.deb /var/cache/apt/archives/mlock_*.deb && \
mkdir /tmp/archives/ && \
mv /var/cache/apt/archives/lib*.deb /var/cache/apt/archives/perl*.deb /var/cache/apt/archives/mlock_*.deb /tmp/archives/ && \
dpkg --install /var/cache/apt/archives/lib*.deb /var/cache/apt/archives/*python*.deb && \
mv /var/cache/apt/archives/lib*.deb /var/cache/apt/archives/*python*.deb /tmp/archives/ && \
mv /tmp/libapache2-mod-php*.deb /var/cache/apt/archives/ && \
dpkg --install /var/cache/apt/archives/lib*.deb /var/cache/apt/archives/*php*.deb /var/cache/apt/archives/*apache2*.deb /var/cache/apt/archives/sed_4.2.2-4+deb8u1_amd64.deb /var/cache/apt/archives/lsof_4.86+dfsg-1_amd64.deb && \
mv /var/cache/apt/archives/lib*.deb /var/cache/apt/archives/*php*.deb /var/cache/apt/archives/*apache2*.deb /var/cache/apt/archives/sed_4.2.2-4+deb8u1_amd64.deb /var/cache/apt/archives/lsof_4.86+dfsg-1_amd64.deb /tmp/archives/ && \
dpkg --install /var/cache/apt/archives/lib*.deb /var/cache/apt/archives/*openss*.deb && \
mv /var/cache/apt/archives/lib*.deb /var/cache/apt/archives/*openss*.deb /tmp/archives/ && \
dpkg --install /var/cache/apt/archives/lib*.deb /var/cache/apt/archives/*mysql*.deb && \
mv /var/cache/apt/archives/lib*.deb /var/cache/apt/archives/*mysql*.deb /tmp/archives/ && \
dpkg -i /var/cache/apt/archives/*.deb && \
mv /var/cache/apt/archives/*.deb /tmp/archives/ && \
cd
apt-get clean
apt-get --download-only -y --no-install-recommends install `dpkg -l | grep '^.i' | awk '{print $2}' | grep :i386 | sed -e 's/\(.*\):i386/\1:i386- \1:amd64/'`
dpkg --install /var/cache/apt/archives/*.deb
apt-get remove `dpkg -l | grep '^.i' | awk '{print $2}' | grep :i386`
apt-get autoremove
aptitude markauto `cat aptitude.auto | sed -e s/:i386/:amd64/`
diff -u <(sed s/:.*// packages | uniq) <(dpkg -l | grep '^ii' | awk '{print $2}' | sed s/:.*// | uniq) | less
dpkg --remove-architecture i386
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment