我正在尝试将我的 Centos 8 服务器迁移到 Rocky Linux。我使用迁移脚本,但收到此错误:

[root@domain migrate2rocky]# ./migrate2rocky.sh -r
migrate2rocky - Begin logging at Mon 24 Jun 2024 02:51:09 PM -04.


Removing dnf cache
Preparing to migrate CentOS Stream 8 to Rocky Linux 8.

Determining repository names for CentOS Stream 8.Importing GPG key 0x210976F2:
 Userid     : "Package Manager (Package Signing Key) <packages@pgadmin.org>"
 Fingerprint: E869 7E2E EF76 C02D 3A63 3277 8881 B2A8 2109 76F2
 From       : /etc/pki/rpm-gpg/PGADMIN_PKG_KEY
.....

Found the following repositories which map from CentOS Stream 8 to Rocky Linux 8:
CentOS Stream 8  Rocky Linux 8
AppStream        appstream
BaseOS           baseos
extras           extras

Getting system package names for CentOS Stream 8.^[[A^[[B.......Error: No Matches found

Can't get package that provides /etc/yum.repos.d/CentOS-Base.repo.

An error occurred while we were attempting to convert your system to Rocky Linux. Your system may be unstable. Script will now exit to prevent possible damage.

 A log of this installation can be found at /var/log/migrate2rocky.log

这是我的 repo 文件:

# CentOS-Base.repo
#
# The mirror system uses the connecting IP address of the client and the
# update status of each mirror to pick mirrors that are updated to and
# geographically close to the client.  You should use this for CentOS updates
# unless you are manually picking other mirrors.
#
# If the #mirrorlist= does not work for you, as a fall back you can try the 
# remarked out baseurl= line instead.
#

[BaseOS]
name=CentOS Stream $releasever - BaseOS
baseurl=https://vault.centos.org/centos/8/BaseOS/x86_64/os/
#mirrorlist=http://mirrorlist.centos.org/?release=8-stream&arch=$basearch&repo=BaseOS&infra=$infra
#baseurl=http://vault.centos.org/$contentdir/8-stream/BaseOS/$basearch/os/
#baseurl=http://mirror.centos.org/centos/8-stream/BaseOS/x86_64/os/
gpgcheck=1
enabled=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-centosofficial

[AppStream]
name=CentOS Stream $releasever - AppStream
#mirrorlist=http://mirrorlist.centos.org/?release=8-stream&arch=$basearch&repo=AppStream&infra=$infra
#mirrorlist=http://mirror.centos.org/centos/8-stream/BaseOS/x86_64/os/repodata/i
#baseurl=http://mirror.centos.org/centos/8-stream/AppStream/x86_64/os/
baseurl=https://vault.centos.org/centos/8/AppStream/x86_64/os/
gpgcheck=1
enabled=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-centosofficial

[extras]
name=CentOS Stream $releasever - Extras
baseurl=https://vault.centos.org/centos/8/extras/x86_64/os/
#mirrorlist=http://mirrorlist.centos.org/?release=8-stream&arch=$basearch&repo=extras&infra=$infra
#baseurl=http://vault.centos.org/$contentdir/8-stream/extras/$basearch/os/
#baseurl=http://mirror.centos.org/centos/8-stream/extras/x86_64/os/
gpgcheck=1
enabled=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-centosofficial

#[PowerTools]
#name=CentOS Stream $releasever - PowerTools
#mirrorlist=http://mirrorlist.centos.org/?release=8-stream&arch=$basearch&repo=PowerTools&infra=$infra
#baseurl=http://vault.centos.org/$contentdir/8-stream/PowerTools/$basearch/os/
#gpgcheck=1
#enabled=0
#gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-centosofficial

#[centosplus]
#name=CentOS Stream $releasever - Plus
#mirrorlist=http://mirrorlist.centos.org/?release=8-stream&arch=$basearch&repo=centosplus&infra=$infra
#baseurl=http://vault.centos.org/$contentdir/8-stream/centosplus/$basearch/os/
#baseurl=http://mirror.centos.org/centos/8-stream/PowerTools/x86_64/os/
#baseurl=http://mirror.centos.org/centos/8-stream/centosplus/x86_64/os/
#gpgcheck=1
#enabled=0
#gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-centosofficial

#[fasttrack]
#name=CentOS Stream $releasever - fasttrack
#mirrorlist=http://mirrorlist.centos.org/?release=8-stream&arch=$basearch&repo=fasttrack&infra=$infra
#baseurl=http://vault.centos.org/$contentdir/8-stream/fasttrack/$basearch/os/
#baseurl=http://mirror.centos.org/centos/8-stream/fasttrack/
#gpgcheck=1
#enabled=0
#gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-centosofficial

感谢您的任何帮助。


最佳答案
1

rpm -qif /etc/yum.repos.d/CentOS-Base.repo 并找出此框发生了什么,导致 repo 文件不属于包。migrate2rocky.sh 的作者不支持将其与 repo 文件一起自定义使用。

您的 repo 取消了对 vault 的注释。Vault 是旧的不安全版本,应尽可能避免使用,而应使用常规更新 repos。除了这个挑战之外,migrate2rocky.sh 不能很好地处理启用 vault 或其他自定义的情况。

脚本会执行一些通常可疑的操作,即rpm -e --justdb --nodepsdnf --setopt=protected_packages= 我认为这些是它在编辑 repo 文件,然后将新的 Rocky 发布包与等效 repo 文件交换)之前。由于这些是包管理器本身,因此操作比较棘手,并且通常依赖项不允许删除它们。

备份此主机后,考虑安装 CentOS Stream repo 文件,例如 dnf install /etc/yum.repos.d/CentOS-Base.repo 然后脚本也许可以继续。

作为替代方案,请准备好全新安装 Rocky。当自定义和数据恢复自动化时,这将不会花费很长时间。特别是与与包管理器斗争以完成此升级相比。

2

  • 我不熟悉数据恢复自动化,并且我运行了一些服务,例如:Postfix、Apache、Postgresql。编程语言如 Python、PHP 等。重新安装和配置所有内容会很费力


    – 

  • 如果您不准备进行全新安装和备份恢复,则您无法通过任何方法升级发行版。尤其是当方法类似于此脚本时,它会禁用安全措施来切换发行版。考虑接受培训或聘请某人提供帮助。


    –