Bug 733537

Summary: needs-restarting fails on some machines
Product: [Fedora] Fedora Reporter: Joe Zeff <joe>
Component: yum-utilsAssignee: Seth Vidal <skvidal>
Status: CLOSED WONTFIX QA Contact: Fedora Extras Quality Assurance <extras-qa>
Severity: medium Docs Contact:
Priority: unspecified    
Version: 15CC: balay, james.antill, joe, maxamillion, petrielmjr, pmatilai, tim.lauridsen
Target Milestone: ---   
Target Release: ---   
Hardware: Unspecified   
OS: Linux   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2012-08-07 18:36:54 UTC Type: ---
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:

Description Joe Zeff 2011-08-25 23:04:20 UTC
Description of problem:
The script is supposed to give a list of programs that were running when they were updated and need restarting to get the newest version running.

Version-Release number of selected component (if applicable):

yum-utils-1.1.28-1

How reproducible:

Every time

Steps to Reproduce:
1.Use yum or yumex to update your system,including updates to running programs.
2.Run needs-restarting in a terminal, either as a regular user or as root.
  
Actual results:

No output

Expected results:

A list of programs that need to be restarted.

Additional info:

I have two computers running Fedora 14 and this happens on both of them every time I try it.

Comment 1 Satish Balay 2011-08-26 14:26:14 UTC
I would run needs-restarting [as root] after each 'yum update' on my F15[x86_64] install, and never saw any output from it.

Comment 2 Lester Petrie 2011-08-26 16:15:51 UTC
I also am running F15 (x86_64), desktop is KDE. I run needs-restarting after using yumex to update, both as root and as user.  It never produces any output for me.

Comment 3 seth vidal 2011-08-26 21:39:56 UTC
okay I have a patch which HELPS this problem dramatically but there are some corner cases (only on fedora, sadly) where solving it will be a challenge.

http://yum.baseurl.org/gitweb?p=yum-utils.git;a=commitdiff;h=c53740ce33d39e5bade9b0f0af8385c1d654010b

The edge cases:
- a running program is from a package which was updated and which the original package it was installed from is no longer available in any of the repository metadata
- a running program was obsoleted and the files were not replaced by anything - where the deleted files are not a binary but some library.

grab a newer needs-restarting from yum-utils git and give it a try, please.

Comment 4 Joe Zeff 2011-08-26 21:59:32 UTC
I doubt that the edge cases will be too important, considering that (for me, at least) the current version of needs-restarting missed firefox, thunderbird and a kernel update.  Please post a pointer to the new version so I can try it, as I'm not familiar with git.

Comment 5 Satish Balay 2011-08-27 15:50:48 UTC
I've tried the following [on F15 x86_64]- expecting some output - but saw none.

wget -o needs-restarting "http://yum.baseurl.org/gitweb?p=yum-utils.git;a=blob_plain;f=needs-restarting.py;h=20415e61582ab77bc4ba0b23f9624e916e5ede17;hb=c53740ce33d39e5bade9b0f0af8385c1d654010b"
chmod a+x needs-restarting
yum downgrade gnome-shell
./needs-restarting

Comment 6 Joe Zeff 2011-08-27 19:23:13 UTC
I tried using that wget command to replace needs-restarting (as root) and found that the chmod wasn't needed.  I didn't try the yum downgrade because I don't use gnome-shell, but tried needs-restarting to see what happened:

[joe@barrayar Desktop]$ needs-restarting
/usr/bin/needs-restarting: line 1: --2011-08-27: command not found
/usr/bin/needs-restarting: line 2: Resolving: command not found
/usr/bin/needs-restarting: line 3: 140.211.167.207: command not found
/usr/bin/needs-restarting: line 3: :80...: command not found
/usr/bin/needs-restarting: line 3: Connecting: command not found
/usr/bin/needs-restarting: line 4: HTTP: command not found
/usr/bin/needs-restarting: line 5: Length:: command not found
/usr/bin/needs-restarting: line 6: Saving: command not found
/usr/bin/needs-restarting: line 8: 0K: command not found
/usr/bin/needs-restarting: line 10: syntax error near unexpected token `('
/usr/bin/needs-restarting: line 10: `2011-08-27 11:00:01 (107 KB/s) - “gitweb?p=yum-utils.git;a=blob_plain;f=needs-restarting.py;h=20415e61582ab77bc4ba0b23f9624e916e5ede17;hb=c53740ce33d39e5bade9b0f0af8385c1d654010b” saved [5643]'

