普通用户无法运行 rootless Podman 怎么办

发布时间:2026/7/19 23:32:53

普通用户无法运行 rootless Podman 怎么办 问题现象root 用户执行正常podman ps返回CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES切换到 oracle 用户后su - oraclepodman ps报错如下cannot clone: No space left on deviceuser namespaces are not enabled in /proc/sys/user/max_user_namespacesError: cannot re-exec process这里最关键的一行是user namespaces are not enabled in /proc/sys/user/max_user_namespaces它说明当前系统没有为普通用户启用 User Namespace因此 rootless Podman 无法正常启动。02 | 根因定位Rootless Podman 依赖 Linux User Namespace。可以先检查当前配置cat /proc/sys/user/max_user_namespaces如果输出为0就表示 User Namespace 被禁用。本次环境中还发现了多个 sysctl 配置文件/etc/sysctl.conf/etc/sysctl.d/99-sysctl.conf其中都配置了user.max_user_namespaces 0这会带来一个容易忽略的问题即使新增了下面的配置文件/etc/sysctl.d/99-podman.confuser.max_user_namespaces 28633执行sysctl --system之后配置仍可能被后面的 user.max_user_namespaces 0 覆盖导致问题没有真正解决。03 | 解决步骤① 启用 User Namespace建议统一保留一个有效配置例如user.max_user_namespaces 28633或者user.max_user_namespaces 65536然后重新加载 sysctl 配置sysctl --system确认当前值cat /proc/sys/user/max_user_namespaces期望输出为28633或者65536只要该值大于 0rootless Podman 就具备继续运行的基础条件。② 配置普通用户 UID/GID 映射继续检查 oracle 用户是否配置了 subuid 和 subgidgrep ‘^oracle:’ /etc/subuid /etc/subgid如果没有结果可以执行usermod–add-subuids 100000-165535–add-subgids 100000-165535oracle确认结果应类似/etc/subuid:oracle:100000:65536/etc/subgid:oracle:100000:65536③ 检查辅助工具还需要确认 newuidmap 和 newgidmap 存在which newuidmapwhich newgidmap期望输出/usr/bin/newuidmap/usr/bin/newgidmap04 | 最后验证重新切换到普通用户

相关新闻