关于Debian11执行apt update时出现Debian bookworm报错

描述

如题，在 Debian11 中执行 apt update 过程中，出现 Debian bookworm 报错
报错内容如下

Copy
Reading package lists... Done
Building dependency tree... Done
Reading state information... Done
6 packages can be upgraded. Run 'apt list --upgradable' to see them.
N: Repository 'Debian bookworm' changed its 'non-free component' value from 'non-free' to 'non-free non-free-firmware'
N: More information about this can be found online in the Release notes at: https://www.debian.org/releases/bookworm/amd64/release-notes/ch-information.html#non-free-split

究其原因是版本更迭导致 apt 源的 non-free 组件出现了变更，按理如告警描述修改 sources.list 的文件内容，将 non-free 改为 non-free-firmware 即可。
当然，如果已经修改国内源，还需去公开的源列表查看一下组件是否正确。一般情况下按开源的 apt 源描述修改 sources.list 不会产生这个问题（这不是废话吗）

凡事都有例外，不然也不会记录下来。

我使用的机器处在一个内网环境，内网部署了源镜像，通过代理转发的方式去握手源组件地址。这种情况下修改文件可能依旧可能产生问题。
例如：

Copy
Reading package lists... Done
Building dependency tree... Done
Reading state information... Done
6 packages can be upgraded. Run 'apt list --upgradable' to see them.
W: Skipping acquire of configured file 'non-free-firmware/source/Sources' as repository 'http://repos.inside.com:19796/debian bullseye-updates InRelease' doesn't have the component 'non-free-firmware' (component misspelt in sources.list?)
W: Skipping acquire of configured file 'non-free-firmware/binary-amd64/Packages' as repository 'http://repos.inside.com:19796/debian bullseye-updates InRelease' doesn't have the component 'non-free-firmware' (component misspelt in sources.list?)
W: Skipping acquire of configured file 'non-free-firmware/i18n/Translation-en' as repository 'http://repos.inside.com:19796/debian bullseye-updates InRelease' doesn't have the component 'non-free-firmware' (component misspelt in sources.list?)
W: Skipping acquire of configured file 'non-free-firmware/i18n/Translation-zh_CN' as repository 'http://repos.inside.com:19796/debian bullseye-updates InRelease' doesn't have the component 'non-free-firmware' (component misspelt in sources.list?)
W: Skipping acquire of configured file 'non-free-firmware/i18n/Translation-zh' as repository 'http://repos.inside.com:19796/debian bullseye-updates InRelease' doesn't have the component 'non-free-firmware' (component misspelt in sources.list?)

出于安全考虑，地址我胡诌的，但实际就是通过这种方式定位到远端的源组件，以实现内网设备可以进行 apt 更新和安装。
这种情况下 apt 给出的信息是该地址没有 non-free-firmware 组件。那就意味着我无法通过修改 non-free 为 non-free-firmware 这种方式实现 apt 更新。

这也是上面描述的要去源地址页面查看 debian 源的组件的原因。

废话说的有点多了。下面是解决办法

解决办法

经典的找不到解决办法就解决提出问题的 “人”，不让 apt 告警即可

Copy
su -c 'echo "APT::Get::Update::SourceListWarnings::NonFreeFirmware \"false\";" > /etc/apt/apt.conf.d/no-bookworm-firmware.conf'

执行上述命令后，可以进行 apt 更新以及安装其他包

参考