Unable to run yum update - centos

I tried to run yum update to start working with yum tool, when I tried to run
yum update
and got an error
After I saw few forums advises I already disable ipv6, firewalld and set dns server to 8.8.8.8 and 8.8.4.4.
Output of yum update:
Loaded plugins: fastestmirror
Loading mirror speeds from cached hostfile
Could not retrieve mirrorlist http://mirrorlist.centos.org/?release=7&arch=x86_64&repo=os&infra=stock error was
14: curl#7 - "Failed connect to mirrorlist.centos.org:80; Operation now in progress"
One of the configured repositories failed (Unknown),
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=<repoid> ...
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 <repoid>
or
subscription-manager repos --disable=<repoid>
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=<repoid>.skip_if_unavailable=true
Cannot find a valid baseurl for repo: base/7/x86_64

Most of this cases is because you did a command:
yum clean all
or anything that causes a corruption or wrong pointing of repos in the /etc/yum.repos.d/
Normally, it should just be ok, but sometimes it results to corruption of yum such as the following as I tried to clean now one of the server yum repo.
I encountered this error multiple times in the 9 servers that I handled. You can check your repos at /etc/yum.repos.d/. You should be able to see this:
If you can't resolve it by checking all .repo files, backup all your .repo and download the following files and upload it to your /etc/yum.repos.d:
https://drive.google.com/open?id=1WsJ1e8stj76JWJi-6IHQ1DVTmM7OsYzW
This will be the result afterwards:
This is really a problem that causes you a lot of headache with a simple solution. I hope that this will really truly help you.

Related

yum doesn't have enough cached data to continue. At this point the only\n safe thing yum can do is fail

We use custom yum repos at our company. Something is causing them to fail the yum makecache command.
I'm on CentOS Linux release 7.7.1908 (Core).
Here's the error that we get when we run yum makecache:
One of the configured repositories failed (Unknown),
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
The repos look like this and I need to use both of them.
Epel repo:
[epel]
name=Extra Packages for Enterprise Linux 7 - $basearch
#baseurl=http://download.fedoraproject.org/pub/epel/7/$basearch
metalink=https://mirrors.fedoraproject.org/metalink?repo=epel-7&arch=$basearch
failovermethod=priority
enabled=1
gpgcheck=0
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-EPEL-7
[epel-debuginfo]
name=Extra Packages for Enterprise Linux 7 - $basearch - Debug
#baseurl=http://download.fedoraproject.org/pub/epel/7/$basearch/debug
metalink=https://mirrors.fedoraproject.org/metalink?repo=epel-debug-7&arch=$basearch
failovermethod=priority
enabled=0
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-EPEL-7
gpgcheck=1
[epel-source]
name=Extra Packages for Enterprise Linux 7 - $basearch - Source
#baseurl=http://download.fedoraproject.org/pub/epel/7/SRPMS
metalink=https://mirrors.fedoraproject.org/metalink?repo=epel-source-7&arch=$basearch
failovermethod=priority
enabled=0
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-EPEL-7
gpgcheck=1
Our company repo:
[mmp]
name=MMP
baseurl=http://10.245.19.168/mmp_repo/
gpgcheck=0
enabled=1
I'm not sure what the problem is. How can I make this error go away?
This question is solved here. So, first, some background: When yum installs a package, it unpacks and moves all of the files to the proper directory (i.e. opt, bin, etc etcetera). When a network connection is interrupted, a drive-write is stopped, what have you, during the install process, some files might not be written, while the program still returns that it was installed successfully.
To fix this:
On the host where the installation is failing, check if the repos are correct.
Especially the baseurl
# grep 'baseurl' /etc/yum.repos.d/* | grep HDP
Just append "/repodata/repomd.xml" in the URL and then test if it is accessible.
Example: if baseurl is http://public-repo-1.hortonworks.com/HDP/centos7/2.x/updates/2.6.3.0 then try accessing it as following to verify the access. Please check all the URLs
# curl -v http://public-repo-1.hortonworks.com/HDP/centos7/2.x/updates/2.6.3.0/repodata/repomd.xml
If the URLs are accessible then in that case try cleaning the yum cache by running the command.
# yum clean all
After yum clean try running the following command again to verify if the issue persist.
# yum -y install ranger_2_6_3_0_235-admin
This seems to be a problem with the EPEL repository. Try yum with
--disablerepo=epel\*
until they get this fixed.
if you don't have an immediate need to get packages from EPEL, use yum with
--disablerepo=epel
until your local mirror syncs. yum clean all may or may not help, depending on which mirror you hit.
My general suggestion is still valid, though -- unless you have an immediate need to get EPEL packages, I would suggest using
--disablerepo=epel
until your local mirror gets the fixed repodata. If you do have an immediate need for EPEL packages and
yum clean all
does not help, you will need to adjust your config to point to some specific mirror that has the fixed content, like by adding baseurl=http://ftp.funet.fi/pub/mirrors/fedora.redhat.com/pub/epel/7/
$basearch to epel.repo. Most mirrors should be updated by now, though.
Alternatives >>>
I happened to be on Freenode channel #epel when someone complained about this issue, but if this had happened to me, I could have enabled one repository at a time (with --disablerepo=* and --enablerepo=somerepo) to find which repo caused the trouble.
skip_if_unavailable=1 for non-critical repos sounds like a good idea.
Many people need only a few packages from EPEL. One option would be to import the EPEL packages you need to some locally controlled repository and use that instead. createrepo is related to this.
Top
Check your network connectivity. If you can't see your system ip address, then you should check & make network connectivity properly.
I faced this issue. I used CentOS 7 in VM ware. If I execute "ifconfig" command, it will show one IP address only. But generally in VM ware it should show two ip addresses. So if you can see only one IP address, then shutdown your linux system. Then change your Network Settings (Network Adapter) in VM ware.
Try this, it will work...!

