How to install i386/amd64 packages on ARM or any other arch from Ubuntu Ports

7,361

I later found out by trial & error that you need to make the default entries in /etc/apt/sources.list more specific:

dpkg --add-architecture 'i386'

# replace 'deb' with 'deb [arch=armhf]'
sed 's/^deb http/deb [arch=armhf] http/' -i '/etc/apt/sources.list'

Add a file like /etc/apt/sources.list.d/i386.list with the x86 mirror servers:

deb [arch=i386] http://security.ubuntu.com/ubuntu/ focal-security  main restricted universe multiverse
deb [arch=i386]  http://archive.ubuntu.com/ubuntu/ focal           main restricted universe multiverse
deb [arch=i386]  http://archive.ubuntu.com/ubuntu/ focal-updates   main restricted universe multiverse
deb [arch=i386]  http://archive.ubuntu.com/ubuntu/ focal-backports main restricted universe multiverse
apt-get update

I could successfully install and run the UFRII driver with:

apt-get install qemu-user

# undeclared dependencies of UFRII driver package
apt-get install  libcupsimage2:i386 libjpeg62:i386 libstdc++6:i386 libxml2:i386 ghostscript:i386

apt-get install /path/to/ufrii_driver.deb 
Share:
7,361

Related videos on Youtube

Daniel Böhmer
Author by

Daniel Böhmer

Updated on September 18, 2022

