Welcome to the most active Linux Forum on the web.
Go Back > Forums > Linux Forums > Linux - Software
User Name
Linux - Software This forum is for Software issues.
Having a problem installing a new program? Want to know which application is best for the job? Post your question in this forum.


  Search this Thread
Old 09-24-2007, 11:00 AM   #1
LQ Newbie
Registered: Feb 2007
Posts: 9

Rep: Reputation: 0
How does yum (or rpm or other pm) update/upgrade in use packages


I have tried looking around on Google and LQ for an answer to this question, but I can't seem to find the answer, and I'm hoping that someone here knows the answer. For reference I am running FC6 so if there is any distro specific stuff below, that is what I am using for a reference.

When I issue a "yum upgrade openssh" while connected to the machine via ssh, the sshd process is obviously running, but I don't get disconnected during the upgrade and yet it still seems to work. As I understand it, when rpm replaces an in use file, it renames the old file to a new name and/or location and then replaces the file and sends a HUP signal to the process.

However, if this is what happens, then I still have a few lingering questions about this process. When a process like sshd gets restarted with a HUP signal, it apparently doesn't completely shutdown because my ssh session doesn't close, and apparently the new process doesn't totally take over because I see the following entry in my /var/log/security after a "yum update openssh":

Sep 24 09:30:21 [hostname removed] sshd[477]: Received signal 15; terminating.
Sep 24 09:30:22 [hostname removed] sshd[659]: Server listening on :: port 22.
Sep 24 09:30:22 [hostname removed] sshd[659]: error: Bind to port 22 on failed: Address already in use.
From this it appears that the old sshd is still running and bound to port 22. So my two questions are:

(1) As I understand it the old sshd executable still exists somewhere and is running. What is the convention that rpm uses to rename/move in use files that are replaced, and what eventually happens to them? (i.e. how do I make sure that they get deleted/removed at some point in the future. Is this taken care of by one of the daily/weekly/monthly cron jobs)

(2) From the logs it appears that the new sshd process fails to start up properly (or at least fails to bind to port 22, and so isn't listening for new connections anywhere). Do I need to do anything to finish the transition? I have tried a "service sshd restart", but I get exactly the same log message. Do I have to reboot the machine to finish this update, or will it eventually resolve itself if I log out for a while?

Old 09-24-2007, 11:38 AM   #2
Senior Member
Registered: Aug 2003
Location: Glasgow
Distribution: Fedora / Solaris
Posts: 3,109

Rep: Reputation: 96

On Linux, it's possible to remove in-use files (like your sshd executable) and replace them, but still have them available to running processes:
When you open a file, the kernel follows the link, and assigns the inode a file descriptor (a number that it keeps track of internally). When you delete the file, you are "unlinking" the inode; the file descriptor still points to it. You can create a new file with the exact same name as the old file after deleting it, effectively "replacing" it, but it will point to a different inode. Any programs that still have the old file open can still access the old file via the file descriptor, but you have effectively upgraded the program in place. As soon as the program terminates (or closes the file), and starts up (or tries to access it again), it accesses the new file, and there you have it, a completely in-place replacement of a file!
(from )

In the case of SSH, there's an sshd process for each login, which isn't killed when you update the ssh package (although the master sshd process is, during the cleanup process in yum). While you remain logged in, you're still using the old version. As soon as you log out, though, the sshd process you were using dies and if you log back in, you'll be using the new version.

Exactly why you got a bind error, I'm not sure. Maybe the sshd process took too long to die before being restarted or something.

Old 09-26-2007, 12:06 PM   #3
LQ Newbie
Registered: Feb 2007
Posts: 9

Original Poster
Rep: Reputation: 0
OK. Thanks a lot.


rpm, sshd, yum, yum update

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
Can rpm/yum uninstall conflicting packages automatically? Akhran Red Hat 1 04-09-2007 01:46 AM
After using yum to download packages I couldn't upgrade because of lack of space on / Worksman Linux - Software 2 07-26-2005 08:52 PM
Yum upgrade/update question stefaandk Linux - Newbie 1 06-23-2005 12:04 AM
ATI driver update for SUSE LINUX 9.2..NVIDIA Installer HOWTO... RPM packages of X.Org coolbreeze7000 SUSE / openSUSE 17 02-08-2005 04:50 PM
Upgrade packages with RPM jackpal Linux - General 1 07-27-2004 02:52 PM > Forums > Linux Forums > Linux - Software

All times are GMT -5. The time now is 02:34 PM.

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