LinuxQuestions.org
Visit Jeremy's Blog.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Software
User Name
Password
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.

Notices

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

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


Hi,

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":

Code:
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 0.0.0.0 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?

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

Rep: Reputation: 96
Hi.

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:
Quote:
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 http://blogs.ittoolbox.com/linux/loc...ebooting-12826 )

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.

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

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


Reply

Tags
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
Trackbacks are Off
Pingbacks are On
Refbacks are 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/Novell 17 02-08-2005 04:50 PM
Upgrade packages with RPM jackpal Linux - General 1 07-27-2004 02:52 PM


All times are GMT -5. The time now is 09:21 AM.

Main Menu
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
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration