关于apt的两个问题

系统安装、升级讨论
版面规则
我们都知道新人的确很菜,也喜欢抱怨,并且带有浓厚的Windows习惯,但既然在这里询问,我们就应该有责任帮助他们解决问题,而不是直接泼冷水、简单的否定或发表对解决问题没有任何帮助的帖子。乐于分享,以人为本,这正是Ubuntu的精神所在。
回复
huangsijun17
帖子: 28
注册时间: 2014-02-15 17:04
系统: WinUbuntuArchRocky

关于apt的两个问题

#1

帖子 huangsijun17 » 2024-03-22 14:28

1. 偶见apt装包时提示缺少依赖,但使用apt install命令可以安装该依赖。似乎是没有循环搜索依赖?
2. 在chroot到一个离线的Ubuntu根目录后,如何优雅得使用apt安装?我这似乎apt update命令都跑不了了。
在线系统Ubuntu 18.04 X86,离线系统Ubuntu 18.04 ARMv7(32位)
chroot时的命令如下:

代码: 全选

sudo chroot rootfs\
    /usr/bin/env -i \
    HOME=/root                  \
    TERM="$TERM"                \
    PS1='\u:\w\$ '              \
    PATH=/bin:/usr/bin:/sbin:/usr/sbin \
    /bin/bash --login +h
登录时防机器人的问题真TM难。
我试了不下10次。答案包括:
20.04
20.04.3
LTS
18.04
16.04
等等等等
头像
astolia
论坛版主
帖子: 6450
注册时间: 2008-09-18 13:11

Re: 关于apt的两个问题

#2

帖子 astolia » 2024-03-22 15:27

huangsijun17 写了: 2024-03-22 14:28 1. 偶见apt装包时提示缺少依赖,但使用apt install命令可以安装该依赖。似乎是没有循环搜索依赖?
你这“apt装包”是具体用的哪个命令?
huangsijun17 写了: 2024-03-22 14:28 2. 在chroot到一个离线的Ubuntu根目录后,如何优雅得使用apt安装?我这似乎apt update命令都跑不了了。
在线系统Ubuntu 18.04 X86,离线系统Ubuntu 18.04 ARMv7(32位)
你这都跨架构了,你做了在x86上直接执行arm程序的相关准备工作了吗?
huangsijun17
帖子: 28
注册时间: 2014-02-15 17:04
系统: WinUbuntuArchRocky

Re: 关于apt的两个问题

#3

帖子 huangsijun17 » 2024-03-22 15:53

astolia 写了: 2024-03-22 15:27
huangsijun17 写了: 2024-03-22 14:28 1. 偶见apt装包时提示缺少依赖,但使用apt install命令可以安装该依赖。似乎是没有循环搜索依赖?
你这“apt装包”是具体用的哪个命令?

代码: 全选

root@bf7f99a1af7d:/# apt install git gnupg flex bison gperf build-essential zip curl libc6-dev libncurses5-dev   x11proto-core-dev libx11-dev libreadline6-dev libgl1-mesa-glx libgl1-mesa-dev   g++-multilib tofrodos python-markdown libxml2-utils xsltproc zlib1g-dev gawk gcc g++ make   bash-completion net-tools inetutils-ping vim openssh-server binutils ifupdown pax-utils   gcc-arm-linux-gnueabihf g++-arm-linux-gnueabihf qemu-user-staticReading package lists... Done
Building dependency tree       
Reading state information... Done
Note, selecting 'libreadline-dev' instead of 'libreadline6-dev'
Some packages could not be installed. This may mean that you have
requested an impossible situation or if you are using the unstable
distribution that some required packages have not yet been created
or been moved out of Incoming.
The following information may help to resolve the situation:

The following packages have unmet dependencies:
 g++-arm-linux-gnueabihf : Depends: g++-7-arm-linux-gnueabihf (>= 7.4.0-1~) but it is not going to be installed
 gcc-arm-linux-gnueabihf : Depends: gcc-7-arm-linux-gnueabihf (>= 7.4.0-1~) but it is not going to be installed
