针对 CVE-2025-52881 的临时解决方案:修复因 AppArmor 与 runc 1.2.7+/1.3.2+ 不兼容而导致 Proxmox LXC 容器中 Docker、Podman 及容器运行时崩溃的问题
runc(1.2.7+ 和 1.3.2+ 版本)与 containerd(1.7.28-2+ 以上版本)的最新安全更新在 Proxmox LXC 容器内运行时引入了与 AppArmor 的破坏性不兼容。这会导致 Docker 和其他容器运行时出现如下错误:
OCI runtime create failed: unable to start container process:
error during container init: open sysctl net.ipv4.ip_unprivileged_port_start file:
reopen fd 8: permission denied
这会影响:
将 runc 降级到 1.2.7/1.3.2 以下虽然可以“修复”该问题,但会让您的系统暴露于安全更新所修补的实际权限提升漏洞中。本仓库提供的临时解决方案是推荐的做法。
本仓库提供了可自动应用并管理 Proxmox LXC 容器 AppArmor 临时解决方案的工具:
pve-script-wrapper.sh - 适用于 Proxmox 社区脚本的通用包装器pve-docker-fix - 修复已经损坏的现有容器pve-docker-rollback - 在上游修复可用时移除临时解决方案pct-patched - 内部包装器(由 pve-script-wrapper.sh 自动使用)这些脚本会自动检测容器的操作系统,并应用相应的 AppArmor 临时解决方案:
适用于所有容器:
lxc.apparmor.profile: unconfined
仅适用于 Ubuntu 容器:
lxc.mount.entry: /dev/null sys/module/apparmor/parameters/enabled none bind 0 0
第一行禁用 AppArmor 强制限制(所有发行版都需要)。第二行屏蔽 AppArmor 模块检测,仅 Ubuntu 容器需要——Debian 容器通常无需此行即可正常工作(runc#4968)。
操作系统自动检测: 脚本会自动检测您的容器是 Ubuntu 还是 Debian,并且只应用必要的配置行。
在您的 Proxmox VE 主机上运行:
# Download all scripts
curl -fsSL https://raw.githubusercontent.com/jq6l43d1/proxmox-lxc-docker-fix/main/pve-script-wrapper.sh -o /usr/local/bin/pve-script-wrapper.sh
curl -fsSL https://raw.githubusercontent.com/jq6l43d1/proxmox-lxc-docker-fix/main/pct-patched -o /usr/local/bin/pct-patched
curl -fsSL https://raw.githubusercontent.com/jq6l43d1/proxmox-lxc-docker-fix/main/pve-docker-fix -o /usr/local/bin/pve-docker-fix
curl -fsSL https://raw.githubusercontent.com/jq6l43d1/proxmox-lxc-docker-fix/main/pve-docker-rollback -o /usr/local/bin/pve-docker-rollback
# Make them executable
chmod +x /usr/local/bin/pve-script-wrapper.sh /usr/local/bin/pct-patched /usr/local/bin/pve-docker-fix /usr/local/bin/pve-docker-rollback
或者克隆仓库:
git clone https://github.com/jq6l43d1/proxmox-lxc-docker-fix.git
cd proxmox-lxc-docker-fix
chmod +x *.sh pct-patched pve-docker-fix pve-docker-rollback
cp pve-script-wrapper.sh pct-patched pve-docker-fix pve-docker-rollback /usr/local/bin/
不要使用:
bash -c "$(curl -fsSL https://raw.githubusercontent.com/community-scripts/ProxmoxVE/main/ct/komodo.sh)"
而应使用:
pve-script-wrapper.sh https://raw.githubusercontent.com/community-scripts/ProxmoxVE/main/ct/komodo.sh
这适用于任何创建 LXC 容器的 Proxmox 社区脚本:
# Docker
pve-script-wrapper.sh https://raw.githubusercontent.com/community-scripts/ProxmoxVE/main/ct/docker.sh
# Dockge
pve-script-wrapper.sh https://raw.githubusercontent.com/community-scripts/ProxmoxVE/main/ct/dockge.sh
# CasaOS
pve-script-wrapper.sh https://raw.githubusercontent.com/community-scripts/ProxmoxVE/main/ct/casaos.sh
# Podman
pve-script-wrapper.sh https://raw.githubusercontent.com/community-scripts/ProxmoxVE/main/ct/podman.sh
# And any other script that installs container runtimes
以及任何其他安装容器运行时的脚本。
如果您已经有一个损坏的容器:
# Fix container 105
pve-docker-fix 105
# Fix without automatic restart
pve-docker-fix 105 --no-restart
该工具将:
如果您希望手动应用修复:
# Stop the container
pct stop 105
# Edit the config file
nano /etc/pve/lxc/105.conf
# Add this line at the end (required for all containers):
lxc.apparmor.profile: unconfined
# For Ubuntu containers, also add this line:
lxc.mount.entry: /dev/null sys/module/apparmor/parameters/enabled none bind 0 0
# Start the container
pct start 105
注意: Debian 容器通常只需要第一行。Ubuntu 容器需要两行。有关技术细节,请参阅 runc#4968。
当上游修复可用时(Proxmox/LXC/AppArmor 更新),您可以移除临时解决方案:
# List all containers with the workaround
pve-docker-rollback --list
# Remove from specific container
pve-docker-rollback 105
# Preview changes without modifying
pve-docker-rollback 105 --dry-run
# Remove from all containers at once
pve-docker-rollback --all
# Remove without restart (changes apply on next start)
pve-docker-rollback 105 --no-restart
# Remove from all containers without confirmation
pve-docker-rollback --all --force
回滚工具将:
--force)何时回滚:
pct-patched 符号链接的临时目录PATH 以优先使用包装器pct 命令pct create 命令/usr/sbin/pct 来创建容器/etc/pve/lxc/$CTID.confpct 命令原样传递lxc.apparmor.profile: unconfined# Verify scripts are executable
ls -l /usr/local/bin/pve-script-wrapper.sh /usr/local/bin/pct-patched
# Make them executable if needed
chmod +x /usr/local/bin/pve-script-wrapper.sh /usr/local/bin/pct-patched
# Verify the fix was applied
grep -i apparmor /etc/pve/lxc/105.conf
# Check detected OS type
pct config 105 | grep ostype
# For Ubuntu containers, ensure both lines are present:
# - lxc.apparmor.profile: unconfined
# - lxc.mount.entry: /dev/null sys/module/apparmor/parameters/enabled...
# If not present, apply manually
pve-docker-fix 105
# Check container is restarted
pct status 105
# Check for syntax errors in config
cat /etc/pve/lxc/105.conf
# View detailed error messages
journalctl -xe
欢迎贡献!请:
GNU 通用公共许可证 - 有关详细信息,请参阅 LICENSE 文件
# Install
curl -fsSL https://raw.githubusercontent.com/jq6l43d1/proxmox-lxc-docker-fix/main/install.sh | bash
# Run community script with fix
pve-script-wrapper.sh <script-url>
# Fix existing container
pve-docker-fix <container-id>
# List containers with workaround
pve-docker-rollback --list
# Remove workaround (when upstream fixes available)
pve-docker-rollback <container-id>
pve-docker-rollback --all
# Get help
pve-script-wrapper.sh --help
pve-docker-fix --help
pve-docker-rollback --help
注意:这是一个临时解决方案,直到上游项目发布永久修复。请关注所引用的 GitHub issues 以获取更新。