Crossgrading a complex Desktop and Debian Developer machine running Debian 9, for real.

After sometime without looking into this problem, I decided to do another try. I do not found a way to do a complex crossgrade of my desktop without massively removing packages. And there are bug and bug that require to edit the config scripts of the packages.

So here is my another try to do a crossgrade of my desktop, this time for real.

apt-get update
apt-get upgrade
apt-get autoremove
apt-get clean
dpkg --list > original.dpkg
apt-get --download-only install dpkg:amd64 tar:amd64 apt:amd64 bash:amd64 dash:amd64 init:amd64 mawk:amd64
for pack32 in $(grep i386 original.dpkg | egrep "^ii " | awk '{print $2}' ) ; do 
  echo $pack32 ; 
  apt-get --download-only install -y --allow-remove-essential ${pack32%:i386}:amd64 ; 
done
cd /var/cache/apt/archives/
dpkg --install libacl1_*amd64.deb libattr1_*_amd64.deb libapt-pkg5.0_*amd64.deb libbz2-1.0_*amd64.deb dpkg_*amd64.deb tar_*amd64.deb apt_*amd64.deb bash_*amd64.deb dash_*amd64.deb 
dpkg --install --skip-same-version *.deb
dpkg --configure --pending
dpkg --install --skip-same-version *.deb
dpkg --remove libcurl4-openssl-dev:i386
dpkg --configure --pending
dpkg --remove libkdesu5 kde-runtime
apt-get --fix-broken install
apt-get install  $(egrep "^ii"  ~/original.dpkg | grep -v ":i386" | grep -v "all" | grep -v "aiccu" | grep -v "acroread" | grep -v "flashplayer-mozilla" | grep -v "flash-player-properties" | awk '{print $2}')

Reboot.

Then the system failed to boot, missing lvm2 package.

Boot with a live CD.

sudo -i
mount /dev/sdc2         /mnt
mount /dev/vg100/usr /mnt/usr
mount /dev/vg100/var /mnt/var
mount -o bind /proc    /mnt/proc
mount -o bind /sys     /mnt/sys
mount -o bind /dev/    /mnt/dev
mount -o bind /dev/pts  /mnt/dev/pts
chroot /mnt /bin/su -
apt-get install lvm2
exit
reboot

Still somethings do not work, like command fakeroot.

for pack32 in $(grep i386 original.dpkg  | egrep "^ii " | awk '{print $2}' ) ; do     
  echo $pack32 ;     
  if dpkg --status $pack32 | grep -q "Multi-Arch: same" ; then       
    apt-get -y install ${pack32%:i386}:amd64 ;     
  fi ;   
done

for pack32 in $(grep i386 original.dpkg  | egrep "^ii " | awk '{print $2}' ) ; do     
  echo $pack32 ;     
  apt-get -y install ${pack32%:i386}:amd64 ;     
done

Now is time to find what still does not work and how to solve it.

Comments

1. On Monday, 26 February, 2018, 12:46 by LD

Hello!

Due to the article:

https://wiki.debian.org/CrossGradin...

and also very helpful blog:

https://stbuehler.de/blog/article/2...

I was able to crossgrade Debian Stretch production system with apache,
samba, exim, fetchmail, dovecot, hylafax, pure-ftpd.

Full procedure is in tree steps:

-- install apt:64 and dpkg:64 with apt-get
-- download all *.deb files, install lib.*deb with dpkg
-- install all *.deb with dpkg

This is good, because we don't see apt screaming about errors until
instalation is complete.

I have tried this procedure on three servers and always worked.

########################################
# 64 bit kernel running, current arch is i386, foreign amd64
root@test:~# dpkg --print-architecture
i386
root@test:~# dpkg --print-foreign-architectures
amd64
root@test:~# uname -a
Linux test 4.9.0-6-amd64 #1 SMP Debian 4.9.82-1+deb9u2 (2018-02-21) x86_64 GNU/Linux

########################################
# sources.list -- minimalistic, only debian repositories, only three default lines
root@test:~# cat /etc/apt/sources.list
deb http://httpredir.debian.org/debian stretch main
deb http://httpredir.debian.org/debian stretch-updates main
deb http://security.debian.org stretch/updates main

########################################
# tell apt no to install suggested or recommended packages
root@test:~# cat /etc/apt/apt.conf
APT::Install-Recommends "false";
APT::Install-Suggests "false";

########################################
# make sure everything is in clean state
root@test:~# apt-get update; apt-get dist-upgrade
... # should do nothing

root@test:~# dpkg -l | egrep -v '^ii'
... # should print no packages

########################################
# make sure all packages are installable

root@test:~# apt-get clean; apt-get update
....

# only files from minimalistic sources.list
root@test:~# ls /var/lib/apt/lists/*_Packages
/var/lib/apt/lists/httpredir.debian.org_debian_dists_stretch_main_binary-amd64_Packages
/var/lib/apt/lists/httpredir.debian.org_debian_dists_stretch_main_binary-i386_Packages
/var/lib/apt/lists/httpredir.debian.org_debian_dists_stretch-updates_main_binary-amd64_Packages
/var/lib/apt/lists/httpredir.debian.org_debian_dists_stretch-updates_main_binary-i386_Packages
/var/lib/apt/lists/security.debian.org_dists_stretch_updates_main_binary-amd64_Packages
/var/lib/apt/lists/security.debian.org_dists_stretch_updates_main_binary-i386_Packages