E: Unable to correct problems, you have held broken packages.
root@bf7f99a1af7d:/# apt install g++-7-arm-linux-gnueabihf gcc-7-arm-linux-gnueabihf
Reading package lists... Done
Building dependency tree       
Reading state information... Done
The following additional packages will be installed:
  binutils-arm-linux-gnueabihf binutils-common cpp-7-arm-linux-gnueabihf gcc-7-arm-linux-gnueabihf-base
  gcc-7-cross-base gcc-8-cross-base libasan4-armhf-cross libatomic1-armhf-cross libc6-armhf-cross
  libc6-dev-armhf-cross libcc1-0 libcilkrts5-armhf-cross libgcc-7-dev-armhf-cross libgcc1-armhf-cross
  libgomp1-armhf-cross libisl19 libmpc3 libmpfr6 libstdc++-7-dev-armhf-cross libstdc++6-armhf-cross
  libubsan0-armhf-cross linux-libc-dev-armhf-cross
Suggested packages:
  binutils-doc gcc-7-locales g++-7-multilib-arm-linux-gnueabihf gcc-7-doc libstdc++6-7-dbg-armhf-cross
  gcc-7-multilib-arm-linux-gnueabihf libgcc1-dbg-armhf-cross libgomp1-dbg-armhf-cross
  libitm1-dbg-armhf-cross libatomic1-dbg-armhf-cross libasan4-dbg-armhf-cross liblsan0-dbg-armhf-cross
  libtsan0-dbg-armhf-cross libubsan0-dbg-armhf-cross libcilkrts5-dbg-armhf-cross libmpx2-dbg-armhf-cross
  libquadmath0-dbg-armhf-cross
The following NEW packages will be installed:
  binutils-arm-linux-gnueabihf binutils-common cpp-7-arm-linux-gnueabihf g++-7-arm-linux-gnueabihf
  gcc-7-arm-linux-gnueabihf gcc-7-arm-linux-gnueabihf-base gcc-7-cross-base gcc-8-cross-base
  libasan4-armhf-cross libatomic1-armhf-cross libc6-armhf-cross libc6-dev-armhf-cross libcc1-0
  libcilkrts5-armhf-cross libgcc-7-dev-armhf-cross libgcc1-armhf-cross libgomp1-armhf-cross libisl19 libmpc3
  libmpfr6 libstdc++-7-dev-armhf-cross libstdc++6-armhf-cross libubsan0-armhf-cross
  linux-libc-dev-armhf-cross
0 upgraded, 24 newly installed, 0 to remove and 1 not upgraded.
Need to get 31.0 MB of archives.
After this operation, 108 MB of additional disk space will be used.
Do you want to continue? [Y/n] 
Get:1 http://archive.ubuntu.com/ubuntu bionic-updates/main amd64 binutils-common amd64 2.30-21ubuntu1~18.04.9 [197 kB]
(略)
Processing triggers for libc-bin (2.27-3ubuntu1.6) ...
root@bf7f99a1af7d:/# apt install git gnupg flex bison gperf build-essential zip curl libc6-dev libncurses5-dev   x11proto-core-dev libx11-dev libreadline6-dev libgl1-mesa-glx libgl1-mesa-dev   g++-multilib tofrodos python-markdown libxml2-utils xsltproc zlib1g-dev gawk gcc g++ make   bash-completion net-tools inetutils-ping vim openssh-server binutils ifupdown pax-utils   gcc-arm-linux-gnueabihf g++-arm-linux-gnueabihf qemu-user-static
Reading package lists... Done
Building dependency tree       
Reading state information... Done
Note, selecting 'libreadline-dev' instead of 'libreadline6-dev'
Some packages could not be installed. This may mean that you have
requested an impossible situation or if you are using the unstable
distribution that some required packages have not yet been created
or been moved out of Incoming.
The following information may help to resolve the situation:

The following packages have unmet dependencies:
 g++-multilib : Depends: gcc-multilib (>= 4:7.4.0-1ubuntu2.3) but it is not going to be installed
