4.2. 迁移到 RHEL 的镜像模式时,使用 UID 和 GID 偏移


如果您没有重新安装运行 MicroShift 的操作系统,则必须在迁移过程中为可能的 UID 和 GID 偏移使用临时解决方案。解决这个问题的一种方法是添加在启动受影响的系统服务前应用必要的修复的 systemd 单元。

先决条件

  • 您有一个现有的 RHEL for Edge 部署运行 MicroShift。
  • 有到构建主机的 root 访问权限。
  • 您有要部署的镜像。

流程

  • 通过在 MicroShift image -build 中输入以下命令来解决 Open vSwitch (OVS) systemd 服务 的潜在 UID 或 GID 偏移:

    # Install systemd configuration drop-ins to fix potential permission problems when upgrading from rpm-ostree commits to image mode container layers
    RUN mkdir -p /usr/lib/systemd/system/ovsdb-server.service.d && \
        cat > /usr/lib/systemd/system/ovsdb-server.service.d/microshift-ovsdb-ownership.conf <<'EOF'
    # The openvswitch database files must be owned by the appropriate user and its primary group. That the user and its group can be overwritten, recreate them.
    [Service]
    ExecStartPre=/bin/sh -c '/bin/getent passwd openvswitch >/dev/null || useradd -r openvswitch'
    ExecStartPre=/bin/sh -c '/bin/getent group hugetlbfs >/dev/null || groupadd -r hugetlbfs'
    ExecStartPre=/sbin/usermod -a -G hugetlbfs openvswitch
    ExecStartPre=/bin/chown -Rhv openvswitch. /etc/openvswitch
    EOF
    Copy to Clipboard Toggle word wrap
重要

在完成 RHEL 的 MicroShift 迁移到镜像模式后,不需要这个临时解决方案,并可删除。

返回顶部
Red Hat logoGithubredditYoutubeTwitter

学习

尝试、购买和销售

社区

关于红帽文档

通过我们的产品和服务,以及可以信赖的内容,帮助红帽用户创新并实现他们的目标。 了解我们当前的更新.

让开源更具包容性

红帽致力于替换我们的代码、文档和 Web 属性中存在问题的语言。欲了解更多详情,请参阅红帽博客.

關於紅帽

我们提供强化的解决方案,使企业能够更轻松地跨平台和环境(从核心数据中心到网络边缘)工作。

Theme

© 2025 Red Hat