OS: Centos 7.4
End goal: Install openssh-server
current issue: removing previous copy of sshd
Preceding scenario: openssh-server would not update due to yum errors. I attempted to remove openssh-server and then install it via yum in hopes that starting from scratch would clear up any issues. However the current problem is the same as the original.
Issue: When trying to install openssh-server, I get an error when Yum tries to rename the existing sshd file:
Installing : openssh-server-7.4p1-13.el7_4.x86_64 1/1 Error unpacking rpm package openssh-server-7.4p1-13.el7_4.x86_64 error: unpacking of archive failed on file /usr/sbin/sshd: cpio: rename
I assume the installer is trying to rename the old file before it can install its version. So I tried to rename it myself as root:
mv /usr/sbin/sshd /usr/sbin/sshd.old mv: cannot move ‘/usr/sbin/sshd’ to ‘/usr/sbin/sshd.old’: Operation not permitted
My first though is that maybe items in the /usr/sbin directory are immutable. However I am able to rename other files in there (I renamed them back!) And I was able to rename sshd on other centos 7 servers.
In doing research I found recommendations to run the command
lsattr. However no matter what file/directory I run this command on, there is no output. I have tried running it on other Centos 7 servers and it works there.
The same seems to be for
chattr, though I am not sure it is should display anny output. Without the use of
lsattr, I cannot confirm if
chattr did anything. I ran the following command with the though that perhaps /usr/sbin/sshd is immutable:
chattr -i /usr/sbin/sshd
The file still cannot be renamed. I am executing all commands as root, the file is owned by root and has r/w/x permissions for root.
-rwxr-xr-x. 1 root root 500K Dec 30 21:08 sshd
Also, there are no processes running as sshd according to lsof or ps.
I am not really sure what to make of this, and perhaps my question should be about
lsattr not outputting anything instead of this question. I suspect I will need to provide additional info, but not sure what. So I will try to update the question with more info upon request. Anyone have any recommendations on things I can try to troubleshoot this further?