oracle / centos2ol

Script and documentation to switch CentOS/Rocky Linux to Oracle Linux
https://linux.oracle.com/switch/centos/
Universal Permissive License v1.0
344 stars 82 forks source link

If yum.conf is modified prior to switching, it is not replaced rpm yum so it still has distroverpkg=centos-release #53

Closed EvgenyPrikhodko closed 3 years ago

EvgenyPrikhodko commented 3 years ago

CentOS 7.

wget https://raw.githubusercontent.com/oracle/centos2ol/main/centos2ol.sh
--2021-01-25 00:06:54--  https://raw.githubusercontent.com/oracle/centos2ol/main/centos2ol.sh
Resolving raw.githubusercontent.com (raw.githubusercontent.com)... 151.101.0.133, 151.101.64.133, 151.101.128.133, ...
Connecting to raw.githubusercontent.com (raw.githubusercontent.com)|151.101.0.133|:443... connected.
HTTP request sent, awaiting response... 200 OK
Length: 20588 (20K) [text/plain]
Saving to: ‘centos2ol.sh’
100%[===================================================================================================================================================================================================>] 20,588      --.-K/s   in 0.002s
2021-01-25 00:06:54 (9.55 MB/s) - ‘centos2ol.sh’ saved [20588/20588]
[root@bitrix /]# sudo bash centos2ol.sh -V

Bitrix.zip

A similar problem was discussed https://github.com/oracle/centos2ol/issues/51

Could not install base packages.
Run 'yum distro-sync' to manually install them.
For assistance, please open an issue via GitHub: https://github.com/oracle/centos2ol/.

[root@bitrix /]# yum distro-sync
Loaded plugins: etckeeper, fastestmirror, merge-conf
Loading mirror speeds from cached hostfile
epel/x86_64/metalink                                                                                                                                                                                                  |  33 kB  00:00:00
 * epel: mirror.cspacehostings.com
 * remi: mirror.awanti.com
 * remi-php72: mirror.awanti.com
 * remi-safe: mirror.awanti.com
bitrix                                                                                                                                                                                                                | 2.9 kB  00:00:00
ol7_UEKR6                                                                                                                                                                                                             | 2.5 kB  00:00:00
ol7_latest                                                                                                                                                                                                            | 2.7 kB  00:00:00
http://repo.percona.com/percona/yum/release/%24releasever/RPMS/noarch/repodata/repomd.xml: [Errno 14] HTTP Error 404 - Not Found
Trying other mirror.
To address this issue please refer to the below wiki article

https://wiki.centos.org/yum-errors

If above article doesn't help to resolve this issue please use https://bugs.centos.org/.

 One of the configured repositories failed (Percona Original release/noarch YUM repository),
 and yum doesn't have enough cached data to continue. At this point the only
 safe thing yum can do is fail. There are a few ways to work "fix" this:

     1. Contact the upstream for the repository and get them to fix the problem.

     2. Reconfigure the baseurl/etc. for the repository, to point to a working
        upstream. This is most often useful if you are using a newer
        distribution release than is supported by the repository (and the
        packages for the previous distribution release still work).

     3. Run the command with the repository temporarily disabled
            yum --disablerepo=percona-release-noarch ...

     4. Disable the repository permanently, so yum won't use it by default. Yum
        will then just ignore the repository until you permanently enable it
        again or use --enablerepo for temporary usage:

            yum-config-manager --disable percona-release-noarch
        or
            subscription-manager repos --disable=percona-release-noarch

     5. Configure the failing repository to be skipped, if it is unavailable.
        Note that yum will try to contact the repo. when it runs most commands,
        so will have to try and fail each time (and thus. yum will be be much
        slower). If it is a very temporary problem though, this is often a nice
        compromise:

            yum-config-manager --save --setopt=percona-release-noarch.skip_if_unavailable=true

failure: repodata/repomd.xml from percona-release-noarch: [Errno 256] No more mirrors to try.
http://repo.percona.com/percona/yum/release/$releasever/RPMS/noarch/repodata/repomd.xml: [Errno 14] HTTP Error 404 - Not Found
EvgenyPrikhodko commented 3 years ago
 cat /etc/yum.conf
[main]
cachedir=/var/cache/yum/$basearch/$releasever
keepcache=0
debuglevel=2
logfile=/var/log/yum.log
exactarch=1
obsoletes=1
gpgcheck=1
plugins=1
installonly_limit=5
bugtracker_url=http://bugs.centos.org/set_project.php?project_id=23&ref=http://bugs.centos.org/bug_report_page.php?category=yum
distroverpkg=centos-release

#  This is the default, if you make this bigger yum won't see if the metadata
# is newer on the remote and so you'll "gain" the bandwidth of not having to
# download the new metadata and "pay" for it by yum not having correct
# information.
#  It is esp. important, to have correct metadata, for distributions like
# Fedora which don't keep old packages around. If you don't like this checking
# interupting your command line usage, it's much better to have something
# manually check the metadata once an hour (yum-updatesd will do this).
# metadata_expire=90m

# PUT YOUR REPOS HERE OR IN separate files named file.repo
# in /etc/yum.repos.d
exclude=ansible1.9,mariadb,mariadb-*,Percona-XtraDB-*

maybe let the script delete the lines?

bugtracker_url=http://bugs.centos.org/set_project.php?project_id=23&ref=http://bugs.centos.org/bug_report_page.php?category=yum
distroverpkg=centos-release
Djelibeybi commented 3 years ago

Do you have an /etc/yum.conf.rpmnew file? Because you edited the file to add the exclude line, the initial switch can't change this file automatically. We'll have to address that.

EvgenyPrikhodko commented 3 years ago

Yes:

 ls -lh /etc/yum.conf*
-rw-r--r-- 1 root root 1.1K Jan 25 00:35 /etc/yum.conf
-rw-r--r-- 1 root root  813 Jul 20  2020 /etc/yum.conf.rpmnew
EvgenyPrikhodko commented 3 years ago

Do you have an /etc/yum.conf.rpmnew file? Because you edited the file to add the exclude line, the initial switch can't change this file automatically. We'll have to address that.

I edited the file (/etc/yum.conf) after yum distro-sync

Djelibeybi commented 3 years ago

Ok, thanks. We need to modify the script to replace the modified /etc/yum.conf with the new version and save the old one for reference.