LinuxQuestions.org
Share your knowledge at the LQ Wiki.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Server
User Name
Password
Linux - Server This forum is for the discussion of Linux Software used in a server related context.

Notices


Reply
  Search this Thread
Old 04-16-2019, 12:33 AM   #1
newbie14
Member
 
Registered: Sep 2011
Posts: 562

Rep: Reputation: Disabled
Centos 6 suddenly yum and other command are not found


I have an old centos 6 box been running sometime. Today I went to run yum update suddenly it say command not found. I run this command bash bash
bash: /usr/bin/tty: No such file or directory
My current path is
echo $PATH
/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin:/root/bin:/root/sbin

What could be the solution to this issue ?
 
Old 04-16-2019, 06:20 AM   #2
tyler2016
Member
 
Registered: Sep 2018
Distribution: Debian, CentOS, FreeBSD
Posts: 184

Rep: Reputation: Disabled
Please paste things from your terminal into code tags. I don't know what this means:

Code:
 I run this command bash bash
bash: /usr/bin/tty: No such file or directory
If you get that when trying to do this:

Code:
tyler@desktop:~$ bash
tyler@desktop:~$
Then your .bashrc is trying to run /usr/bin/tty which doesn't exists on your system. What is the result of this command:

Code:
while read line; do echo $line;  done < /etc/mtab
This is how you can "cat" a file using bash if you think your filesystem or disk may be hosed.
 
Old 04-17-2019, 09:49 AM   #3
newbie14
Member
 
Registered: Sep 2011
Posts: 562

Original Poster
Rep: Reputation: Disabled
Hi Tyler,
What I meant by this
Code:
 I run this command bash bash
bash: /usr/bin/tty: No such file or directory
What I just typed in the command line bash and I got this this output
Code:
bash: /usr/bin/tty: No such file or directory
I ran this command and go this output.

Code:
while read line; do echo $line;  done < /etc/mtab
/dev/mapper/VolGroup-LogVol01 / ext4 rw 0 0
proc /proc proc rw 0 0
sysfs /sys sysfs rw 0 0
devpts /dev/pts devpts rw,gid=5,mode=620 0 0
tmpfs /dev/shm tmpfs rw 0 0
/dev/md0 /boot ext4 rw 0 0
/dev/mapper/VolGroup-LogVol03 /tmp ext4 rw 0 0
/dev/mapper/VolGroup-LogVol02 /usr ext4 rw 0 0
/dev/mapper/VolGroup-LogVol04 /var ext4 rw 0 0
none /proc/sys/fs/binfmt_misc binfmt_misc rw 0 0
My echo $PATH results is

Code:
 echo $PATH
/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin:/root/bin
What should I do to to recover it like previously?
 
Old 04-17-2019, 10:00 AM   #4
tyler2016
Member
 
Registered: Sep 2018
Distribution: Debian, CentOS, FreeBSD
Posts: 184

Rep: Reputation: Disabled
Do any commands work? Do you get anything when you try to run basic stuff like ls and df?
 
Old 04-17-2019, 10:42 AM   #5
berndbausch
Senior Member
 
Registered: Nov 2013
Location: Tokyo
Distribution: Redhat/Centos, Ubuntu, Raspbian, Fedora, Alpine, Cirros, OpenSuse/SLES
Posts: 2,973

Rep: Reputation: 771Reputation: 771Reputation: 771Reputation: 771Reputation: 771Reputation: 771Reputation: 771
Quote:
Originally Posted by newbie14 View Post
bash: /usr/bin/tty: No such file or directory
Did you check whether /usr/bin/tty exists? Is it executable?
Code:
$ ls -l /usr/bin/tty
$ file /usr/bin/tty
Same for yum. I am not sure where it is supposed to be located; I would try /bin, /usr/bin, /sbin, /usr/sbin.
 
Old 04-20-2019, 11:36 PM   #6
newbie14
Member
 
Registered: Sep 2011
Posts: 562

Original Poster
Rep: Reputation: Disabled
Hi Tyler

Quote:
Originally Posted by tyler2016 View Post
Do any commands work? Do you get anything when you try to run basic stuff like ls and df?
Yes both this ls and df are working as per normal.
 
Old 04-20-2019, 11:41 PM   #7
newbie14
Member
 
Registered: Sep 2011
Posts: 562

Original Poster
Rep: Reputation: Disabled
Hi Berndbausch
Quote:
Originally Posted by berndbausch View Post
Did you check whether /usr/bin/tty exists? Is it executable?
Code:
$ ls -l /usr/bin/tty
$ file /usr/bin/tty
Same for yum. I am not sure where it is supposed to be located; I would try /bin, /usr/bin, /sbin, /usr/sbin.

For this command I got this results.

Code:
ls -l /usr/bin/tty
ls: cannot access /usr/bin/tty: No such file or directory
I tried all your combination of
Code:
/bin, /usr/bin, /sbin, /usr/sbin
all gave me
Code:
ls: cannot access /usr/sbin/yum: No such file or directory
But when I ran this command
Code:
ls -l /usr/sbin
I could see part of the results as


Code:
-rwxr-xr-x  1 root root       9932 Jul 30  2018 yum-complete-transaction
-rwxr-xr-x  1 root root       8022 Jul 30  2018 yumdb
 
Old 04-21-2019, 12:26 AM   #8
berndbausch
Senior Member
 
Registered: Nov 2013
Location: Tokyo
Distribution: Redhat/Centos, Ubuntu, Raspbian, Fedora, Alpine, Cirros, OpenSuse/SLES
Posts: 2,973

Rep: Reputation: 771Reputation: 771Reputation: 771Reputation: 771Reputation: 771Reputation: 771Reputation: 771
I can't say why they are missing, but their absence explains your problem.

Without yum, it will be hard to install anything. Is reinstallation an option?

Last edited by berndbausch; 04-22-2019 at 05:00 AM.
 
Old 04-21-2019, 05:19 AM   #9
tyler2016
Member
 
Registered: Sep 2018
Distribution: Debian, CentOS, FreeBSD
Posts: 184

Rep: Reputation: Disabled
If a reinstall isn't an option, you might be able to get by downloading packages manually and installing them with rpm. Do you have rpm? I can't remember where it is at, but try the usual locations: /sbin, /usr/sbin, /bin, and /usr/bin. If you go this route would start with glibc followed by coreutils, as I think tty is part of coreutils.
 
Old 04-22-2019, 04:20 AM   #10
newbie14
Member
 
Registered: Sep 2011
Posts: 562

Original Poster
Rep: Reputation: Disabled
Hi Berndbaucsh,
Yes their absence is a big problem cause I cant run any yum update etc. I cant do much installation. I am trying to avoid reinstallation cause many things running on it.
 
Old 04-22-2019, 04:21 AM   #11
newbie14
Member
 
Registered: Sep 2011
Posts: 562

Original Poster
Rep: Reputation: Disabled
Hi Tyler,
So what you want me to do is rpm is it? I dont get you what do you mean by start glibc ?
 
Old 04-22-2019, 06:01 AM   #12
tyler2016
Member
 
Registered: Sep 2018
Distribution: Debian, CentOS, FreeBSD
Posts: 184

Rep: Reputation: Disabled
Considering yum and parts of coreutils are gone, this is a long shot, but might work. I am assuming you are using CentOS and not RHEL, SL, or some other RHEL like clone. I am assuming you have a good backup and an OS reinstall is not possible. Here is the URL for the package files:

http://mirror.centos.org/centos/6/os/x86_64/Packages/

Download the latest versions of the following packages. I might have missed a few, but this should be what you need to get yum working again:

audit-libs
bash
bzip2-libs
coreutils
cracklib
cracklib-dicts
curl
cyrus-sasl-lib
db4
db4-utils
elf
elfutils-libelf
expat
file-libs
gdbm
glibc
gmp
gpgme
grep
info
krb5-libs
libacl
libattr
libcap
libcap
libcom_err
libcurl
libcurl
libffi
libidn
libselinux
libssh2
lua
ncurses
ncurses-libs
nspr
nss
nss-util
openldap
openssl
pam
popt
pygpgme
python
python-iniparse
python-libs
python-pycurl
python-urlgrabber
readline
rpm
rpm-libs
rpm-python
sqlite
xz-libs
yum
zlib