[joe@barrayar Desktop]$ cat /usr/bin/needs-restarting
--2011-08-27 11:00:01--  http://yum.baseurl.org/gitweb?p=yum-utils.git;a=blob_plain;f=needs-restarting.py;h=20415e61582ab77bc4ba0b23f9624e916e5ede17;hb=c53740ce33d39e5bade9b0f0af8385c1d654010b
Resolving yum.baseurl.org... 140.211.167.207
Connecting to yum.baseurl.org|140.211.167.207|:80... connected.
HTTP request sent, awaiting response... 200 OK
Length: unspecified [text/plain]
Saving to: “gitweb?p=yum-utils.git;a=blob_plain;f=needs-restarting.py;h=20415e61582ab77bc4ba0b23f9624e916e5ede17;hb=c53740ce33d39e5bade9b0f0af8385c1d654010b”

     0K .....                                                   107K=0.05s

2011-08-27 11:00:01 (107 KB/s) - “gitweb?p=yum-utils.git;a=blob_plain;f=needs-restarting.py;h=20415e61582ab77bc4ba0b23f9624e916e5ede17;hb=c53740ce33d39e5bade9b0f0af8385c1d654010b” saved [5643]

Tried again, putting everything in ~/Downloads and got the same result.  I *think* the -o is wrong.  Tried again and got the same thing.  Please advise.

Comment 7 Joe Zeff 2011-08-27 19:30:44 UTC
Update: the file did get downloaded, but with a weird name that I didn't expect; I found it via Thunar and got things straightened out.  I'm not sure if it works, yet, but we'll see next time there's an update.

Comment 8 Satish Balay 2011-08-28 03:16:30 UTC
> I *think* the -o is wrong.  Tried again and got the same thing.  Please advise.

Sorry - my mistake. The wget option is -O. [and not -o]

Comment 9 seth vidal 2011-08-29 15:48:06 UTC
(In reply to comment #5)
> I've tried the following [on F15 x86_64]- expecting some output - but saw none.
> 
> wget -o needs-restarting
> "http://yum.baseurl.org/gitweb?p=yum-utils.git;a=blob_plain;f=needs-restarting.py;h=20415e61582ab77bc4ba0b23f9624e916e5ede17;hb=c53740ce33d39e5bade9b0f0af8385c1d654010b"
> chmod a+x needs-restarting
> yum downgrade gnome-shell
> ./needs-restarting



Satish,
 Can you do the following:

for one of the processes you expect to have been marked as 'needing to be restarted' please cd /proc/$the_pid/

and attach the output of grep fd: smaps

thanks

Comment 10 Satish Balay 2011-08-29 16:12:19 UTC
(In reply to comment #9)

> for one of the processes you expect to have been marked as 'needing to be
> restarted' please cd /proc/$the_pid/
> 
> and attach the output of grep fd: smaps

I retried 'yum downgrade gnome-shell' - assuming gnome-shell process would need restarting. But 'grep' gave no output.

[root@asterix ~]# grep fd: /proc/*/smaps
[root@asterix ~]# 


But I guess - you might be looking for the following



[root@asterix ~]# cd /proc/2067
[root@asterix 2067]# grep deleted smaps 
00400000-00404000 r-xp 00000000 08:01 131576                             /usr/bin/gnome-shell (deleted)
00603000-00604000 rw-p 00003000 08:01 131576                             /usr/bin/gnome-shell (deleted)
7f502878a000-7f502878b000 rw-s 00000000 00:04 31833                      /drm mm object (deleted)
7f502878b000-7f502878c000 rw-s 00000000 00:04 31831                      /drm mm object (deleted)

.....

Comment 11 seth vidal 2011-08-29 16:22:37 UTC
I see the format of smaps has changed.

Comment 12 seth vidal 2011-08-29 17:11:10 UTC
If you could try this needs-restarting from:

http://yum.baseurl.org/gitweb?p=yum-utils.git;a=blob_plain;f=needs-restarting.py;hb=81f18617756866700c86ae34989edc7d0e71478d


and report back.
thanks

Comment 13 Joe Zeff 2011-08-29 17:26:18 UTC
The program seemed to "go to sleep," and after a while I killed the terminal.  However, top, in another terminal, showed that it was still running even after the terminal was closed.  As I've never had it work correctly, I don't know how long to wait; seconds, minutes?

Comment 14 Satish Balay 2011-08-29 17:41:11 UTC
(In reply to comment #12)
> If you could try this needs-restarting from:
> 
> http://yum.baseurl.org/gitweb?p=yum-utils.git;a=blob_plain;f=needs-restarting.py;hb=81f18617756866700c86ae34989edc7d0e71478d
> 
> 
> and report back.


Appears to work.

[after yum downgrade gnome-shell]

[root@asterix ~]# ./needs-restarting 
2010 : /usr/bin/gnome-shell 

BTW: looks like 'fd:' is now changed to '08:' [not sure if its is universally true for all installs..]

Comment 15 seth vidal 2011-08-29 17:42:30 UTC
let me guess you downloaded it and ran it directly from the console?

or did you run it w/bash?

I suspect your mouse pointer changed when you run it.

please run it as:

python ./needs-restarting.py

do not run it directly or bash will be the interpreter and the 'import' command will run the command 'import'

Comment 16 seth vidal 2011-08-29 17:49:07 UTC
(In reply to comment #14)

> 
> Appears to work.
> 
> [after yum downgrade gnome-shell]
> 
> [root@asterix ~]# ./needs-restarting 
> 2010 : /usr/bin/gnome-shell 
> 
> BTW: looks like 'fd:' is now changed to '08:' [not sure if its is universally
> true for all installs..]

fd: is not 08: all the time - it is 09: on other systems and, I suspect it will change so I changed the script to look for '/' and then exclude items which are obviously not valid (things starting with '00:')

Comment 17 Joe Zeff 2011-08-29 18:34:10 UTC
OK,going to the appropriate directory and running the program through python (and not touching the computer until it finished) told me that my flash plugin and firefox need restarting, after about two minutes.  Running it again, without invoking python, got the same results, a tad faster.  We seem to have a winner, here.  Thanx for the prompt response.

Comment 18 seth vidal 2011-08-29 18:45:11 UTC
2 minutes? That is a long time for this to run.

Can you run:

time python ./needs-restarting.py

and include the output

it shouldn't be 2 minutes.

That should only happen if it has to download metadata.

Comment 19 Joe Zeff 2011-08-29 19:01:11 UTC
The long delay was only the first time; it works quite quickly now.  Your thought about it needing to download metadata the first time was probably all it was.

Comment 20 Joe Zeff 2011-08-29 23:02:02 UTC
For further checking, I just got home from house sitting and tried the new version on my desktop, twice:

[joe@khorlia Download]$ time ./needs-restarting
2099 : /usr/lib/firefox-3.6/firefox 

real	4m8.398s
user	0m52.144s
sys	0m9.700s
[joe@khorlia Download]$ time ./needs-restarting
2099 : /usr/lib/firefox-3.6/firefox 

real	0m18.827s
user	0m8.421s
sys	0m1.855s
[joe@khorlia Download]$ 

It's quite possible that the difference was downloading metadata.  Again, thanx for getting this corrected.

Comment 21 Fedora End Of Life 2012-08-07 18:36:57 UTC
This message is a notice that Fedora 15 is now at end of life. Fedora
has stopped maintaining and issuing updates for Fedora 15. It is
Fedora's policy to close all bug reports from releases that are no
longer maintained. At this time, all open bugs with a Fedora 'version'
of '15' have been closed as WONTFIX.

(Please note: Our normal process is to give advanced warning of this
occurring, but we forgot to do that. A thousand apologies.)

Package Maintainer: If you wish for this bug to remain open because you
plan to fix it in a currently maintained version, feel free to reopen
this bug and simply change the 'version' to a later Fedora version.

Bug Reporter: Thank you for reporting this issue and we are sorry that
we were unable to fix it before Fedora 15 reached end of life. If you
would still like to see this bug fixed and are able to reproduce it
against a later version of Fedora, you are encouraged to click on
"Clone This Bug" (top right of this page) and open it against that
version of Fedora.

Although we aim to fix as many bugs as possible during every release's
lifetime, sometimes those efforts are overtaken by events. Often a
more recent Fedora release includes newer upstream software that fixes
bugs or makes them obsolete.

The process we are following is described here:
http://fedoraproject.org/wiki/BugZappers/HouseKeeping