User Tools

Site Tools


64bit-migration

This is an old revision of the document!


32 to 64 migration notes:

https://www.hattne.se/articles/migration.html have that web site open… the steps are here, but the explanation is there

my notes:

  • make sure system is completely up to date and has been depcleaned, preserved-rebuilt and revdep-rebuild - to clean up old 32bit libraries else lots of work later
  • make sure you have an *identically* up to date 64bit machine (vm?) to copy libraries from
Steps
mkdir /migration-backup
cp /etc/portage/make.conf /migration-backup/
  • building cross compiler
emerge crossdev -av

convert /etc/portage/package.* into directories

crossdev -S -s3 --target x86_64-pc-linux-gnu
  • compile x86_64 kernel with ia32 emulation, reboot into it
  • get an identical VM with compat arch processor built in x86_64 multilib profile (make sure CFLAGS is *identical* emerge -e world if not - also make sure USE flags are the same, makes live easier when doing emerge -k binarypackage on the other side)
  • Change CHOST to x86_64-pc-linux-gnu
  • copy lib and /usr/lib and /bin and /usr/bin and /sbin and /usr/sbin to /migration-backup
  • make /etc/env.d/99migration with LDPATH=/migration-backup/lib:/lib32:/lib64:/migration-backup/usr/lib:/usr/lib32:/usr/lib64
env-update
source /etc/profile
ldconfig
mkdir /lib32
mkdir /lib64
mkdir /usr/lib32
mkdir /usr/lib64
  • If applicable, dont use distcc till its remerged:
rm -Rf /usr/lib/distcc    
  • possibly dont need to do this if using binary packages from donor VM
cp -ar /usr/x86_64-pc-linux-gnu/lib64/* /lib64
cp -ar /usr/x86_64-pc-linux-gnu/usr/lib64/* /usr/lib64/

cp -ar /usr/include /migration-backup/include32
cp -ar /usr/x86_64-pc-linux-gnu/usr/include/* /usr/include/
emerge -1 sys-kernel/linux-headers
  • put -sandbox -usersandbox in features
  • add */* abi_x86_32 to package.use
  • most 32bit doesnt get built on stable unless u do this:
# cat /etc/portage/profile/use.mask
-abi_x86_32
  • change make.profile symlink to point to a multilib amd64 profile
  • use quickpkg on source VM to grab and then PATH=“/migration-backup/bin:/migration-backup/usr/bin:/migration-backup/sbin:/migration-backup/usr/sbin:${PATH}” emerge -1kav to deploy initial binary packages donated from prebuilt VM from /usr/portage/packages:

Of these, glibc needs to come first, then everything else will come good. in the process of deploying glibc, /lib needs to be a symlink to /lib64 which will break 32bit programs. ldconfig is your friend here with the above 99migration env file. Theres a couple other gotchas as well that need working through.

  • on donor pc or VM:
quickpkg glibc gcc zlib ncurses gmp mpfr util-linux acl attr sandbox coreutils procps binutils libcap mpc cracklib flex =db-5* glib pam pambase =python-3.6* bash readline findutils install-xattr bzip2 tar xz-utils make grep patch gawk sed libpcre
  • on target pc, mount or rsync /usr/portage/packages and emerge -1k to install them. If theres any differences in USE, set them in the prefix
USE="fix any differences" emerge -1kav <pasted list>
mv /usr/lib to /usr/oldlib and symlink lib to lib64
  • /usr/lib symlink creation will break python. The following will not create orphans as the files are in exactly the same location from portage's point of view.
cd /usr/oldlib
mv python-exec python3.6 libpython* portage gcc ../lib64
  • remove crossdev packages (and crossdev) and check gcc sanity
emerge --unmerge cross-x86_64-pc-linux-gnu/* crossdev -av
ldconfig
  • fix 32bit toolchain and python in wrong directory by running:
emerge -1kav sys-devel/gcc glibc mpfr mpc binutils 
binutils-config 1
. /etc/profile

emerge -1av python-exec 
emerge -1kav =python-3.6* --binpkg-changed-deps=n

mv /lib/modules /lib64
mv /lib/gentoo /lib64
  • for the lib / lib64 link ↔ switcheroo
  • * make sure busybox is functional. run this from busybox
  • * have a few shells open, in case you break the one you're working from
mv /lib/modules /lib64
mv /lib/gentoo /lib64

cd /
mv lib oldlib
ln -s lib64 lib
  • Emerging gcc needs to be done now, but also acts as a sanity check to see what we've missed. Repeat the quickpkg / emerge -1k steps for missing things
emerge gcc -1av
  • remove /etc/env.d/99migration, env-update, ldconfig, sanity check.
  • copy over a valid /etc/nsswitch.conf
  • @system rebuild - adjust USE as needed
FEATURES="-sandbox -usersandbox" USE="-X -gtk -qt5 -introspection -cairo -gpm -consolekit -policykit -net -ipv6 -spell -sqlite -nls -berkdb -gdbm -openssl" emerge -1eav @system
  • remove -sandbox and -usersandbox from features
  • check for i686 compiler orphans with: qfile -o /usr/bin/i686-pc-linux-gnu-*

emerge -eav –keep-going @world

Things to do later
  • uncomment LINGUAS from make.conf
  • take out /etc/env.d/99migration
  • remove /migration-backup
  • erase /usr/portage/packages (whole dir)
  • clean up /lib.old and /usr/lib.old
  • check for orphans in /usr/lib and all the other places. (bin sbin /usr/bin /usr/sbin). For finding orphan files after migration in /lib32, /usr/lib32, /usr/lib64
cd /lib32 ; find  -xdev -type f -exec qfile -o {} + |less
64bit-migration.1547541536.txt.gz · Last modified: 2019/01/15 16:38 by snarg