I am using Ubuntu 16LTS and performed a regular upgrade with apt. The upgrade failed with openssh-server
and apt complained it could not upgrade because it cannot make a backup of /usr/sbin/sshd
I removed openssh-server
and tried to reinstall it. No luck and apt comes back with the same message. I remove openssh-server
again.
When I try to manually change or remove /usr/sbin/sshd
I get the message that "Operation is not permitted". I tried to remove the attribute chattr -a -i /usr/sbin/sshd
but it keeps responding that the operation not permitted. An other annoying issue is that lsattr
does not give back any info.
How can I force a delete or move of the /usr/sbin/sshd
file?
Best Answer
The following command will show you which process
lock
a specific file:If the result of
lsof
will give yousshd
service than you should stop the service before performing the upgrade.Assuming the you tried to remove
sshd
while it is still running, you can try to stopsshd
first.Using:
or
After the service is stopped, you can try to upgrade via
apt
or remove the folder manually.