# Ubuntu – Apt-get upgraded package from 32bit to unsupported 64bit – why and how to revert

Recently the repository of qtox had to change its domain and the new one only contains only 64bit builds at the moment. However, I'm on 15.04 32bit and can't run any 64bit software.

Now when I last ran apt-get upgrade or apt-get dist-upgrade (can't remember which one exactly), it also upgraded the package qtox to the latest version in the repository. But this was a 64 bit version! Now I can't launch qtox any more:

$qtox bash: /usr/bin/qtox: cannot execute binary file: Exec format error$ file $(which qtox) /usr/bin/qtox: ELF 64-bit LSB executable, x86-64, version 1 (GNU/Linux), statically linked, stripped$ uname -a
Linux UbuntuDesktop 3.19.0-26-generic #27-Ubuntu SMP Tue Jul 28 18:26:33 UTC 2015 i686 i686 i686 GNU/Linux


Now I have to make sure that apt-get will not install/upgrade to any 64bit packages any more! No idea if this is a bug in apt-get, a badly configured package or repository or anything else, I need to find out the cause and prevent this from happening again!

So my question in a nutshell:

Why did apt-get install a 64bit package on a 32bit-only system and how do I avoid this in the future?

### Update:

I checked the info I could get about the qtox package from apt-cache and dpkg -I of the directly downloaded .deb package and found the following. It seems to me like if the had configured their repository incorrectly, because those outputs look like of a 32bit package. And it still contains the old domain. Did they probably forget to update their info and cheated on apt-get?

$apt-cache show qtox Package: qtox Priority: extra Section: default Installed-Size: 2168 Maintainer: Tox Foundation <support@tox.im> Architecture: i386 Version: 1.1~git20150707.cfeeb03-97 Replaces: qtox-unity Depends: libopenal1, libqt5core5a, libqt5gui5, libqt5network5, libqt5widgets5, libqt5xml5, libqt5opengl5, libqt5sql5, libqt5sql5-sqlite, apt-transport-https, libqt5svg5, libappindicator1, libqrencode3, libavformat-ffmpeg56|libavformat-tox56, libavdevice-ffmpeg56|libavdevice-tox56, libavcodec-ffmpeg56|libavcodec-tox56, libavutil-ffmpeg54|libavutil-tox54, libswscale-ffmpeg3|libswscale-tox3 Filename: pool/main/q/qtox/qtox_1.1~git20150707.cfeeb03-97_i386.deb Size: 2217972 MD5sum: bc59427d056da669e52955169266911b SHA1: c6797a04d13d929a068c213913f359719b377735 SHA256: 3405027807573b98a61c33f3aad911f40cf0b0737a95001e951a82937ee5afdd Description: no description given Description-md5: c0af8b65ef8df63b3bfb124d96da1778 Homepage: https://tox.im Vendor: Tox Foundation License: GPLv3+$ apt-cache policy qtox
qtox:
Installed: 1.1~git20150707.cfeeb03-97
Candidate: 1.1~git20150707.cfeeb03-97
Version table:
*** 1.1~git20150707.cfeeb03-97 0
500 https://pkg.tox.chat/ nightly/main i386 Packages
100 /var/lib/dpkg/status

$dpkg -I qtox_1.1~git20150707.cfeeb03-97_i386.deb new debian package, version 2.0. size 2217972 bytes: control archive=2341 bytes. 677 bytes, 13 lines control 1298 bytes, 17 lines md5sums 2716 bytes, 93 lines * postinst #!/bin/sh Package: qtox Version: 1.1~git20150707.cfeeb03-97 License: GPLv3+ Vendor: Tox Foundation Architecture: i386 Maintainer: Tox Foundation <support@tox.im> Installed-Size: 2168 Depends: libopenal1, libqt5core5a, libqt5gui5, libqt5network5, libqt5widgets5, libqt5xml5, libqt5opengl5, libqt5sql5, libqt5sql5-sqlite, apt-transport-https, libqt5svg5, libappindicator1, libqrencode3, libavformat-ffmpeg56|libavformat-tox56, libavdevice-ffmpeg56|libavdevice-tox56, libavcodec-ffmpeg56|libavcodec-tox56, libavutil-ffmpeg54|libavutil-tox54, libswscale-ffmpeg3|libswscale-tox3 Replaces: qtox-unity Section: default Priority: extra Homepage: https://tox.im Description: no description given  #### Best Answer Obviously the package's name and meta information both tell apt-get that it is a 32bit package, but this was set up falsely by the maintainers. Until they have fixed this and updated their repository with a real 32bit package, I use the following script to verify the package's true architecture: #! /bin/bash dir=$(mktemp -d)
debfile="*_i386.deb"
cd "$dir" echo "Downloading package..." wget https://pkg.tox.chat/pool/main/q/qtox/ -r -l 1 -nd -A "$debfile" -q

dpkg -x $debfile "$dir"
printf "\n%s\n\n" $debfile dpkg --info$debfile | \
awk '/Architecture/ {printf "defined dpkg architecture is:\t%s\n", $2}' find "$dir" -type f -exec file -b {} \; | \
sort -u | \
awk '/ELF/ {printf "real executable format is: \t\t%s\n", $0}' rm -rf "$dir"
exit 0


(Parts of the script are taken from A.B.'s answer here.)

I saved it as ~/bin/qtoxtest.sh and made it executable with chmod +x ~/bin/qtoxtest.sh.

The script currently gives the following example output, which tells us that the package is still not correctly declared:

\$  qtoxtest.sh