我有一台机器,需要从源代码构建网络驱动程序才能获得互联网连接。为了构建驱动程序,我需要安装build-essential
和朋友。
我使用 创建了一个镜像存储库apt-mirror
,将其复制到 USB 驱动器并尝试build-essential
使用该存储库作为源进行安装apt
。
在目标机器上,该sources.list
文件包含以下内容
mike@target:~/Desktop/myrepo2$ cat /etc/apt/sources.list deb [arch=amd64] file:///home/mike/Desktop/myrepo2/mirror/us.archive.ubuntu.com/ubuntu/ bionic main restricted
当我尝试安装时build-essential
,出现以下错误:
mike@target:~/Desktop/myrepo2$ sudo apt-get update
Get:1 file:/home/mike/Desktop/myrepo2/mirror/us.archive.ubuntu.com/ubuntu bionic InRelease [242 kB]
Get:1 file:/home/mike/Desktop/myrepo2/mirror/us.archive.ubuntu.com/ubuntu bionic InRelease [242 kB]
Reading package lists... Done
mike@target:~/Desktop/myrepo2$ sudo apt-get install build-essential
Reading package lists... Done
Building dependency tree
Reading state information... Done
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:
build-essential : Depends: gcc (>= 4:7.2) but it is not going to be installed
Depends: g++ (>= 4:7.2) but it is not going to be installed
Depends: dpkg-dev (>= 1.17.11) but it is not going to be installed
E: Unable to correct problems, you have held broken packages.
在源机器上,使用以下mirror.list
文件生成镜像存储库,然后将其复制到 USB 驱动器,并从 USB 驱动器复制到目标机器:
mike@source:~/Desktop/myrepo2$ cat /etc/apt/mirror.list
############# config ##################
#
set base_path /home/mike/Desktop/myrepo2
#
# set mirror_path $base_path/mirror
# set skel_path $base_path/skel
# set var_path $base_path/var
# set cleanscript $var_path/clean.sh
# set defaultarch <running host architecture>
# set postmirror_script $var_path/postmirror.sh
# set run_postmirror 0
set nthreads 20
set _tilde 0
#
############# end config ##############
deb http://us.archive.ubuntu.com/ubuntu/ bionic main restricted
我错过了什么?
答案1
我使用 aptitude 修复了这个问题。似乎发生的原因是从安装介质安装的某些软件包的版本比 的依赖项新build-essential
。我曾经aptitude
解决过依赖项问题。
sudo aptitude install build-essential