如何通过 Ubuntu Ports 在 ARM 或其他架构上安装 i386/amd64 软件包

如何通过 Ubuntu Ports 在 ARM 或其他架构上安装 i386/amd64 软件包

我需要在 Raspberry Pi ( armhfport,ARMv7) 上使用 QEMU 运行一些 x86 二进制文件,以使打印机与佳能糟糕的二进制 UFRII 驱动程序配合使用。如何在armhf(不是如何运行它们?

我可以使用以下命令安装 x86 二进制文件:

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

但随后apt一直抱怨缺少依赖项。我可能确实需要它们来运行 UFRII 转换器 — 所以我真的很想通过 安装 i386 依赖项apt

我可以添加i386架构,但apt-get update无法下载某些资源,可能是因为armhf位于 ports.ubuntu.com 上,而 x86 软件包位于主镜像上。(我曾经在 amd64 上成功安装过 i386 软件包。)

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.

如何解决这个问题?我可能需要调整/添加一些/etc/apt/sources.list不包含字符串i386/的内容amd64。所以我不知道从哪里开始。这是我当前的源文件:

## 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

我找到了问题如何在基于 ARM 的 Nexus 7 上的 Ubuntu 上安装 i386 软件包?但那里的人只是回答说在 ARM 上运行 x86 是不可能的。这是真的,但不是原始问题的正确答案。

更新:dpkg-deb这是所需驱动程序包(包括其第一级依赖项)的输出:

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.

答案1

后来我通过反复试验发现,您需要/etc/apt/sources.list更具体地设置默认条目:

dpkg --add-architecture 'i386'

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

/etc/apt/sources.list.d/i386.list添加类似于x86 镜像服务器的文件:

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

我可以使用以下命令成功安装并运行 UFRII 驱动程序:

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 

相关内容