E: Unable to correct problems, you have held broken packages.
root@bf7f99a1af7d:/# apt install gcc-multilib                                       Reading package lists... Done
Building dependency tree       
Reading state information... Done
The following packages were automatically installed and are no longer required:
  binutils-arm-linux-gnueabihf cpp-7-arm-linux-gnueabihf gcc-7-arm-linux-gnueabihf-base gcc-7-cross-base
  gcc-8-cross-base libasan4-armhf-cross libatomic1-armhf-cross libc6-armhf-cross libc6-dev-armhf-cross
  libcilkrts5-armhf-cross libgcc-7-dev-armhf-cross libgcc1-armhf-cross libgomp1-armhf-cross
  libstdc++-7-dev-armhf-cross libstdc++6-armhf-cross libubsan0-armhf-cross linux-libc-dev-armhf-cross
Use 'apt autoremove' to remove them.
The following additional packages will be installed:
  binutils binutils-x86-64-linux-gnu cpp cpp-7 gcc gcc-7 gcc-7-base gcc-7-multilib lib32asan4 lib32atomic1
  lib32cilkrts5 lib32gcc-7-dev lib32gcc1 lib32gomp1 lib32itm1 lib32mpx2 lib32quadmath0 lib32stdc++6
  lib32ubsan0 libasan4 libatomic1 libbinutils libc-dev-bin libc6-dev libc6-dev-i386 libc6-dev-x32 libc6-i386
  libc6-x32 libcilkrts5 libgcc-7-dev libgomp1 libitm1 liblsan0 libmpx2 libquadmath0 libtsan0 libubsan0
  libx32asan4 libx32atomic1 libx32cilkrts5 libx32gcc-7-dev libx32gcc1 libx32gomp1 libx32itm1 libx32quadmath0
  libx32stdc++6 libx32ubsan0 linux-libc-dev manpages manpages-dev
Suggested packages:
  binutils-doc cpp-doc gcc-7-locales make autoconf automake libtool flex bison gdb gcc-doc gcc-7-doc
  libgcc1-dbg libgomp1-dbg libitm1-dbg libatomic1-dbg libasan4-dbg liblsan0-dbg libtsan0-dbg libubsan0-dbg
  libcilkrts5-dbg libmpx2-dbg libquadmath0-dbg glibc-doc man-browser
The following packages will be REMOVED:
  g++-7-arm-linux-gnueabihf gcc-7-arm-linux-gnueabihf
The following NEW packages will be installed:
  binutils binutils-x86-64-linux-gnu cpp cpp-7 gcc gcc-7 gcc-7-base gcc-7-multilib gcc-multilib lib32asan4
  lib32atomic1 lib32cilkrts5 lib32gcc-7-dev lib32gcc1 lib32gomp1 lib32itm1 lib32mpx2 lib32quadmath0
  lib32stdc++6 lib32ubsan0 libasan4 libatomic1 libbinutils libc-dev-bin libc6-dev libc6-dev-i386
  libc6-dev-x32 libc6-i386 libc6-x32 libcilkrts5 libgcc-7-dev libgomp1 libitm1 liblsan0 libmpx2 libquadmath0
  libtsan0 libubsan0 libx32asan4 libx32atomic1 libx32cilkrts5 libx32gcc-7-dev libx32gcc1 libx32gomp1
  libx32itm1 libx32quadmath0 libx32stdc++6 libx32ubsan0 linux-libc-dev manpages manpages-dev
0 upgraded, 51 newly installed, 2 to remove and 1 not upgraded.
Need to get 47.1 MB of archives.
After this operation, 149 MB of additional disk space will be used.
Do you want to continue? [Y/n] 
(略)
这三个包,就是不会自动安装的,但可以手动安装。不知为何。
astolia 写了: 2024-03-22 15:27
huangsijun17 写了: 2024-03-22 14:28 2. 在chroot到一个离线的Ubuntu根目录后,如何优雅得使用apt安装?我这似乎apt update命令都跑不了了。
在线系统Ubuntu 18.04 X86,离线系统Ubuntu 18.04 ARMv7(32位)
你这都跨架构了,你做了在x86上直接执行arm程序的相关准备工作了吗?
我是给ARM的嵌入设备根tar包镜像加依赖,上面的apt命令是安我编译成img用的SDK的依赖。
登录时防机器人的问题真TM难。
我试了不下10次。答案包括:
20.04
20.04.3
LTS
18.04
16.04
等等等等
头像
astolia
论坛版主
帖子: 6450
注册时间: 2008-09-18 13:11

