Bug 828354

Summary: mdadm-takeover.service not removed on uninstallation
Product: [Fedora] Fedora Reporter: Miloslav Trmač <mitr>
Component: mdadmAssignee: Jes Sorensen <Jes.Sorensen>
Status: CLOSED ERRATA QA Contact: Fedora Extras Quality Assurance <extras-qa>
Severity: unspecified Docs Contact:
Priority: unspecified    
Version: 17CC: agk, dledford, janina, Jes.Sorensen, mschmidt
Target Milestone: ---   
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2012-07-11 23:53:31 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:

Description Miloslav Trmač 2012-06-04 16:53:37 UTC
Description of problem:
After uninstalling mdadm, a dangling symlink
> /etc/systemd/system/sysinit.target.wants/mdmonitor-takeover.service -> /usr/lib/systemd/system/mdmonitor-takeover.service
is left around, causing systemd to log
? Jun  3 05:53:01 kulicka systemd[1]: Cannot add dependency job for unit mdmonitor-takeover.service, ignoring: Unit mdmonitor-takeover.service failed to load: No such file or directory. See system logs and 'systemctl status mdmonitor-takeover.service' for details.


Version-Release number of selected component (if applicable):
mdadm-3.2.3-6.fc17.x86_64


Additional info:
The %post script adds both mdmonitor and mdmonitor-takeover services, but %preun (and %postun?) do not mention mdmonitor-takeover.

Comment 1 Jes Sorensen 2012-06-12 16:16:26 UTC
mdadm doesn't create this symlink itself, so it doesn't seem quite correct
that we remove it when the package is uninstalled. Seems to be a systemd
issue to me?

Michal?

Comment 2 Michal Schmidt 2012-06-12 18:12:09 UTC
From mdadm.spec:

%post
if [ $1 -eq 1 ] ; then
    /bin/systemctl enable mdmonitor.service mdmonitor-takeover.service >/dev/null 2>&1 || :
fi

Comment 3 Jes Sorensen 2012-06-12 18:49:44 UTC
Michal,

I see - thanks. What is the right way to disable/remove it on uninstall?

We have the following for mdmonitor.service - do I need two equivalent
lines for mdmonitor-takeoever.service?


%preun
if [ $1 = 0 ]; then
    /bin/systemctl --no-reload disable mdmonitor.service > /dev/null 2>&1 || :
    /bin/systemctl stop mdmonitor.service > /dev/null 2>&1 || :
fi

or is systemctl disable mdmonitor-takeover.service enough?

This systemctl fu is all black magic....

Thanks,
Jes

Comment 4 Michal Schmidt 2012-06-12 19:34:15 UTC
> We have the following for mdmonitor.service - do I need two equivalent
> lines for mdmonitor-takeoever.service?

The lines for mdmonitor.service look correct to me. They match the packaging guidelines:
http://fedoraproject.org/wiki/Packaging:ScriptletSnippets#Systemd

Yes, you need to perform the same actions for mdmonitor-takeover.service.
Note that systemctl can operate on more than one unit at a time, so you don't have to add more lines to the script. You can just add mdmonitor-takeover.service to the lines you already have.

> This systemctl fu is all black magic....

These commands are no more magical than "chkconfig --del FOO" and "service FOO stop" were in SysV.

Comment 5 Jes Sorensen 2012-06-13 11:47:32 UTC
Thanks, I'll add that to the next update!

chkconfig is about the same, but I don't know that service command you
are referring to. The normal way to do things in sysv is to use
/etc/rc.d/init.d/<FOO> {stop,start,status,...}

Much easier when one can use the file system to browse things :)

Cheers,
Jes

Comment 6 Michal Schmidt 2012-06-13 13:10:11 UTC
(In reply to comment #5)
> chkconfig is about the same, but I don't know that service command you
> are referring to. The normal way to do things in sysv is to use
> /etc/rc.d/init.d/<FOO> {stop,start,status,...}

This usually worked... except in cases where it did not. /sbin/service was always the better way because at least it tried to provide a clean environment to services. (I learned about the problems of directly running initscripts in bug 588745.)

Comment 7 Fedora Update System 2012-06-26 07:15:28 UTC
mdadm-3.2.5-3.fc17 has been submitted as an update for Fedora 17.
https://admin.fedoraproject.org/updates/mdadm-3.2.5-3.fc17

Comment 8 Fedora Update System 2012-06-26 07:22:33 UTC
mdadm-3.2.5-3.fc16 has been submitted as an update for Fedora 16.
https://admin.fedoraproject.org/updates/mdadm-3.2.5-3.fc16

Comment 9 Fedora Update System 2012-06-26 21:27:38 UTC
Package mdadm-3.2.5-3.fc16:
* should fix your issue,
* was pushed to the Fedora 16 testing repository,
* should be available at your local mirror within two days.
Update it with:
# su -c 'yum update --enablerepo=updates-testing mdadm-3.2.5-3.fc16'
as soon as you are able to.
Please go to the following url:
https://admin.fedoraproject.org/updates/FEDORA-2012-9931/mdadm-3.2.5-3.fc16
then log in and leave karma (feedback).

Comment 10 Fedora Update System 2012-07-11 23:53:31 UTC
mdadm-3.2.5-3.fc17 has been pushed to the Fedora 17 stable repository.  If problems still persist, please make note of it in this bug report.

Comment 11 Fedora Update System 2012-07-11 23:57:16 UTC
mdadm-3.2.5-3.fc16 has been pushed to the Fedora 16 stable repository.  If problems still persist, please make note of it in this bug report.

Comment 12 Janina Sajka 2013-01-18 02:11:23 UTC
Hmmm, seems to still (or again) be a problem on F18. I have -3.2.6-11.x86_64