Bug 7611 - systemd detection in rpm-helper no longer works
Summary: systemd detection in rpm-helper no longer works
Status: RESOLVED OLD
Alias: None
Product: Mageia
Classification: Unclassified
Component: RPM Packages (show other bugs)
Version: Cauldron
Hardware: All Linux
Priority: Normal normal
Target Milestone: Mageia 3
Assignee: Colin Guthrie
QA Contact:
URL:
Whiteboard:
Keywords:
: 7610 7612 7613 7614 7615 7616 (view as bug list)
Depends on:
Blocks:
 
Reported: 2012-09-28 15:34 CEST by Thierry Vignaud
Modified: 2014-01-14 15:42 CET (History)
6 users (show)

See Also:
Source RPM: systemd
CVE:
Status comment:


Attachments

Description Thierry Vignaud 2012-09-28 15:34:42 CEST
ntp postun script is bogus:

# urpme ntp
removing ntp-4.2.6p5-7.mga3.x86_64
Usage: service -[Rfshv] SERVICE ARGUMENTS
        -f|--full-restart:      Do a fullrestart of the service.
        -R|--full-restart-all:  Do a fullrestart of all running services.
        -s|--status-all:        Print a status of all services.
        --ignore-dependencies:  Do not start required systemd services
        --skip-redirect:        Do not redirect to systemd
        -d|--debug:             Launch with debug.
        -h|--help:              This help.
error reading information on service ntpd: No such file or directory
removing package ntp-4.2.6p5-7.mga3.x86_64
Manuel Hiebel 2012-09-28 22:25:31 CEST

Keywords: (none) => Junior_job
CC: (none) => guillomovitch, luigiwalser
Target Milestone: --- => Mageia 3

Comment 1 David Walser 2012-09-28 22:35:16 CEST
Actually it's preun, not postun.

%preun
%_preun_service ntpd

Why is this error happening?

CC: (none) => mageia

Comment 2 Barry Jackson 2012-09-29 11:29:57 CEST
It's happening with many packages - I mentioned it to Col a couple of days ago on IRC:-

Sep 25 23:03:30 <barjac>	coling: Any ideas on this during uninstall of packages with units (not only munin): removing munin-node-2.0.6-1.mga3.noarch - error reading information on service munin-node: No such file or directory ?
Sep 25 23:04:11 <coling>	barjac, of the top of my head, no.
Sep 25 23:04:27 <coling>	I'm guessing it comes from the daemon-reload file trigger tho'.
Sep 25 23:05:01 <barjac>	coling: OK - it happens with zoneminder too

CC: (none) => zen25000

Comment 3 David Walser 2012-09-29 16:15:19 CEST
Well the error comes from the /usr/share/rpm-helper/del-service script, and it needs to determine whether it's running under systemd or sysvinit.  It sounds like the recent systemd update has that detection broken and it thinks it's running under sysvinit and is trying to stop a SysV service with the service command rather than stopping a systemd service with systemctl.

The detection code is:
/bin/mountpoint -q /sys/fs/cgroup/systemd

Which gives a 0 exit status for me on Mageia 2.

Keywords: Junior_job => (none)
Source RPM: ntp-4.2.6p5-7.mga3 => systemd

David Walser 2012-09-29 16:15:57 CEST

Summary: ntp postun script is bogus: => systemd detection in rpm-helper no longer works

Thierry Vignaud 2012-09-29 17:01:48 CEST

Assignee: bugsquad => mageia

Comment 4 Thierry Vignaud 2012-09-29 17:02:24 CEST
*** Bug 7616 has been marked as a duplicate of this bug. ***
Comment 5 Thierry Vignaud 2012-09-29 17:02:28 CEST
*** Bug 7615 has been marked as a duplicate of this bug. ***
Comment 6 Thierry Vignaud 2012-09-29 17:02:31 CEST
*** Bug 7614 has been marked as a duplicate of this bug. ***
Comment 7 Thierry Vignaud 2012-09-29 17:02:41 CEST
*** Bug 7613 has been marked as a duplicate of this bug. ***
Comment 8 Thierry Vignaud 2012-09-29 17:02:48 CEST
*** Bug 7612 has been marked as a duplicate of this bug. ***
Comment 9 Thierry Vignaud 2012-09-29 17:02:54 CEST
*** Bug 7610 has been marked as a duplicate of this bug. ***
Comment 10 Sander Lepik 2012-09-29 17:26:08 CEST
Well, it should be easy fix then as sysvinit is dead for mga3 anyway :)

CC: (none) => sander.lepik

Comment 11 Colin Guthrie 2012-09-29 17:32:37 CEST
I'm confused, /bin/mountpoint -q /sys/fs/cgroup/systemd is still giving me a 0 exit status on Cauldron...