Re: 关于apt的两个问题

#4

帖子 astolia » 2024-03-22 16:32

huangsijun17 写了: 2024-03-22 15:53 这三个包,就是不会自动安装的,但可以手动安装。不知为何。
你沒看你命令的輸出?
huangsijun17 写了: 2024-03-22 15:53 root@bf7f99a1af7d:/# apt install git gnupg flex bison gperf build-essential zip curl libc6-dev libncurses5-dev x11proto-core-dev libx11-dev libreadline6-dev libgl1-mesa-glx libgl1-mesa-dev g++-multilib tofrodos python-markdown libxml2-utils xsltproc zlib1g-dev gawk gcc g++ make bash-completion net-tools inetutils-ping vim openssh-server binutils ifupdown pax-utils gcc-arm-linux-gnueabihf g++-arm-linux-gnueabihf qemu-user-static
huangsijun17 写了: 2024-03-22 15:53 root@bf7f99a1af7d:/# apt install gcc-multilib
(中略)
The following packages will be REMOVED:
g++-7-arm-linux-gnueabihf gcc-7-arm-linux-gnueabihf
(后略)
gcc-multilib和g{cc,++}{,-7}-arm-linux-gnueabihf相互冲突,g++-multilib又依赖gcc-multilib。你把它们放到同一个install后面肯定没法满足依赖关系啊
huangsijun17
帖子: 28
注册时间: 2014-02-15 17:04
系统: WinUbuntuArchRocky

Re: 关于apt的两个问题

#5

帖子 huangsijun17 » 2024-03-22 16:34

astolia 写了: 2024-03-22 16:32
huangsijun17 写了: 2024-03-22 15:53 这三个包,就是不会自动安装的,但可以手动安装。不知为何。
你沒看你命令的輸出?
huangsijun17 写了: 2024-03-22 15:53 root@bf7f99a1af7d:/# apt install git gnupg flex bison gperf build-essential zip curl libc6-dev libncurses5-dev x11proto-core-dev libx11-dev libreadline6-dev libgl1-mesa-glx libgl1-mesa-dev g++-multilib tofrodos python-markdown libxml2-utils xsltproc zlib1g-dev gawk gcc g++ make bash-completion net-tools inetutils-ping vim openssh-server binutils ifupdown pax-utils gcc-arm-linux-gnueabihf g++-arm-linux-gnueabihf qemu-user-static
huangsijun17 写了: 2024-03-22 15:53 root@bf7f99a1af7d:/# apt install gcc-multilib
(中略)
The following packages will be REMOVED:
g++-7-arm-linux-gnueabihf gcc-7-arm-linux-gnueabihf
(后略)
gcc-multilib和g{cc,++}{,-7}-arm-linux-gnueabihf相互冲突,g++-multilib又依赖gcc-multilib。你把它们放到同一个install后面肯定没法满足依赖关系啊
apt的安装命令是厂商给的,我没细看……
:Cry
登录时防机器人的问题真TM难。
我试了不下10次。答案包括:
20.04
20.04.3
LTS
18.04
16.04
等等等等
头像
雪风FFR31D系
帖子: 69
注册时间: 2011-11-21 17:33

Re: 关于apt的两个问题

#6

帖子 雪风FFR31D系 » 2024-03-31 13:00

现在ubuntu的在线安装方式也太多了,apt-get和 apt 这两个到底有什么区别,我到现在也没弄懂
头像
astolia
论坛版主
帖子: 6450
注册时间: 2008-09-18 13:11

Re: 关于apt的两个问题

#7

帖子 astolia » 2024-04-02 9:38

雪风FFR31D系 写了: 2024-03-31 13:00 现在ubuntu的在线安装方式也太多了,apt-get和 apt 这两个到底有什么区别,我到现在也没弄懂
自行运行man apt,阅读DESCRIPTION部分
回复