LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Server (https://www.linuxquestions.org/questions/linux-server-73/)
-   -   Centos 6 suddenly yum and other command are not found (https://www.linuxquestions.org/questions/linux-server-73/centos-6-suddenly-yum-and-other-command-are-not-found-4175652220/)

tyler2016 04-23-2019 11:57 AM

Does
Code:

yum check
produce anything helpful?

newbie14 04-23-2019 01:38 PM

Hi,
I just showed me this.


Quote:

[root@localhost ~]# yum check
Loaded plugins: fastestmirror
I waited for almost 10 minutes just there.

tyler2016 04-23-2019 02:21 PM

yum check can take a while. I would start it and walk away. Last time I ran it, I think it took almost an hour.

newbie14 04-24-2019 10:50 AM

Hi Tyler,
I followed your advice and left it and below is the results.


Quote:

[root@localhost ~]# yum check
Loaded plugins: fastestmirror
nss-3.36.0-9.el6_10.x86_64 is a duplicate with nss-3.36.0-8.el6.x86_64
yum-3.2.29-81.el6.centos.0.1.noarch is a duplicate with yum-3.2.29-81.el6.centos.noarch
Error: check all

tyler2016 04-24-2019 11:42 AM

This is no big deal. It looks like you have duplicate packages 'installed'. I am assuming you still have nss-3.36.0-9.el6_10.x86_64.rpm and yum-3.2.29-81.el6.centos.0.1.noarch.rpm from when you used rpm to reinstall everything manually using rpm. If not, download them again.

Try this:

Code:

tar cf /root/nss.tar $(rpm -ql nss)
tar cf /root/rpm.tar $(rpm -ql rpm)
rpm --force --nodeps -F nss-3.36.0-9.el6_10.x86_64.rpm yum-3.2.29-81.el6.centos.0.1.noarch.rpm
rpm -qa | egrep 'nss-3|yum-3

I am hoping that will get rpm to remove the older versions. It has been a while since I have ran into this. Worst case, you can tar up the files installed by rpm and yum, delete the packages, untar them, and reinstall the packages.

newbie14 04-24-2019 12:15 PM

Hi Tyler,
Mine is

Quote:

yum-3.2.29-81.el6.centos.noarch.rpm
nss-3.36.0-8.el6.x86_64.rpm
the nss is slight different then yours.

I tried running your commands.
Quote:

[root@localhost recover]# tar cf /root/nss.tar $(rpm -ql nss)
tar: Removing leading `/' from member names
[root@localhost recover]# tar cf root/nss.tar $(rpm -ql nss)
tar: root/nss.tar: Cannot open: No such file or directory
tar: Error is not recoverable: exiting now

berndbausch 04-24-2019 07:00 PM

@newbie14: I think what tyler2016 asks you to do is way beyond your current Linux skills.
Code:

tar cf /root/nss.tar $(rpm -ql nss)
tar cf /root/rpm.tar $(rpm -ql rpm)

The two tar commands above are meant to be backups of the files in the nss and rpm packages. These backups are needed in case the rpm --force -F command below causes more damage:
Code:

rpm --force --nodeps -F nss-3.36.0-9.el6_10.x86_64.rpm yum-3.2.29-81.el6.centos.0.1.noarch.rpm
rpm -qa | egrep 'nss-3|yum-3

You were confused by tar's informational message, thinking that it was a request to remove the leading slash:
Code:

[root@localhost recover]# tar cf /root/nss.tar $(rpm -ql nss)
tar: Removing leading `/' from member names

In fact, the above is not an error message but just information. Tar has removed the leading slash. Your backup has been made and is in file /root/nss.tar.
Code:

[root@localhost recover]# tar cf root/nss.tar $(rpm -ql nss)
tar: root/nss.tar: Cannot open: No such file or directory
tar: Error is not recoverable: exiting now

Tar reports an error since there is no directory named root in your current path.

newbie14 04-25-2019 12:38 AM

Hi Berndbaucsh,
Yes I got confused here. So what exactly should I run now to ensure I follow you guys correctly. Which command to run and should I create any directory ?

I want to learn further . What does this two commands do ? Why this needed in the first place ?
tar cf /root/nss.tar $(rpm -ql nss)
tar cf /root/rpm.tar $(rpm -ql rpm)

tyler2016 04-25-2019 09:00 AM

Quote:

Originally Posted by newbie14 (Post 5988328)
Hi Berndbaucsh,
Yes I got confused here. So what exactly should I run now to ensure I follow you guys correctly. Which command to run and should I create any directory ?

I want to learn further . What does this two commands do ? Why this needed in the first place ?
tar cf /root/nss.tar $(rpm -ql nss)
tar cf /root/rpm.tar $(rpm -ql rpm)

Those create backups of the packages that have multiple versions installed. Now that I think about it, I would add the full version to the rpm -ql to ensure you are getting the correct files. This is in case the attempt to force rpm's update process, which should remove the older versions goes awry and you aren't left with a system with no rpm or nss. nss is a crypto library that a lot of applications use (yum is one), so you don't want to make sure you have a working version. I meant for you to backup yum instead of rpm. It was a tired moment.

Try this:

Code:

cd /path/to/downloaded/rpms
tar cf /root/nss $(rpm -ql nss-3.36)
tar cf /root/yum $(rpm -ql yum-3.2.29-81.el6.centos.0.1.noarch)
rpm --force --nodeps -F nss-3.36.0-9.el6_10.x86_64.rpm yum-3.2.29-81.el6.centos.0.1.noarch.rpm

As mentioned earlier by berndbausch, tar's message about the leading slashes can be safely ignored. The tar command will still work as it should. If that doesn't let you do a yum reinstall '*', you can always remove the duplicate rpm's altogether with rpm and install the correct versions.

newbie14 04-27-2019 10:45 AM

Hi Tyler,
I followed exactly as you mentioned. What you backing up is just the file which I have downloaded previous day right ?

Quote:

tar cf /root/nss $(rpm -ql nss-3.36)
tar: package: Cannot stat: No such file or directory
tar: nss-3.36: Cannot stat: No such file or directory
tar: is: Cannot stat: No such file or directory
tar: not: Cannot stat: No such file or directory
tar: installed: Cannot stat: No such file or directory
tar: Exiting with failure status due to previous errors
[root@localhost recover]# tar cf /root/yum $(rpm -ql yum-3.2.29-81.el6.centos.0.1.noarch)
tar: Removing leading `/' from member names
tar: Removing leading `/' from hard link targets
tar: /var/lib/yum/plugins: Cannot stat: No such file or directory
tar: Exiting with failure status due to previous errors
[root@localhost recover]# rpm --force --nodeps -F nss-3.36.0-9.el6_10.x86_64.rpm yum-3.2.29-81.el6.centos.0.1.noarch.rpm
error: open of nss-3.36.0-9.el6_10.x86_64.rpm failed: No such file or directory
error: open of yum-3.2.29-81.el6.centos.0.1.noarch.rpm failed: No such file or directory
My nss version in the recover folder is
Quote:

nss-3.36.0-8.el6.x86_64.rpm
and yum is
Quote:

yum-3.2.29-81.el6.centos.noarch.rpm

tyler2016 04-30-2019 10:06 AM

You are backing up rpm in case the attempt to resolve the conflict fails. Then you can restore from the tar files and fix your system. Are the files you downloaded still on your system? Rpm doesn't know anything about repositories, so you have to give it the location of the package files you wish to install as command line arguments.

Code:

tar cf /root/nss $(rpm -ql nss-3.36)
tar: package: Cannot stat: No such file or directory
tar: nss-3.36: Cannot stat: No such file or directory
tar: is: Cannot stat: No such file or directory
tar: not: Cannot stat: No such file or directory
tar: installed: Cannot stat: No such file or directory
tar: Exiting with failure status due to previous errors
[root@localhost recover]# tar cf /root/yum $(rpm -ql yum-3.2.29-81.el6.centos.0.1.noarch)
tar: Removing leading `/' from member names
tar: Removing leading `/' from hard link targets
tar: /var/lib/yum/plugins: Cannot stat: No such file or directory
tar: Exiting with failure status due to previous errors
[root@localhost recover]# rpm --force --nodeps -F nss-3.36.0-9.el6_10.x86_64.rpm yum-3.2.29-81.el6.centos.0.1.noarch.rpm
error: open of nss-3.36.0-9.el6_10.x86_64.rpm failed: No such file or directory
error: open of yum-3.2.29-81.el6.centos.0.1.noarch.rpm failed: No such file or directory

Try backing up nss again. I didn't realize the .0 was part of the package name. Don't worry about the warnings. The added option prevents tar from failing when files are missing.

Code:

tar cf /root/nss2.tar --ignore-failed-read $(rpm -ql nss-3.36.0)
tar cf /root/yum2.tar --ignore-failed-read $(rpm -ql yum)

Do the same rpm command again, except this time make sure the files are available in your current working directory.

newbie14 05-01-2019 06:08 AM

Hi Tyler,
So you are backing up using tar but the original file is still in the recover folder right. Yes I still have all the .rpm which you ask me to download is still in one of the folders. The folder is called recover.. So you can see I cd into it and ran this.
Quote:

cd recover
[root@localhost recover]# tar cf /root/nss2.tar --ignore-failed-read $(rpm -ql nss-3.36.0)
tar: Removing leading `/' from member names
[root@localhost recover]# tar cf /root/yum2.tar --ignore-failed-read $(rpm -ql yum)
tar: Removing leading `/' from member names
tar: Removing leading `/' from hard link targets
tar: /var/lib/yum/plugins: Warning: Cannot stat: No such file or directory
tar: /var/lib/yum/plugins: Warning: Cannot stat: No such file or directory

tyler2016 05-01-2019 06:20 AM

I am assuming the rpm files are there from when you downloaded them. Those messages are fine. It worked correctly. At this point, try using rpm as in post 24 to force an upgrade of the packages.


All times are GMT -5. The time now is 08:18 AM.