So I'm confused as to why this has broken :s
Comment 12 David Walser 2012-09-29 17:34:34 CEST
Well yes then, that is quite strange indeed.  Perhaps it doesn't matter, because as Sander said the sysvinit logic could be stripped out of the rpm-helper scripts and then it wouldn't matter anyway.
Comment 13 Colin Guthrie 2012-09-29 17:37:53 CEST
Well, I'm not 100% sure it can be stripped out as we will still support upgrading via urpmi from mga2. As mga2 support sysvinit boots, we can't guarantee that the urpmi upgrade is happening under a systemd boot and thus when services are being restarted during the upgrade, we should really handle sysvinit restarts gracefully. So I'm not sure we should tidy it up too much right now.
Comment 14 David Walser 2012-09-29 17:40:25 CEST
Oh that's right, and as we've discussed in the past, there's no guarantee rpm-helper gets upgraded early in the upgrade procedure, so the old script needs to work.
Comment 15 Colin Guthrie 2012-09-29 17:43:12 CEST
Even if rpm-helper is upgraded early, it still has to work on the current sysvinit boot even although systemd will be used after the post-upgrade reboot into mga3.
Comment 16 Colin Guthrie 2012-09-29 17:50:33 CEST
OK, so back to the actual bug, I can add an if/else that hides the "error reading information on service ntpd: No such file or directory" error, but it probably won't actually work here as the mountpoint check is failing.

Is the error happening in a chrooted environment with /sys not bind mounted to the host? If so then I can understand it as it won't be a mountpoint and thus systemd won't be detected.

Thierry can you confirm you are seeing this on current cauldron booted normally? I can only reproduce the "error reading information..." part of it.

Also David can you confirm that the mountpoint check is failing for you on cauldron boot? It should return 0 just as in mga2.
Comment 17 David Walser 2012-09-29 17:56:11 CEST
I'm not running Cauldron.  I was just looking at the script, and that's the only logical explanation for what's happening.
Comment 18 Thierry Vignaud 2012-09-29 22:49:48 CEST
I was in a chrooted cauldron
Comment 19 Barry Jackson 2012-09-29 23:42:16 CEST
In real system:
[baz@jackodesktop ~]$ /bin/mountpoint -q /sys/fs/cgroup/systemd
[baz@jackodesktop ~]$ echo $?
0
Comment 20 Barry Jackson 2012-09-30 00:00:01 CEST
In a second clean Cauldron minimal LXDE system :-
[root@localhost baz]# urpme zoneminder
removing zoneminder-1.25.0-17.mga3.tainted.x86_64
error reading information on service zoneminder: No such file or directory
removing package zoneminder-1.25.0-17.mga3.tainted.x86_64
[root@localhost baz]# /bin/mountpoint -q /sys/fs/cgroup/systemd
[root@localhost baz]# echo $?
0
Comment 21 David Walser 2012-09-30 01:51:10 CEST
OK, the error Barry is talking about is a different one than what Thierry was.

I'm guessing Barry's error is coming from this line of the script:
    [ -n "$srv" ] && /sbin/chkconfig --del $srv

Barry, try *not* uninstalling something but just running chkconfig --del on its service instead and see if you get the same error.
Comment 22 David Walser 2012-09-30 02:03:30 CEST
Actually I'm not guessing, that error message definitely comes from chkconfig.

It should have been doing this all along, as even chkconfig on Mageia 1 gives that error when you --del a non-existent service (at least one that doesn't have a SysV init script).

It could be that this error is just starting to show up as we drop SysV init scripts from packages.

The code in del-service when it calls chkconfig should probably have 2> /dev/null
Comment 23 Colin Guthrie 2012-09-30 03:13:44 CEST
It's definitely showing up due to removing sysvinit scripts. This part of the error can be fixed with a simple if/else statement as I mentioned above in comment 16.

So this should be an easy one to solve. The problems resulting from the chrooted setup are not new and will have been there since pre-mga2 days, so probably not something new to worry about. I'll push an updated rpm-helper tomorrow.
Comment 24 David Walser 2012-09-30 03:43:42 CEST
I don't know about an if/else, at least if you're referring to those two lines where it removes service links with both systemctl and chkconfig unconditionally.  The script can be called with a service name and a list of additional systemd units to remove, and if the main service itself is a SysV init script, it's appropriate to run both commands.  I suppose you could add some code to detect if that's actually the case.
Comment 25 Colin Guthrie 2012-10-01 00:35:51 CEST
Well just to explain the logic, the reason to unconditionally run both commands is actually to deal with the case where both a native systemd and sysvinit script exists.

My original logic was that when we remove a package, if we only ran the systemctl command, it would only take care of the native units if one was found (it will automatically call chkconfig if a native unit does not exist), thus potentially leaving the sysvinit script enabled and thus some hanging symlinks left behind.

So that's why I called both commands. I've now modified it slightly to only call chkconfig if the rc.d script exists which should avoid the problem.

The chroot issue is still there, but then as it's not new I'm not sure what we should do here... I'd rather a switch to assuming systemd and some way to detect sysvinit in use, but I can't think of a way to do this easily...
Comment 26 Atilla ÖNTAŞ 2013-11-29 14:54:58 CET
After a year, does this bug still exist in current Cauldron or Mageia 3?

CC: (none) => tarakbumba

Comment 27 Atilla ÖNTAŞ 2014-01-14 15:42:38 CET
No replies. Then i close this bug report. If you believe that it occurs in current Cauldron or Mageia 3 with updates installed then do not hesitate to reopen.

Status: NEW => RESOLVED
Resolution: (none) => OLD


Note You need to log in before you can comment on or make changes to this bug.