Comments

  • Daniel Böhmer
    Daniel Böhmer over 1 year

    I need to run some x86 binary with QEMU on a Raspberry Pi (armhf port, ARMv7) to make a printer work with Canon’s crappy binary UFRII drivers. How to just install its x86 dependencies on armhf (not how to run them)?

    I can install the x86 binary with:

    root@raspberry-pi:~# dpkg --force-architecture -i /tmp/cnrdrvcups-ufr2-uk_5.10-1_i386.deb
    

    but then apt keeps complaining that its dependencies are missing. I’ll probably actually need them to run the UFRII converter—so I’d really like to install the i386 dependencies via apt.

    I can add the i386 architecture but apt-get update fails to download some resources, probably because armhf resides on ports.ubuntu.com while x86 packages are on the main mirrors. (I’ve once successfully installed i386 packages on amd64 before.)

    root@raspberry-pi:~# dpkg --add-architecture i386       
    root@raspberry-pi:~# apt-get update                  
    Hit:1 http://ports.ubuntu.com/ubuntu-ports bionic InRelease
    Get:2 http://ports.ubuntu.com/ubuntu-ports bionic-updates InRelease [88.7 kB]
    Get:3 http://ports.ubuntu.com/ubuntu-ports bionic-backports InRelease [74.6 kB]
    Get:4 http://ports.ubuntu.com/ubuntu-ports bionic-security InRelease [88.7 kB]
    Ign:5 http://ports.ubuntu.com/ubuntu-ports bionic/main i386 Packages
    Ign:6 http://ports.ubuntu.com/ubuntu-ports bionic/restricted i386 Packages
    Ign:7 http://ports.ubuntu.com/ubuntu-ports bionic/universe i386 Packages
    Ign:8 http://ports.ubuntu.com/ubuntu-ports bionic/multiverse i386 Packages
    Ign:5 http://ports.ubuntu.com/ubuntu-ports bionic/main i386 Packages
    Ign:6 http://ports.ubuntu.com/ubuntu-ports bionic/restricted i386 Packages
    Ign:7 http://ports.ubuntu.com/ubuntu-ports bionic/universe i386 Packages
    Ign:8 http://ports.ubuntu.com/ubuntu-ports bionic/multiverse i386 Packages
    Ign:5 http://ports.ubuntu.com/ubuntu-ports bionic/main i386 Packages
    Ign:6 http://ports.ubuntu.com/ubuntu-ports bionic/restricted i386 Packages
    Ign:7 http://ports.ubuntu.com/ubuntu-ports bionic/universe i386 Packages
    Ign:8 http://ports.ubuntu.com/ubuntu-ports bionic/multiverse i386 Packages
    Err:5 http://ports.ubuntu.com/ubuntu-ports bionic/main i386 Packages
      404  Not Found [IP: 91.189.88.150 80]
    Ign:6 http://ports.ubuntu.com/ubuntu-ports bionic/restricted i386 Packages
    Ign:7 http://ports.ubuntu.com/ubuntu-ports bionic/universe i386 Packages
    Ign:8 http://ports.ubuntu.com/ubuntu-ports bionic/multiverse i386 Packages
    Ign:9 http://ports.ubuntu.com/ubuntu-ports bionic-updates/main i386 Packages
    Ign:10 http://ports.ubuntu.com/ubuntu-ports bionic-updates/restricted i386 Packages
    Ign:11 http://ports.ubuntu.com/ubuntu-ports bionic-updates/universe i386 Packages
    Ign:12 http://ports.ubuntu.com/ubuntu-ports bionic-updates/multiverse i386 Packages
    Ign:9 http://ports.ubuntu.com/ubuntu-ports bionic-updates/main i386 Packages
    Ign:10 http://ports.ubuntu.com/ubuntu-ports bionic-updates/restricted i386 Packages
    Ign:11 http://ports.ubuntu.com/ubuntu-ports bionic-updates/universe i386 Packages
    Ign:12 http://ports.ubuntu.com/ubuntu-ports bionic-updates/multiverse i386 Packages
    Ign:9 http://ports.ubuntu.com/ubuntu-ports bionic-updates/main i386 Packages
    Ign:10 http://ports.ubuntu.com/ubuntu-ports bionic-updates/restricted i386 Packages
    Ign:11 http://ports.ubuntu.com/ubuntu-ports bionic-updates/universe i386 Packages
    Ign:12 http://ports.ubuntu.com/ubuntu-ports bionic-updates/multiverse i386 Packages
    Err:9 http://ports.ubuntu.com/ubuntu-ports bionic-updates/main i386 Packages
      404  Not Found [IP: 91.189.88.150 80]
    Ign:10 http://ports.ubuntu.com/ubuntu-ports bionic-updates/restricted i386 Packages
    Ign:11 http://ports.ubuntu.com/ubuntu-ports bionic-updates/universe i386 Packages
    Ign:12 http://ports.ubuntu.com/ubuntu-ports bionic-updates/multiverse i386 Packages
    Ign:13 http://ports.ubuntu.com/ubuntu-ports bionic-backports/main i386 Packages
    Ign:14 http://ports.ubuntu.com/ubuntu-ports bionic-backports/universe i386 Packages
    Ign:13 http://ports.ubuntu.com/ubuntu-ports bionic-backports/main i386 Packages
    Ign:14 http://ports.ubuntu.com/ubuntu-ports bionic-backports/universe i386 Packages
    Ign:13 http://ports.ubuntu.com/ubuntu-ports bionic-backports/main i386 Packages
    Ign:14 http://ports.ubuntu.com/ubuntu-ports bionic-backports/universe i386 Packages
    Err:13 http://ports.ubuntu.com/ubuntu-ports bionic-backports/main i386 Packages
      404  Not Found [IP: 91.189.88.150 80]
    Ign:14 http://ports.ubuntu.com/ubuntu-ports bionic-backports/universe i386 Packages
    Ign:15 http://ports.ubuntu.com/ubuntu-ports bionic-security/main i386 Packages
    Ign:16 http://ports.ubuntu.com/ubuntu-ports bionic-security/restricted i386 Packages
    Ign:17 http://ports.ubuntu.com/ubuntu-ports bionic-security/universe i386 Packages
    Ign:18 http://ports.ubuntu.com/ubuntu-ports bionic-security/multiverse i386 Packages
    Ign:15 http://ports.ubuntu.com/ubuntu-ports bionic-security/main i386 Packages
    Ign:16 http://ports.ubuntu.com/ubuntu-ports bionic-security/restricted i386 Packages
    Ign:17 http://ports.ubuntu.com/ubuntu-ports bionic-security/universe i386 Packages
    Ign:18 http://ports.ubuntu.com/ubuntu-ports bionic-security/multiverse i386 Packages
    Ign:15 http://ports.ubuntu.com/ubuntu-ports bionic-security/main i386 Packages
    Ign:16 http://ports.ubuntu.com/ubuntu-ports bionic-security/restricted i386 Packages
    Ign:17 http://ports.ubuntu.com/ubuntu-ports bionic-security/universe i386 Packages
    Ign:18 http://ports.ubuntu.com/ubuntu-ports bionic-security/multiverse i386 Packages
    Err:15 http://ports.ubuntu.com/ubuntu-ports bionic-security/main i386 Packages
      404  Not Found [IP: 91.189.88.150 80]
    Ign:16 http://ports.ubuntu.com/ubuntu-ports bionic-security/restricted i386 Packages
    Ign:17 http://ports.ubuntu.com/ubuntu-ports bionic-security/universe i386 Packages
    Ign:18 http://ports.ubuntu.com/ubuntu-ports bionic-security/multiverse i386 Packages
    Fetched 252 kB in 2s (112 kB/s)
    Reading package lists... Done
    E: Failed to fetch http://ports.ubuntu.com/ubuntu-ports/dists/bionic/main/binary-i386/Packages  404  Not Found [IP: 91.189.88.150 80]
    E: Failed to fetch http://ports.ubuntu.com/ubuntu-ports/dists/bionic-updates/main/binary-i386/Packages  404  Not Found [IP: 91.189.88.150 80]
    E: Failed to fetch http://ports.ubuntu.com/ubuntu-ports/dists/bionic-backports/main/binary-i386/Packages  404  Not Found [IP: 91.189.88.150 80]
    E: Failed to fetch http://ports.ubuntu.com/ubuntu-ports/dists/bionic-security/main/binary-i386/Packages  404  Not Found [IP: 91.189.88.150 80]
    E: Some index files failed to download. They have been ignored, or old ones used instead.
    

    How to fix this? I probably need to adjust/add something to /etc/apt/sources.list but that doesn’t contain the strings i386/amd64. So I don’t know where to start. This is my current sources file:

    ## Note, this file is written by cloud-init on first boot of an instance
    ## modifications made here will not survive a re-bundle.
    ## if you wish to make changes you can:
    ## a.) add 'apt_preserve_sources_list: true' to /etc/cloud/cloud.cfg
    ##     or do the same in user-data
    ## b.) add sources in /etc/apt/sources.list.d
    ## c.) make changes to template file /etc/cloud/templates/sources.list.tmpl
    
    # See http://help.ubuntu.com/community/UpgradeNotes for how to upgrade to
    # newer versions of the distribution.
    deb http://ports.ubuntu.com/ubuntu-ports bionic main restricted
    # deb-src http://ports.ubuntu.com/ubuntu-ports bionic main restricted
    
    ## Major bug fix updates produced after the final release of the
    ## distribution.
    deb http://ports.ubuntu.com/ubuntu-ports bionic-updates main restricted
    # deb-src http://ports.ubuntu.com/ubuntu-ports bionic-updates main restricted
    
    ## N.B. software from this repository is ENTIRELY UNSUPPORTED by the Ubuntu
    ## team. Also, please note that software in universe WILL NOT receive any
    ## review or updates from the Ubuntu security team.
    deb http://ports.ubuntu.com/ubuntu-ports bionic universe
    # deb-src http://ports.ubuntu.com/ubuntu-ports bionic universe
    deb http://ports.ubuntu.com/ubuntu-ports bionic-updates universe
    # deb-src http://ports.ubuntu.com/ubuntu-ports bionic-updates universe
    
    ## N.B. software from this repository is ENTIRELY UNSUPPORTED by the Ubuntu
    ## team, and may not be under a free licence. Please satisfy yourself as to
    ## your rights to use the software. Also, please note that software in
    ## multiverse WILL NOT receive any review or updates from the Ubuntu
    ## security team.
    deb http://ports.ubuntu.com/ubuntu-ports bionic multiverse
    # deb-src http://ports.ubuntu.com/ubuntu-ports bionic multiverse
    deb http://ports.ubuntu.com/ubuntu-ports bionic-updates multiverse
    # deb-src http://ports.ubuntu.com/ubuntu-ports bionic-updates multiverse
    
    ## N.B. software from this repository may not have been tested as
    ## extensively as that contained in the main release, although it includes
    ## newer versions of some applications which may provide useful features.
    ## Also, please note that software in backports WILL NOT receive any review
    ## or updates from the Ubuntu security team.
    deb http://ports.ubuntu.com/ubuntu-ports bionic-backports main restricted universe multiverse
    # deb-src http://ports.ubuntu.com/ubuntu-ports bionic-backports main restricted universe multiverse
    
    ## Uncomment the following two lines to add software from Canonical's
    ## 'partner' repository.
    ## This software is not part of Ubuntu, but is offered by Canonical and the
    ## respective vendors as a service to Ubuntu users.
    # deb http://archive.canonical.com/ubuntu bionic partner
    # deb-src http://archive.canonical.com/ubuntu bionic partner
    
    deb http://ports.ubuntu.com/ubuntu-ports bionic-security main restricted
    # deb-src http://ports.ubuntu.com/ubuntu-ports bionic-security main restricted
    deb http://ports.ubuntu.com/ubuntu-ports bionic-security universe
    # deb-src http://ports.ubuntu.com/ubuntu-ports bionic-security universe
    deb http://ports.ubuntu.com/ubuntu-ports bionic-security multiverse
    # deb-src http://ports.ubuntu.com/ubuntu-ports bionic-security multiverse
    

    I found the question How to install i386 packages on Ubuntu on ARM-based Nexus 7? but people there just answer that running x86 on ARM isn’t possible. That’s true but not the correct answer to the original question.

    Update: This is the output of dpkg-deb for the desired driver package including its 1st level dependencies:

    root@raspberry-pi:~# dpkg-deb --info /tmp/cnrdrvcups-ufr2-uk_5.10-1_i386.deb 
     new Debian package, version 2.0.
     size 21503884 bytes: control archive=20743 bytes.
        2058 bytes,    16 lines      control              
       62636 bytes,   896 lines      md5sums              
         339 bytes,    17 lines   *  postinst             #!/bin/sh
          90 bytes,     9 lines   *  postrm               #!/bin/sh
     Package: cnrdrvcups-ufr2-uk
     Version: 5.10-1
     Section: net
     Priority: optional
     Architecture: i386
     Depends: cupsys | cups, libcups2 | libcupsys2 (>= 1.2.7)
     Conflicts: cnrcupsiradv715zk, cnrcupsiradv615zk, cnrcupsiradv525zk, cnrcupsiradv7153zk, cnrcupsiradv6153zk, cnrcupsiradv5253zk, cnrcupsiradv85053zk, cnrcupsiradv85853zk, cnrcupsiradv65753zk, cnrcupsiradv65553zk, cnrcupsiradvc35203zk, cnrcupsiradvc35253zk, cnrcupsiradvc75803zk, cnrcupsiradvc75653zk, cnrcupsiradvc2563zk, cnrcupsiradvc55353zk, cnrcupsiradvc55503zk, cnrcupsiradv45453zk, cnrcupsiradv45253zk, cnrcupsiradvc4753zk, cnrcupswg7000zk, cnrcupswg7000zzk, cnrcupslbp853czk, cnrcupslbp852czk, cnrcupsd1600zk
     Replaces: cnrdrvcups-ufr2-us, cnrdrvcups-lipslx, cnrcupsiradv715zk, cnrcupsiradv615zk, cnrcupsiradv525zk, cnrcupsiradv7153zk, cnrcupsiradv6153zk, cnrcupsiradv5253zk, cnrcupsiradv85053zk, cnrcupsiradv85853zk, cnrcupsiradv65753zk, cnrcupsiradv65553zk, cnrcupsiradvc35203zk, cnrcupsiradvc35253zk, cnrcupsiradvc75803zk, cnrcupsiradvc75653zk, cnrcupsiradvc2563zk, cnrcupsiradvc55353zk, cnrcupsiradvc55503zk, cnrcupsiradv45453zk, cnrcupsiradv45253zk, cnrcupsiradvc4753zk, cnrcupswg7000zk, cnrcupswg7000zzk, cnrcupslbp853czk, cnrcupslbp852czk, cnrcupsd1600zk
     Provides: cnrcupsiradv715zk, cnrcupsiradv615zk, cnrcupsiradv525zk, cnrcupsiradv7153zk, cnrcupsiradv6153zk, cnrcupsiradv5253zk, cnrcupsiradv85053zk, cnrcupsiradv85853zk, cnrcupsiradv65753zk, cnrcupsiradv65553zk, cnrcupsiradvc35203zk, cnrcupsiradvc35253zk, cnrcupsiradvc75803zk, cnrcupsiradvc75653zk, cnrcupsiradvc2563zk, cnrcupsiradvc55353zk, cnrcupsiradvc55503zk, cnrcupsiradv45453zk, cnrcupsiradv45253zk, cnrcupsiradvc4753zk, cnrcupswg7000zk, cnrcupswg7000zzk, cnrcupslbp853czk, cnrcupslbp852czk, cnrcupsd1600zk
     Installed-Size: 76096
     Maintainer: CANON INC. <[email protected]>
     Source: cnrdrvcups-lb
     Description: Canon UFR2 Printer Driver for Linux
      Canon UFR2 Printer Driver for Linux.
      This UFR2 printer driver provides printing functions for Canon LBP/iR
      printers operating under the CUPS (Common UNIX Printing System) environment.
    
    • guiverc
      guiverc about 4 years
      Different architectures can have different package versions & deps, eg. look up mysql-server-5.7 for bionic and you'll note different version PLUS different dependency requirements for different architectures (but all for current bionic releases). x86/i386 & x86_64/amd64 are kept matching - but this doesn't apply to different architectures like armhf & x86/i386, let alone s390 & others... ie dep-hell is to be expected. (packages.ubuntu.com/bionic/mysql-server-5.7 used only as example, thought of this question when commenting on another..)
  • StackEng2010
    StackEng2010 almost 3 years
    Could you please expand? I tried the same sources.list and same cnrdrvcups-ufr2-uk_5.10-1_i386.deb without any luck. I get back Package 'libcupsimaage2:i386' has no installation candidate Thanks
  • StackEng2010
    StackEng2010 almost 3 years
    I modified http://ports.ubuntu.com/ubuntu-ports to http://archive.ubuntu.com/ubuntu, but getting a list of unmet dependencies, failing to install
  • Daniel Böhmer
    Daniel Böhmer almost 3 years
    @user424174 Thank you for raising the issue! I looked into my deployment script and found that I had not documented the additional apt sources. You need your original ARM packages, of course, and additionally different servers for i386 alias x86. Do it work with that?
  • StackEng2010
    StackEng2010 almost 3 years
    I'm pleased to say it works! I installed a fresh Ubuntu Server 20.04 on my Pi 2 to run the test, added the i386.list installed cups (armhf) and dpkg -i cnrdrvcups-ufr2-uk_5.10-1_i386.deb. The driver was found in cups and I managed to print! Amazing! The only usability issue I find now is that it is slow. and the certain cores goes up to 100% when rendering. A 2-page Google webpage would render for 2 minutes to before it starts to print. Once print starts, it finishes quick.
  • Daniel Böhmer
    Daniel Böhmer almost 3 years
    Yes, I can confirm. Converting documents in the UFRII format utilizes x86 emulation which is slow on its own while that Raspberry Pi already isn’t a fast computer. Printing multiple copies is relatively faster (per page) because conversion happens only once.
  • StackEng2010
    StackEng2010 almost 3 years
    I assume you're running on a Pi 2 like I am? Appreciate all the efforts and quick responses.
  • Daniel Böhmer
    Daniel Böhmer almost 3 years
    Mine is Raspberry Pi 3 Model B Rev 1.2 as reported from /sys/firmware/devicetree/base/model
  • StackEng2010
    StackEng2010 almost 3 years
    As you have a Pi 3, if you have a spare SD card, could you give ARM64 distro a try? Such as the Pi OS ARM64 variant and Canon driver cnrdrvcups-ufr2-uk_5.30-1_arm64.deb. I wonder if that'd install and speed things up by processing without qemu and i386 packages.
  • Daniel Böhmer
    Daniel Böhmer almost 3 years
    Ok, I didn’t know I could run a 64-bit OS. Interesting! This is the first Raspberry Pi I’ve ever used and I was happy I got it working with the printer driver at all. The thing is now running in "production" and I won’t spend the time for this research now. Maybe I'll come back to this later.
  • Ionut
    Ionut almost 3 years
    @DanielBöhmer here is how I setup a Canon MF4570dw on a RPI3 running PI OS 64 bit raspberrypi.stackexchange.com/questions/120630/…
  • StackEng2010
    StackEng2010 almost 3 years
    Awesome @Ionut and Daniel convinced me to upgrade my Pi 2 to Pi 3! Well done!
  • Ionut
    Ionut almost 3 years
    I think you should go for a RPI4, it has more RAM and Gigabit Ethernet
  • StackEng2010
    StackEng2010 almost 3 years
    @Ionut got a cheapish Pi 3 just for the job. I have Ubuntu Server 20.04 installed on it, cups and cnrdrvcups-ufr2-uk_5.30-1_arm64.deb but it didn't work straight away (failed with a render failure). However, after installing some of the known dependencies libglade2-0 libjpeg62 libgcrypt20-dev libcupsimage2 it worked perfectly. Tested both printer locally plugged to Pi by USB as well as printer connected via Ethernet.