Put them all in a single directory and install them with:

Code:
cd /where/you/put/them
rpm -i --force --nodeps *.rpm
When you are done do this to reinstall all of your packages which should resolve any other missing file problems:

Code:
yum reinstall '*'
If this doesn't work, which it may not, since tty is part of coreutils, you could do a fresh minimal install of CentOS 6 in a VM, and rsync /bin, /sbin, /lib, /usr, and /lib64 to the broken system and then do a yum reinstall '*'. If you can't rsync, get them to a broken host IN A TEMPORARY ROOT by whatever means you have, and chmod +x everything to ensure you aren't stuck with programs you can't execute and have no way of fixing. Once they are there and the permissions are fixed, cp -p all of the regular files in the alternate root to their correct locations. Some suggestions: nc, tar, scp, ftp, cpio, zip/unzip. Don't worry about permissions exact permissions, they will be fixed when you reinstall the packages.
 
1 members found this post helpful.
Old 04-23-2019, 01:45 AM   #13
newbie14
Member
 
Registered: Sep 2011
Posts: 562

Original Poster
Rep: Reputation: Disabled
Hi Tyler,
Lucky the rpm is working but wget not working. So I download to my local win and then upload the folder and ran this command
Quote:
rpm -i --force --nodeps *.rpm
without any issue.

Next when I tried to run yum reinstall '*'
I got stuck as below.
Quote:

--> Finished Dependency Resolution
Error: Multilib version problems found. This often means that the root
cause is something else and multilib version checking is just
pointing out that there is a problem. Eg.:

1. You have an upgrade for nss which is missing some
dependency that another package requires. Yum is trying to
solve this by installing an older version of nss of the
different architecture. If you exclude the bad architecture
yum will tell you what the root cause is (which package
requires what). You can try redoing the upgrade with
--exclude nss.otherarch ... this should give you an error
message showing the root cause of the problem.

2. You have multiple architectures of nss installed, but
yum can only see an upgrade for one of those arcitectures.
If you don't want/need both architectures anymore then you
can remove the one with the missing update and everything
will work.

3. You have duplicate versions of nss installed already.
You can use "yum check" to get yum show these errors.

...you can also use --setopt=protected_multilib=false to remove
this checking, however this is almost never the correct thing to
do as something else is very likely to go wrong (often causing
much more problems).

Protected multilib versions: nss-3.36.0-9.el6_10.x86_64 != nss-3.36.0-8.el6.x86_64
Error: Protected multilib versions: yum-3.2.29-81.el6.centos.0.1.noarch != yum-3.2.29-81.el6.centos.noarch
[root@localhost recover]#
What you suggest here?
 
Old 04-23-2019, 04:49 AM   #14
tyler2016
Member
 
Registered: Sep 2018
Distribution: Debian, CentOS, FreeBSD
Posts: 184

Rep: Reputation: Disabled
Try:

Code:
yum update
yum reinstall '*'

Last edited by tyler2016; 04-23-2019 at 04:50 AM.
 
Old 04-23-2019, 10:08 AM   #15
newbie14
Member
 
Registered: Sep 2011
Posts: 562

Original Poster
Rep: Reputation: Disabled
Hi Tyler,
Infact I already tried that
Quote:
yum update
works fine. The error comes when I ran this
Quote:
yum reinstall '*'
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
[SOLVED] No package 'x11' found No package 'xext' found No package 'xdamage' found No package 'xfixes' found No package 'x11-xcb' found Jigsaw Linux From Scratch 12 04-25-2019 07:33 AM
[SOLVED] rpm command and yum command not found Joaquin Red Hat 27 04-09-2013 09:17 AM
[SOLVED] Centos 5 Error :- -bash: yum: command not found sachinsud Linux - Server 56 06-21-2012 07:41 PM
yum install flash ... yum: command not found ... which yum ... /usr/bin/yum tg3793 Fedora 8 04-13-2011 11:25 AM
Directory not found; -xzvf not found; Makefile not found RealGomer Linux - Software 4 09-20-2010 10:02 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Server

All times are GMT -5. The time now is 08:31 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration