解决使用iso作为apt源时的WARNING_The_following_packages_cannot_be_authenticated

本文介绍如何正确配置ISO文件作为Debian系统的APT源,并解决了安装过程中出现的警告问题。通过设置‘trusted=yes’选项,确保了本地ISO源的优先级及信任度。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

《解决使用iso作为apt源时的WARNING: The following packages cannot be authenticated!》

网上的将iso作为apt源的方法,基本都是如下几步(以debian为例):
1. mkdir /mnt/iso
2. 编辑/etc/fstab,添加如下内容:
       /path/debian.iso /mnt/iso udf,iso9660 loop 0 0
3. 编辑/etc/apt/sources.list,添加如下内容:
       deb file:///mnt/iso/ wheezy main contrib
4. 如果做完前3步之后没重启的话,则执行如下命令:
       mount /mnt/iso/
5. apt-get update

但是,做完以上步骤后,
当sources.list中只有iso的apt源时,使用apt-get安装软件会出现如下警告:
    WARNING: The following packages cannot be authenticated!
当sources.list中有其它的网络apt源时,使用apt-get安装软件时,还会从网络上下载安装包,
并且下载的安装包版本不比iso中的新。
前一种情况是因为,没有对/mnt/iso中包进行签名验证;
后一种情况是因为,网络上的apt源一般是已验证好的,且apt-get会优先选择已验证好的。

对/mnt/iso中的包进行验证比较麻烦,
且本地的iso一般都是可信任的,因为我们一般都会使用官方的checksum进行校验。
所以,能不能使apt-get信任本地的iso的apt源呢?

通过查看man sources.list,发现了trusted=yes这个option,
于是,将添加到/etc/apt/sources.list中的内容改为如下:
    deb [ trusted=yes ] file:///mnt/iso/ wheezy main contrib
并且,iso的apt源在网络apt源的前边,
因为如果多个apt源中的包版本相同时会优先选择前边的apt源。

此时使用apt-get安装软件,
如果iso的apt源中的包版本不比网络apt源中的旧时,就会自动选择iso的apt源进行安装,
否则,就会使用网络apt源中的包来安装。
这是我们所希望的效果。
The following extra packages will be installed: openssh-client openssh-server ssh-import-id Suggested packages: libpam-ssh keychain monkeysphere openssh-blacklist openssh-blacklist-extra rssh molly-guard The following NEW packages will be installed: openssh-server ssh ssh-import-id The following packages will be upgraded: openssh-client 1 upgraded, 3 newly installed, 0 to remove and 767 not upgraded. Need to get 1,310 kB of archives. After this operation, 926 kB of additional disk space will be used. Do you want to continue [Y/n]? y WARNING: The following packages cannot be authenticated! openssh-client openssh-server ssh ssh-import-id Install these packages without verification [y/N]? y Err http://us.archive.ubuntu.com/ubuntu/ precise-updates/main openssh-client i386 1:5.9p1-5ubuntu1.10 404 Not Found [IP: 91.189.91.82 80] Err http://us.archive.ubuntu.com/ubuntu/ precise/main ssh-import-id all 2.10-0ubuntu1 404 Not Found [IP: 91.189.91.82 80] Err http://security.ubuntu.com/ubuntu/ precise-security/main openssh-client i386 1:5.9p1-5ubuntu1.10 404 Not Found [IP: 91.189.91.81 80] Err http://security.ubuntu.com/ubuntu/ precise-security/main openssh-server i386 1:5.9p1-5ubuntu1.10 404 Not Found [IP: 91.189.91.81 80] Err http://security.ubuntu.com/ubuntu/ precise-security/main ssh all 1:5.9p1-5ubuntu1.10 404 Not Found [IP: 91.189.91.81 80] Failed to fetch http://security.ubuntu.com/ubuntu/pool/main/o/openssh/openssh-client_5.9p1-5ubuntu1.10_i386.deb 404 Not Found [IP: 91.189.91.81 80] Failed to fetch http://security.ubuntu.com/ubuntu/pool/main/o/openssh/openssh-server_5.9p1-5ubuntu1.10_i386.deb 404 Not Found [IP: 91.189.91.81 80] Failed to fetch http://security.ubuntu.com/ubuntu/pool/main/o/openssh/ssh_5.9p1-5ubuntu1.10_all.deb 404 Not Found [IP: 91.189.91.81 80] Failed to fetch http://us.archive.ubuntu.com/ubuntu/pool/main/s/ssh-import-id/ssh-import-id_2.10-0ubuntu1_all.deb 404 Not Found [IP: 91.189.91.82 80] E: Unable to fetch some archives, maybe run apt-get update or try with --fix-missing?
最新发布
08-09
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值