Debian

當安裝的軟體包比要求的新時如何安裝 iptables?

  • May 19, 2021

所需的軟體包已安裝最新版本:

sudo apt install libiptc0   libxtables12
Reading package lists... Done
Building dependency tree       
Reading state information... Done
libiptc0 is already the newest version (1.8.5-3~bpo10+1).
libxtables12 is already the newest version (1.8.5-3~bpo10+1).
0 upgraded, 0 newly installed, 0 to remove and 44 not upgraded.

嘗試安裝 iptables :

sudo apt install  iptables
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:
iptables : Depends: libiptc0 (= 1.8.2-4) but 1.8.5-3~bpo10+1 is to be installed
           Depends: libxtables12 (= 1.8.2-4) but 1.8.5-3~bpo10+1 is to be installed
E: Unable to correct problems, you have held broken packages.

當安裝的軟體包比要求的新時如何安裝 iptables?

uname -a
Linux debian 5.10.0-0.bpo.5-amd64 #1 SMP Debian 5.10.24-1~bpo10+1 (2021-03-29) x86_64 GNU/Linux

安裝的庫來自 Buster backports,而不是 Debian 10。預設情況下,Backports 儲存庫不是安裝候選者,因此要安裝匹配的iptables,您需要啟用適當的儲存庫:

sudo apt install -t buster-backports iptables

或者,您可以強制將庫降級:

sudo apt install iptables libiptc0/stable libxtables12/stable

引用自:https://unix.stackexchange.com/questions/650337