root@test:~# egrep '^Package' /var/lib/apt/lists/*_Packages -h | awk '{ print $2 }' | sort | sed 's/:(i386|amd64)$//' | uniq > /tmp/available_packages

# should print nothing
root@test:~# dpkg -l | grep '^.i' | awk '{ print $2 }' | sed -r 's/:(i386|amd64)$//' | while read F; do grep -Fxq "$F" /tmp/available_packages || echo $F; done

###################################
# save data for later reference
root@test:~# dpkg --get-selections > getsel.txt
root@test:~# apt-mark showauto > auto.txt
root@test:~# apt-mark showmanual > manual.txt

root@test:~# apt-get clean; ls /var/cache/apt/archives/*.deb
ls: nie ma dostępu do '/var/cache/apt/archives/*.deb': Nie ma takiego pliku ani katalogu

*** migawka -- od nowa

##############################################
# install dpkg and apt as in tutorials
root@test:~# apt-get --download-only install dpkg:amd64 apt:amd64
root@test:~# ls /var/cache/apt/archives/
apt_1.4.8_amd64.deb libapt-pkg5.0_1.4.8_amd64.deb libstdc++6_6.3.0-18+deb9u1_amd64.deb partial
dpkg_1.18.24_amd64.deb libbz2-1.0_1.0.6-8.1_amd64.deb lock
root@test:~# dpkg -i /var/cache/apt/archives/*.deb
# shows errors... run once again
root@test:~# dpkg -i /var/cache/apt/archives/*.deb
# no errors this time...
root@test:~# dpkg --print-architecture
amd64
root@test:~# dpkg --print-foreign-architectures
i386
root@test:~# dpkg -l | egrep amd64 | wc -l
26
root@test:~# dpkg -l | egrep i386 | wc -l
395

######################################################################
# download all packages needed for installation; these are all packages
# marked as "i386" but in "amd64" version; this just download to the current
# directory;

root@test:~# mkdir working-dir; cd working-dir;

root@test:~# apt-get download $(dpkg -l | awk '{print $2}' | egrep ':i386$' | egrep -v '^linux-image-' | sed 's/i386$/amd64/g')
...

root@test:~# ls *.deb | wc -l
393

#######################################################
# install libraries, only libraries first; libraries amd64
# use dpkg, not apt; you can run that command a few times

root@test:~# dpkg -i lib*.deb
... # shows many lines... 15 packages failed
liblocale-gettext-perl_1.07-3+b1_amd64.deb
libautovivification-perl
libbit-vector-perl
libclone-perl
libdbd-sybase-perl
libdbi-perl
libhtml-parser-perl
liblist-moreutils-perl
libnet-ssleay-perl
libparams-util-perl
libsmbclient:amd64
libtext-charwidth-perl
libtext-iconv-perl
libxml-libxml-perl

root@test:~# dpkg --configure -a
root@test:~# dpkg --configure -a

##########################################################
# almost all libraries are in place, so install all *.deb files

root@test:~# dpkg -i *.deb

# run this a few times
root@test:~# dpkg --configure -a
root@test:~# dpkg --configure -a
root@test:~# dpkg --configure -a

########################################################
# now try to run "apt-get install" as in tutorials; when errors are about
# python, then install all debs with python; if errors are about samba install
# all debs with samba; when errors are about i386 libraries remove them;
# to remove or add use "dpkg -i"; try also "dpkg --configure -a"

root@test:~# dpkg -i python*.deb
root@test:~# dpkg -i samba-libs_2%3a4.5.12+dfsg-2+deb9u1_amd64.deb

root@test:~# apt-get install
... # errors
root@test:~# dpkg -i bash_4.4-5_amd64.deb dash_0.5.8-2.4_amd64.deb liblocale-gettext-perl_1.07-3+b1_amd64.deb

root@test:~# apt-get install
... # errors

root@test:~# dpkg -r libisccc-export140:i386 liblognorm5:i386 samba-libs:i386 libsmbclient:i386
... # no erorrs

################################################
# check if everything is in place, reboot

root@test:~# apt-get install
... # no erorrs, shows many packages for autoremoval

root@test:~# dpkg -l | egrep 'i386' | wc -l
213
root@test:~# dpkg -l | egrep 'amd64' | wc -l
399

# make sure that every package :i386 has installed :amd64 version
root@test:~# dpkg -l | awk '{ print $2 }' | egrep i386 | sed 's/:i386//' | while read F; do dpkg -l | egrep "$F.*amd64" -q || echo "$F"; done
libstdc++6
linux-image-4.9.0-6-686-pae
linux-image-686-pae
... # this is okey, kernel is old, and "++" is wrong regex for grep

# remove i386 packages
root@test:~# apt-get purge $(dpkg -l | egrep :i386 | awk '{ print $2; }' | egrep ':i386$' )

# check if errors
root@test:~# apt-get clean; apt-get update; apt-get dist-upgrade

# remove architecutre
root@test:~# dpkg --remove-architecture i386
root@test:~# dpkg --print-architecture
amd64
root@test:~# dpkg --print-foreign-architectures
root@test:~# apt-get clean; apt-get update; apt-get dist-upgrade
... # no errors at all!
t@test:~# dpkg -l | egrep -v '^ii'
... # completely clean!

# update lilo or grub; reboot

Add a comment

HTML code is displayed as text and web addresses are automatically converted.

They posted on the same topic

Trackback URL : http://blog.calhariz.com/index.php/trackback/60

This post's comments feed