rocky-linux / rocky-tools

MIT License
401 stars 139 forks source link

unable migrate to rocky 8.6 from centos 8.5 ? #183

Closed berlin2123 closed 2 years ago

berlin2123 commented 2 years ago

Some of my Centos 8.5 is migrated to rocky 8.5 before the release of rocky 8.6. However, now, after the release of rockylinux 8.6, can not migrate from Centos 8.5 by the same method anymore?

[root@centos8~]# cat /etc/centos-release
CentOS Linux release 8.5.2111
[root@centos8~]# ~/migrate2rocky.sh -r
migrate2rocky - Begin logging at Sun 17 Jul 2022 10:39:11 AM CST.

NetworkManager-1:1.22.8-5.el8_2.x86_64 is a duplicate with NetworkManager-1:1.32.10-4.el8.x86_64
NetworkManager-libnm-1:1.22.8-5.el8_2.x86_64 is a duplicate with NetworkManager-libnm-1:1.32.10-4.el8.x86_64
adcli-0.8.2-5.el8.x86_64 is a duplicate with adcli-0.8.2-12.el8.x86_64
... ... ... ... ...
virt-what-1.18-6.el8.x86_64 is a duplicate with virt-what-1.18-12.el8.x86_64
which-2.21-12.el8.x86_64 is a duplicate with which-2.21-16.el8.x86_64
zlib-1.2.11-16.el8_2.x86_64 is a duplicate with zlib-1.2.11-17.el8.x86_64

Error: Check discovered 261 problem(s)

Errors found in dnf/rpm database.  Please correct before running migrate2rocky.

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
pajamian commented 2 years ago

migrate2rocky is refusing to continue because a pre-check of your rpm db is showing issues. You must fix the issues shown first as any attempt to migrate while your system is in this state can cause much worse problems.

This is usually caused by stopping a dnf (or yum) operation while it is happening (eg: by force-killing it, a power outage or dnf crashing somehow). This can often-times be repaired with the package-cleanup utility in the yum-utils package, otherwise you will need to manually go through all the problematic packages and remove one of each from the rpm db (with rpm -e --justdb ...) and with 261 problems to deal with that can be quite a lot so hopefully package-cleanup will work.

Good Luck

berlin2123 commented 2 years ago

@pajamian Thanks a lot.

It is solved by the following for my node

dnf check | awk '{print $1}' > list
cat list | xargs rpm -e --justdb

In fact, this issue has nothing to do with migrating from centos8.5 to rocky8.6. After fixing the rpm db issue, the migration from centos8.5 to rocky8.6 works fine.

pajamian commented 2 years ago

Just one more thing you should be aware of, although it's not likely to be an issue at this stage.

the rpm command you used just removes the package entry from the rpm db, it doesn't actually remove the files from your system. This is what you really want because if it removed the files it would corrupt the package you were trying to leave behind, but the thing is while the newer version of each package was left behind in the db you don't know for sure which version of the package's files were left on your system. Each package could have the older versioned files, or the newer ones, or even possibly a combination of both.

Now the reason why this probably isn't an issue for you now is because migrate2rocky will have run a distro-sync during the migration. This will have effectively swapped out each package on the system (and its associated files) for the Rocky Linux version, so all of those packages files will now be up to date with the latest version from Rocky Linux.

Where this can be an issue, however, is for packages in 3rd-party repos. If any of those packages were part of the duplicated, corrupted ones then the distro-sync will not necessarily have seen a need to replace them, and so you may still have the files from some 3rd-party repo packages that are the older, incorrect version. You can use the rpm -V (verify) command to verify the integrity of the files from those packages (see the rpm man page), and if you see any corruption simply reinstall the affected package(s).

Glad you got it working, though.