Skip to content
Search AlmaLinux

This page uses Chinese content. Search opens the Chinese documentation.

    Browse this documentation

    AlmaLinux 10 的 dnf module 切换:EL10 空壳现状、EL9 命令全集与迁出盘点

    This content is not available in your language yet.

    两个容器,2026-10-30 实时仓库:

    • EL10:almalinux:10(aarch64,10.2,dnf 4.20.0)——dnf module list、switch-to/reset/enable/install 四个子命令、php 的实际获取方式、/etc/dnf/modules.d/ 现状;
    • EL9 对照:almalinux:9(9.8,dnf 4.14.0)——真实模块列表、enable nodejs:18、流状态文件、空载 switch-to。

    原始日志:plans/content-expansion/evidence/logs/alma-module-switching.log。

    本页没有执行:EL9 模块包的实际安装与运行、已装包的真实跨流切换事务、EL9→EL10 的生产迁移演练。相关段落标注「未实测」。

    结论先行:EL10 的 module 是空壳(实测输出)

    Section titled “结论先行:EL10 的 module 是空壳(实测输出)”

    先给结论:在 AlmaLinux 10 上不要尝试任何 dnf module 流操作,命令存在但功能已经没有了。

    dnf module list 的完整输出(日志 step-1):

    WARNING: modularity is deprecated, and functionality will be removed in a future release of DNF5.
    Last metadata expiration check: 0:00:01 ago on Fri Oct 30 17:07:53 2026.

    退出码 0,但警告后面没有任何模块行——这就是 EL10 的「正常输出」,不要误判为仓库没配好。

    切换类操作全部失败(日志 step-2/3,报错原文):

    Terminal window
    $ dnf module switch-to php
    Error: Problems in request:
    missing groups or modules: php # rc=1
    $ dnf module switch-to nodejs:20
    Error: Problems in request:
    missing groups or modules: nodejs:20 # rc=1
    $ dnf module reset php
    Unable to resolve argument php
    Error: Problems in request:
    missing groups or modules: php # rc=1
    $ dnf module enable php
    Error: Problems in request:
    missing groups or modules: php # rc=1
    $ dnf module install php:8.3/common
    Error: Problems in request:
    missing groups or modules: php:8.3/common # rc=1

    系统侧的佐证:/etc/dnf/modules.d/(流状态文件所在目录)由 dnf-data 包创建,但在 EL10 容器里是空的——没有任何流状态文件,「流」只剩目录空壳(日志 step-5b)。

    注意 EL10 用的还是 dnf 4.20,不是 dnf5——报错不是「新 dnf 没实现」,而是 modularity 机制本身被放弃(RHEL 10.0 Release Notes 弃用特性段口径)。

    同一台宿主机上的 almalinux:9(9.8,dnf 4.14.0)是另一番景象(日志 step-4):

    Name Stream Profiles
    mariadb 10.11 client, galera, server [d]
    mariadb 11.8 client, galera, server [d]
    nginx 1.22 common [d]
    nginx 1.26 common [d]
    nodejs 18 common [d], development, minimal, s2i
    nodejs 20 common [d], development, minimal, s2i
    php 8.1 common [d], devel, minimal
    php 8.3 common [d], devel, minimal
    postgresql 15 client, server [d]
    postgresql 18 client, server [d]

    启用一条流真实生效:

    Terminal window
    $ sudo dnf -y module enable nodejs:18
    Enabling module streams:
    nodejs 18
    Complete!
    $ dnf module list nodejs
    nodejs 18 [e] common [d], development, minimal, s2i # [e] = enabled
    nodejs 20 common [d], development, minimal, s2i

    状态写在流状态文件里(日志 step-4b):

    /etc/dnf/modules.d/nodejs.module
    [nodejs]
    name=nodejs
    stream=18
    profiles=
    state=enabled

    这条 EL9 的 dnf module enable nodejs:18 成功、EL10 的同名命令报 missing groups or modules,就是 9/10 两代的关键差异。

    switch-to、enable、reset 的区别(EL9 行为实测)

    Section titled “switch-to、enable、reset 的区别(EL9 行为实测)”
    • enable:只切「哪条流是活跃的」,不碰已安装的包。
    • reset:把流状态清空。实测 reset 后 /etc/dnf/modules.d/nodejs.module 变成 stream=、state=(空值,日志 step-4d)。
    • switch-to:切目标流 + 把已安装的包 sync 到目标流。这是三者里唯一会动包的事务。实测局限:容器里 nodejs 一个包都没装,dnf module switch-to nodejs:18 表现为 Dependencies resolved. / Nothing to do. / Complete!(日志 step-4c)——没有包可 sync,所以「无事可做」。已装包从 nodejs 18 切到 20 的真实包替换事务本页未实测。

    空壳意味着什么:存量脚本的报错行为

    Section titled “空壳意味着什么:存量脚本的报错行为”

    把 EL9 的运维资产原样搬到 EL10,会撞上这些实测行为:

    1. dnf module enable/install/switch-to <名> 一律报错中断:报错文案固定为 Error: Problems in request: missing groups or modules: <名>,退出码 1(reset 额外先报一行 Unable to resolve argument <名>)。不会静默失败,但 CI/Ansible 会因非零退出码中断。
    2. Ansible 模块语法同样失败:dnf: name="@nodejs:20/common" 这类 @流/Profile 写法底层就是 module install,在 EL10 报同类错误。
    3. 排查口径:看到 missing groups or modules 直接判定「这台系统没有模块元数据」(EL10 或模块元数据缺失),不要去折腾仓库配置——dnf module list 出弃用警告且列表为空就是 EL10 的正常态。

    文献口径:RHEL 10.0 Release Notes 弃用 modularity,原先靠流提供的多版本改由版本化并行包名承担。容器验证(日志 step-5):EL10 AppStream 里

    Terminal window
    $ dnf list php php8.3 php8.4
    Available Packages
    php.aarch64 8.3.36-1.el10_2 appstream # 默认包名 = 8.3
    php8.4.aarch64 8.4.27-1.el10_2 appstream # 新版本用并行包名

    不再有 php:8.1/8.2/8.3 流——「同一包名切版本」的机制没有了,版本由包名表达(nodejs、mariadb、postgresql 同理,见前篇 从 module stream 到版本化包名)。

    迁移前在 EL9 侧做三件事盘点(命令来自前篇,本页未跑生产演练):

    Terminal window
    # 1. 找出需要改写的脚本与自动化
    grep -rn "module \(enable\|install\|reset\|switch-to\)" /opt/scripts /etc/ansible 2>/dev/null
    # 2. 确认旧系统装了哪些模块包(包名带 .module_el9 标记)
    rpm -qa | grep -c module_el9
    # 3. 到 EL10 侧核对新包名
    dnf list php php8.4 nodejs mariadb-server 2>/dev/null

    EL9 上真实使用过模块流的服务(/etc/dnf/modules.d/*.module 里 state=enabled 的条目),迁移后逐个映射到 EL10 的默认包或并行包名;switch-to 的「切流保数据」路径在 EL10 不存在,多版本共存要靠并行包名分别安装。

    逐个映射时,可用第三方聚合 PkgSeek 按包名核对新旧包名在 Alma 各版本线仓库里的收录与当期版本,辅助确认映射目标(速查工具、非官方源;映射结论以本机仓库实测为准)。

    • EL9 模块在实际应用场景(如 nodejs 双版本并行服务、php 多站点)中的完整启用与运行未实测。
    • EL9 上已安装包的真实跨流切换(switch-to 触发的包替换事务)未实测:容器空载场景只表现为 Nothing to do。
    • EL9→EL10 生产迁移演练(存量脚本失败的真实分布、并行包名替换的完整清单与数据兼容)未实测,本页仅给出盘点命令与文献口径。
    • EPEL 等第三方仓库是否在 EL10 提供自有模块元数据,本页未验证(只用官方 baseos/appstream)。