How can I uninstall all yum packages recently installed (oVirt Node / CentOS Minimal)

I'm setting up oVirt (having no previous experience, so if you have a oVirt Node solution please tell me). When I install the ovirt-engine, it spits out a bunch of errors. I think this is more of an error with centOS/yum than anything. What happened is I ran: yum install ovirt-engine.
oVirt has this weird terminal hang issue, and I let it go for an hour (64gb ram, x5650 so no spec problems) and it was still hung. I reloaded, and now I can't install it. One of the errors is:
Error: Package: json-smart-2.2-5.el7.noarch (ovirt-4.3-centos-ovirt43) Requires: jpackage-utils
and a bunch more like this.
yum install jpackage-utils ovirt-engine

How to avoid centos-release rpm installing yum repo files via spacewalk

We have a Spacewalk server we use to distribute updates to our CentOS 6 and 7 client systems. None of the client systems have internet access. Only the spacewalk server has restricted access to complete repo sync updates.
We have an issue when it comes time to push out the centos-release rpms. this rpm installs repo config files like /etc/yum.repo.d/CentOS-Base.repo. Since the client system can't get out to the internet, any subsequent yum command displays an error about not enough mirrors.
Does any one know of a way to have either Spacewalk or yum exclude the /etc/yum.repos.d/ directory on install of the centos-release package.
It has to be an automated or configurable method as I currently run a manual command on each of the affected systems when I know that rpm is being pushed out. (/bin/rm /etc/yum.repo.d/CentOS-*.repo). I considered a cron job, but that just didn't seem like the best option.
Thanks in advance.
You can tell yum not to use a certain repository:
yum install --disablerepo=centos-base
or you can tell him to only use your repository by disabling all others:
yum install --disablerepo=* --enablerepo=myrepo
The solution I have seen in the past is to configure yum to not use the default location, but instead a different one. For example, /etc/yum.internal.repos.d/. Then anything that happens in the default location doesn't matter.

How do I install the hg-git plugin on Debian Stretch?

Debian Jessie, as well as sid, have a mercurial-git package which contains the hg-git plugin. However, this package was (auto-)removed from Debian Stretch to to a release-critical bug.
But - I need it installed and running. Surely this should be possible, right?
Well, I followed the installation instructions on the plugin page:
I ran apt-get install python-setuptools python-setuptools-git python4-setuptools python3-setuptools-git
I ran easy_install hg-git and it seemed to work
But still, when I run various mercurial operations I get, as the first line, the error message:
*** failed to import extension hgext.git: No module named git
(regardless of whether I'm doing anything git-related or not.)
My questions:
Why is this happening?
What do I need to do in order to make the error message go away while having hggit working?
Now,
How do I correctly install dulwich to get hg-git working on Windows?
Apparently, that critical bug doesn't manifest always (and perhaps only under very specific circumstances), so you can try installing the Debian sid version of the mercurial-git package (that is, version 0.8.11-1 at the time of writing). There's a SuperUser question about how to do this:
https://linuxaria.com/howto/how-to-install-a-single-package-from-debian-sid-or-debian-testing
my personal opinion in this case is to simply install the .deb file, which you can get from here (it's not platform-specific; at the link you'll need to choose a mirror.) That makes the error message go away, at least assuming you have:
[extensions]
hgext.bookmarks =
hggit =
in your ~/.hgrc file.

How can I trigger a 'yum clean all' from within a yum plugin?

I'm writing a yum plugin that updates the URLs of local repos. When the repo URL changes, I'd like to have yum run a yum clean all to make sure no out-of-date information is cached. I know yum has a hook for running code when yum clean [plugins|all] is requested but is it possible to trigger a clean all from within one of the plugin's other hook functions?
You can do this easily. Yum exposes a library which is consumed by command line program. Here is an example code for yum clean all:
import sys
sys.path.append("/usr/share/yum-cli")
import cli
ybc = cli.YumBaseCli()
ybc.cleanCli(["all"])
In case you want to do more then "clean all" using function check all the APIs exposed by CLI library methods exposed at /user/share/yum-cli folder :)
Regards,