You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

CentOS 6.10升级至CentOS 7.x遇多类报错,求技术解决方案

Fixing preupg Tool Failures and GPG Key Import Errors for CentOS Upgrade

Let's work through your two key issues one by one: the broken preupg tool caused by missing OpenSCAP XSL files, and the failed CentOS 7 GPG key imports.

1. Resolve preupg's Missing XSL File Errors

Your logs show preupg can't load critical XSL files from /usr/share/openscap/xsl/—this usually happens when OpenSCAP packages are missing, corrupted, or the preupgrade assistant isn't properly linked to them.

Step-by-Step Fix:

  • First, check if OpenSCAP packages are installed:
    rpm -qa | grep openscap
    
  • If openscap and openscap-scanner don't show up in the output, install them:
    yum install openscap openscap-scanner
    
  • If the packages are already present, reinstall them to fix corrupted files:
    yum reinstall openscap openscap-scanner
    
  • Also, ensure the preupgrade-assistant package is intact:
    yum reinstall preupgrade-assistant
    
  • After completing these steps, run preupg again to verify the issue is fixed.

2. Fix CentOS 7 GPG Key Import Failures

The URLs you used to import the GPG key are outdated (returning 404 errors). Here's how to get and import the valid key:

Step-by-Step Fix:

  • Option 1: Use the local GPG key file (if you have CentOS 7 media or repositories set up):
    rpm --import /etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-7
    
  • Option 2: Download the valid key directly and import it:
    # Download the official key
    curl -O https://www.centos.org/keys/RPM-GPG-KEY-CentOS-7
    # Import the downloaded key
    rpm --import RPM-GPG-KEY-CentOS-7
    

Your Original Error Logs for Reference:

I/O警告:无法加载外部实体 "/usr/share/openscap/xsl/security-guide.xsl"
编译错误:文件/usr/share/preupgrade/xsl/preup.xsl第40行元素import,xsl:import无法加载/usr/share/openscap/xsl/security-guide.xsl
I/O警告:无法加载外部实体 "/usr/share/openscap/xsl/oval-report.xsl"
编译错误:文件/usr/share/preupgrade/xsl/preup.xsl第41行元素import,xsl:import无法加载/usr/share/openscap/xsl/oval-report.xsl
I/O警告:无法加载外部实体 "/usr/share/openscap/xsl/sce-report.xsl"
编译错误:文件/usr/share/preupgrade/xsl/preup.xsl第42行元素import,xsl:import无法加载/usr/share/openscap/xsl/sce-report.xsl
OpenSCAP错误:无法解析XSLT文件'/usr/share/preupgrade/xsl/preup.xsl' [oscapxml.c:416]
无法打开文件/root/preupgrade/result.html
用法:preupg [选项]
preupg:错误:[Errno 2] 没有那个文件或目录: '/root/preupgrade/result.html'
[root@localhost upgrade]# yum localinstall redhat-upgrade-tool-0.7.22-3.el6.centos.noarch.rpm
无法设置区域设置,默认使用C
已加载插件:fastestmirror
设置本地包处理进程
检查redhat-upgrade-tool-0.7.22-3.el6.centos.noarch.rpm: 1:redhat-upgrade-tool-0.7.22-3.el6.centos.noarch
redhat-upgrade-tool-0.7.22-3.el6.centos.noarch.rpm:不更新已安装的包。无事可做
[root@localhost upgrade]# rpm --import http://ftp.plusline.de/centos/7.0.1406/os/x86_64/RPM-GPG-KEY-CentOS-7
curl: (22) 请求的URL返回错误: 404 Not Found
错误:http://ftp.plusline.de/centos/7.0.1406/os/x86_64/RPM-GPG-KEY-CentOS-7 : 导入读取失败(2)。
[root@localhost upgrade]# 
[root@localhost upgrade]# rpm --import http://isoredirect.centos.org/centos/7/os/x86_64/RPM-GPG-KEY-CentOS-7
curl: (22) 请求的URL返回错误: 404 Not Found
错误:http://isoredirect.centos.org/centos/7/os/x86_64/RPM-GPG-KEY-CentOS-7 : 导入读取失败(2)。

内容的提问来源于stack exchange,提问作者Ersel Bey

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.05.12 04:09:33