Migrating from 32bit to 64bit Linux
About
I ran lots of different systems:
- NetBSD (on digital alpha, on 68K Macintosh and PPC Macintosh)
- PowerPC Linux (on PowerMac G3)
- Debian (VM) for the last 15 years or so, hosted with my favourite hoster, Mathias Peter.
How we made it
ℹ️ | This will also apply if you just move to another hardware or VM. |
About the approach
In theory, you can exchange the i386 by with amd64 binaries. We[1] tried that, failed several times, and finally gave up. The approach shown here is (in our opinion) the most viable option.
The basic idea
- Install a new system, matching your distribution release, in this case debian 11.6
- Install the same packages, but in 64bit
- Move
/etc
and/var
to the new system - Stop the old system
- Mount
/home
on your new system - Reboot
In detail
- Make backups and snapshots
- Make sure all packages are installed, f.e. like this
# Do this on the old system dpkg -l |grep '^ii' |awk '{print $2}' |sort > dpkg_list_oldserver.txt
# Do this on the new system dpkg -l |grep '^ii' |awk '{print $2}' |sort > dpkg_list_newserver.txt # Compare installed and install missing packages diff dpkg_list_oldserver.txt dpkg_list_newserver.txt |grep '^<' |awk '{print $2}' diff dpkg_list_oldserver.txt dpkg_list_newserver.txt |grep '^>' |awk '{print $2}'
- Disable
/etc/cron.d/certbot
- Make sure, all mods are installed:
ls -1 /etc/apache2/mods-available
- Copy the needed portions of
/root
to your new machine - Put Nextcloud in maintenance mode:
sudo -u www-data php occ maintenance:mode --on
and wait 5 minutes - Stop services on old system
apachectl -k stop /etc/rc6.d/K02dovecot stop /etc/rc6.d/K01postfix stop
- Set your Mediawiki to $wgReadOnly
- Just in case, dump the databases
mysqldump -u root -p --databases MEDIAWIKI_DB > mediawiki_2023-04-03.sql mysqldump -u root -p --databases NEXTCLOUD_DB > nextcloud_2023-04-04.sql
- First
/etc
, then/var
! - For moving
/etc
do this on your new system:
cd / mv /etc /etc_old ssh root@OLDSYSTEM "cd /; tar cf - etc" |tar xvf - cp -pr /etc_old/fstab /etc/
- For moving
/var
do this on your new system:
cd / mv /var /var_old ssh root@OLDSYSTEM "cd /; tar cf - var" |tar xvf - rm -r /var/cache/apt /var/lib/apt /var/lib/aptitude /var/lib/dpkg cp -pr /var_old/cache/apt /var/cache/ cp -pr /var_old/lib/apt /var/lib/ cp -pr /var_old/lib/aptitude /var/lib/ cp -pr /var_old/lib/dpkg /var/lib/
- Shutdown old system and mount /home on new system
- Reboot new system
- End maintenance mode:
sudo -u www-data php occ maintenance:mode --off
- Check syslog and daemon.log
- Check
/var
permissions - Test all services
- Test aptitude/dpkg:
apt list --installed dpkg -l apt-get update apt-get dist-upgrade
✅ | That's it! |
Footnotes: