From 00cff404c882b651896594518f2b03e52b169a9b Mon Sep 17 00:00:00 2001 From: lumarel Date: Sun, 20 Jun 2021 23:08:30 +0200 Subject: [PATCH 1/4] Improve checks against modified default repositories --- migrate2rocky/README.md | 21 +++++++++++++-------- migrate2rocky/migrate2rocky.sh | 7 +++++-- 2 files changed, 18 insertions(+), 10 deletions(-) diff --git a/migrate2rocky/README.md b/migrate2rocky/README.md index 07037c4..ec2c168 100644 --- a/migrate2rocky/README.md +++ b/migrate2rocky/README.md @@ -16,15 +16,20 @@ Running this script will convert an existing CentOS 8 system to Rocky Linux 8. ### Known Issues -#### Katello clashes +#### Custom replacements of default repositories -Katello installs its own repositories via subscription-manager that are meant to -replace the ones from CentOS, but it does not remove, or even disable, the -corresponding CentOS repositories. This would cause issues to a normal running -system, but it is especially problematic for migrate2rocky as it means that -migrate2rocky cannot properly determine which repositories to remove and -attempting to run migrate2rocky on a katello will likely result in a corrupted -system. +This script expects the **original repository configuration being present, as well +as enabled** (i.e. for CentOS the `baseos` repo configuration in the +`/etc/yum.repos.d/CentOS-Linux-BaseOS.repo` file has to be present and enabled). +Also make sure that there are **no other repositories** which could interfere with the +original configuration. + +As long as the original repository configuration is disabled and a new alternative +repository gets added in a different file, or not the only repo that provides the +base packages, the migration result will end in a corrupted system. + +This especially happens on systems configured with a centralized package management +like Katello (RedHat Satellite 6) or Uyuni (RedHat Satellite 5, SUSE Manager). #### RHEL migrations show error messages during conversion diff --git a/migrate2rocky/migrate2rocky.sh b/migrate2rocky/migrate2rocky.sh index 6213ec7..de2dbce 100644 --- a/migrate2rocky/migrate2rocky.sh +++ b/migrate2rocky/migrate2rocky.sh @@ -188,8 +188,11 @@ exit_clean () { } pre_check () { - if [[ -e /etc/rhsm/ca/katello-server-ca.pem ]]; then - exit_message "Migration from Katello-modified systems is not supported by migrate2rocky." + if [[ -e /etc/yum.repos.d/redhat.repo ]]; then + exit_message "Migration from Katello-modified systems is not supported by migrate2rocky.\nPlease unconfigure all Katello configured repos, remove the /etc/yum.repos.d/redhat.repo file and re-enable the original repos." + fi + if [[ -e /etc/yum.repos.d/susemanager\:channels.repo ]]; then + exit_message "Migration from Uyuni-modified systems is not supported by migrate2rocky.\nPlease unconfigure all Uyuni configured repos, remove the /etc/yum.repos.d/susemanager:channels.repo file and re-enable the original repos." fi } From ad5f8b2e278b867d06e2d65d6faffd9d395dfdf3 Mon Sep 17 00:00:00 2001 From: lumarel Date: Mon, 21 Jun 2021 20:58:48 +0200 Subject: [PATCH 2/4] More checking to make sure to not get any other configurations --- migrate2rocky/README.md | 3 +++ migrate2rocky/migrate2rocky.sh | 8 ++++---- 2 files changed, 7 insertions(+), 4 deletions(-) diff --git a/migrate2rocky/README.md b/migrate2rocky/README.md index ec2c168..dc0881a 100644 --- a/migrate2rocky/README.md +++ b/migrate2rocky/README.md @@ -30,6 +30,9 @@ base packages, the migration result will end in a corrupted system. This especially happens on systems configured with a centralized package management like Katello (RedHat Satellite 6) or Uyuni (RedHat Satellite 5, SUSE Manager). +If one of these systems is configured it is possible to remove all projects/channels +so the designated /etc/yum.repos.d/redhat.repo or +/etc/yum.repos.d/susemanager:channels.repo file is empty or missing. #### RHEL migrations show error messages during conversion diff --git a/migrate2rocky/migrate2rocky.sh b/migrate2rocky/migrate2rocky.sh index de2dbce..a84a0f3 100644 --- a/migrate2rocky/migrate2rocky.sh +++ b/migrate2rocky/migrate2rocky.sh @@ -188,11 +188,11 @@ exit_clean () { } pre_check () { - if [[ -e /etc/yum.repos.d/redhat.repo ]]; then - exit_message "Migration from Katello-modified systems is not supported by migrate2rocky.\nPlease unconfigure all Katello configured repos, remove the /etc/yum.repos.d/redhat.repo file and re-enable the original repos." + if [[ -e /etc/rhsm/ca/katello-server-ca.pem ]] || [[ -s /etc/yum.repos.d/redhat.repo ]]; then + exit_message "Migration from Katello-modified systems is not supported by migrate2rocky. See the README file for details." fi - if [[ -e /etc/yum.repos.d/susemanager\:channels.repo ]]; then - exit_message "Migration from Uyuni-modified systems is not supported by migrate2rocky.\nPlease unconfigure all Uyuni configured repos, remove the /etc/yum.repos.d/susemanager:channels.repo file and re-enable the original repos." + if [[ -e /etc/salt/minion.d/susemanager.conf ]] || [[ -s /etc/yum.repos.d/susemanager\:channels.repo ]]; then + exit_message "Migration from Uyuni/SUSE Manager-modified systems is not supported by migrate2rocky. See the README file for details." fi } From 9a6ad7a5f2559edd81945e4067805cfd26096d67 Mon Sep 17 00:00:00 2001 From: lumarel Date: Mon, 21 Jun 2021 22:50:40 +0200 Subject: [PATCH 3/4] Improve wording and always block if Katello was configured --- migrate2rocky/README.md | 11 +++++------ migrate2rocky/migrate2rocky.sh | 2 +- 2 files changed, 6 insertions(+), 7 deletions(-) diff --git a/migrate2rocky/README.md b/migrate2rocky/README.md index dc0881a..3064d87 100644 --- a/migrate2rocky/README.md +++ b/migrate2rocky/README.md @@ -24,15 +24,14 @@ as enabled** (i.e. for CentOS the `baseos` repo configuration in the Also make sure that there are **no other repositories** which could interfere with the original configuration. -As long as the original repository configuration is disabled and a new alternative -repository gets added in a different file, or not the only repo that provides the -base packages, the migration result will end in a corrupted system. +Any distribution that has had its core repositories altered, removed, duplicated +or overridden may cause migrate2rocky to break or corrupt the system when run. +Any attempt to migrate such systems, even after reversing the changes made by such +software, is not supported in any way. In all cases you should backup your system +before using migrate2rocky and USE AT YOUR OWN RISK. This especially happens on systems configured with a centralized package management like Katello (RedHat Satellite 6) or Uyuni (RedHat Satellite 5, SUSE Manager). -If one of these systems is configured it is possible to remove all projects/channels -so the designated /etc/yum.repos.d/redhat.repo or -/etc/yum.repos.d/susemanager:channels.repo file is empty or missing. #### RHEL migrations show error messages during conversion diff --git a/migrate2rocky/migrate2rocky.sh b/migrate2rocky/migrate2rocky.sh index a84a0f3..725c5f0 100644 --- a/migrate2rocky/migrate2rocky.sh +++ b/migrate2rocky/migrate2rocky.sh @@ -188,7 +188,7 @@ exit_clean () { } pre_check () { - if [[ -e /etc/rhsm/ca/katello-server-ca.pem ]] || [[ -s /etc/yum.repos.d/redhat.repo ]]; then + if [[ -e /etc/rhsm/ca/katello-server-ca.pem ]]; then exit_message "Migration from Katello-modified systems is not supported by migrate2rocky. See the README file for details." fi if [[ -e /etc/salt/minion.d/susemanager.conf ]] || [[ -s /etc/yum.repos.d/susemanager\:channels.repo ]]; then From 17b6ad6ebbe30a0aab19d66ea17a67d240f8cacf Mon Sep 17 00:00:00 2001 From: lumarel Date: Mon, 21 Jun 2021 22:52:27 +0200 Subject: [PATCH 4/4] Strengten other check --- migrate2rocky/migrate2rocky.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/migrate2rocky/migrate2rocky.sh b/migrate2rocky/migrate2rocky.sh index 725c5f0..c0cc49f 100644 --- a/migrate2rocky/migrate2rocky.sh +++ b/migrate2rocky/migrate2rocky.sh @@ -191,7 +191,7 @@ pre_check () { if [[ -e /etc/rhsm/ca/katello-server-ca.pem ]]; then exit_message "Migration from Katello-modified systems is not supported by migrate2rocky. See the README file for details." fi - if [[ -e /etc/salt/minion.d/susemanager.conf ]] || [[ -s /etc/yum.repos.d/susemanager\:channels.repo ]]; then + if [[ -e /etc/salt/minion.d/susemanager.conf ]]; then exit_message "Migration from Uyuni/SUSE Manager-modified systems is not supported by migrate2rocky. See the README file for details." fi }