Bug 19882 - Initscripts update enables network, network-up, partmon & netconsole services when disabled/de-activated, as when system has switched to use NetworkManager
Summary: Initscripts update enables network, network-up, partmon & netconsole service...
Status: RESOLVED FIXED
Alias: None
Product: Mageia
Classification: Unclassified
Component: RPM Packages (show other bugs)
Version: Cauldron
Hardware: All Linux
Priority: release_blocker normal
Target Milestone: Mageia 8
Assignee: Olav Vitters
QA Contact:
URL:
Whiteboard:
Keywords: FOR_ERRATA6
: 27001 (view as bug list)
Depends on:
Blocks:
 
Reported: 2016-12-02 09:17 CET by Jüri Ivask
Modified: 2020-07-28 17:24 CEST (History)
10 users (show)

See Also:
Source RPM: initscripts-9.55-24.mga6.src.rpm; initscripts-9.78-10.mga7.src.rpm; initscripts-9.78-16.mga8.src.rpm
CVE:
Status comment:


Attachments

Description Jüri Ivask 2016-12-02 09:17:21 CET
Description of problem: Initscripts update enables network.service & network-up.service although system has switched to use NetworkManager.

This causes very long startup time.

systemctl disable network.service and systemctl disable network-up.service returns system to normal startup time.


Version-Release number of selected component (if applicable): 9.55-22
Comment 1 Sander Lepik 2016-12-02 09:22:26 CET
I think it's a bug that should be fixed before Mageia 6 is released.

CC: (none) => mageia
Target Milestone: --- => Mageia 6
Assignee: bugsquad => mageia

Comment 2 Samuel Verschelde 2016-12-02 09:32:47 CET
(In reply to Sander Lepik from comment #1)
> I think it's a bug that should be fixed before Mageia 6 is released.

Well assigning it to Colin is maybe not the best way to have it fixed quickly, currently :)

Priority: Normal => High
Assignee: mageia => basesystem
CC: (none) => mageia

Comment 3 Jüri Ivask 2017-02-28 10:22:45 CET
Bug still present in last initscripts update:  initscripts-9.55-23.mga6
Comment 4 Jüri Ivask 2017-03-15 08:10:28 CET
Bug still present in last initscripts update: initscripts-9.55-24.mga6
Comment 5 Ojangu 2017-03-18 19:02:49 CET
Same problem in my Cauldron,not in first time

CC: (none) => jaanus.ojangu

Comment 6 Samuel Verschelde 2017-07-10 15:21:55 CEST
It would be good to add a note about this in the Errata, thus I'm adding the FOR_ERRATA6 keyword.

Once added to https://wiki.mageia.org/en/Mageia_6_Errata please replace FOR_ERRATA6 with IN_ERRATA6.

Keywords: (none) => FOR_ERRATA6

Comment 7 Jüri Ivask 2017-08-02 08:18:46 CEST
Still present in Mageia 6 initscripts-9.55-24.mga6.src.rpm and in Cauldron initscripts-9.55-26.mga7.src.rpm

Source RPM: initscripts-9.55-22.mga6.src.rpm => initscripts-9.55-24.mga6.src.rpm; initscripts-9.55-26.mga7.src.rpm

Comment 8 Sander Lepik 2017-08-02 14:40:07 CEST
I hope it's fixed for cauldron.

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

Comment 9 Rémi Verschelde 2017-08-02 14:41:29 CEST
If it's fixed, I'd like to see it proposed as an update to Mageia 6, as I'm also annoyed by this bug.

Status: RESOLVED => REOPENED
Resolution: FIXED => (none)
Version: Cauldron => 6

Comment 10 Jüri Ivask 2018-10-30 09:44:50 CET
Still present in Cauldron initscripts-9.78-9.mga7...

Target Milestone: Mageia 6 => Mageia 7
Version: 6 => Cauldron
Source RPM: initscripts-9.55-24.mga6.src.rpm; initscripts-9.55-26.mga7.src.rpm => initscripts-9.55-24.mga6.src.rpm; initscripts-9.78-9.mga7.src.rpm

Ulrich Beckmann 2018-10-31 19:43:21 CET

CC: (none) => bequimao.de

Comment 11 Sander Lepik 2019-02-10 15:30:06 CET
I'll set it as a release blocker. More and more users are probably switching to NM nowadays and update to initscripts just screws their installation :/

Priority: High => release_blocker

Comment 12 Ulrich Beckmann 2019-09-28 11:47:56 CEST
Found network.service and network-up.service enabled in a new Mga8 Cauldron. It is an upgrade from a clone of a Mga7 installation. Both services were disabled at origin.
Jüri Ivask 2019-10-04 10:39:37 CEST

Source RPM: initscripts-9.55-24.mga6.src.rpm; initscripts-9.78-9.mga7.src.rpm => initscripts-9.55-24.mga6.src.rpm; initscripts-9.78-10.mga7.src.rpm; initscripts-9.78-11.mga8.src.rpm
Target Milestone: Mageia 7 => Mageia 8

Comment 13 Bit Twister 2019-10-05 23:19:40 CEST
(In reply to Ulrich Beckmann from comment #12)
> Found network.service and network-up.service enabled in a new Mga8 Cauldron.
> It is an upgrade from a clone of a Mga7 installation. Both services were
> disabled at origin.

It is a systemd standard procedure to enable service, 
 even though you disabled it, upon new systemd release.

You have to systemctl mask unit/item_here to disable systemd from enabling
it upon new systemd release.
Comment 14 Morgan Leijström 2019-10-06 17:34:45 CEST
Should we write more about this in Mageia 7 Release notes= I only find same info in

https://wiki.mageia.org/en/Mageia_7_Release_Notes#Enlightenment

https://wiki.mageia.org/en/Mageia_7_Errata#GNOME


But i think it is not general nor obvious enough?

CC: (none) => fri

Ulrich Beckmann 2020-01-21 18:57:25 CET

See Also: (none) => https://bugs.mageia.org/show_bug.cgi?id=26035

Jüri Ivask 2020-01-21 19:54:47 CET

Source RPM: initscripts-9.55-24.mga6.src.rpm; initscripts-9.78-10.mga7.src.rpm; initscripts-9.78-11.mga8.src.rpm => initscripts-9.55-24.mga6.src.rpm; initscripts-9.78-10.mga7.src.rpm; initscripts-9.78-13.mga8.src.rpm

Comment 15 Ulrich Beckmann 2020-04-26 16:57:54 CEST
I have  now 
initscripts-9.78-14.mga8
installed. No breakage of NetworkManager occurred. The issue seems to be fixed.

Ulrich
Comment 16 Ulrich Beckmann 2020-04-26 17:03:15 CEST
(In reply to Ulrich Beckmann from comment #15)
> I have  now 
> initscripts-9.78-14.mga8
> installed. No breakage of NetworkManager occurred. The issue seems to be
> fixed.
> 
> Ulrich

Sorry, wrong info.
I ran systemctl disable network ... after the upgrade.

Ulrich
Comment 17 Jüri Ivask 2020-05-26 10:26:39 CEST
With this I give up. To run NetworkManager some another distribution is a way to go...

Source RPM: initscripts-9.55-24.mga6.src.rpm; initscripts-9.78-10.mga7.src.rpm; initscripts-9.78-13.mga8.src.rpm => initscripts-9.55-24.mga6.src.rpm; initscripts-9.78-10.mga7.src.rpm; initscripts-9.78-16.mga8.src.rpm

Comment 18 Nicolas Lécureuil 2020-05-26 10:31:55 CEST
Olivier, do you think you can take a look to this ?

CC: (none) => mageia, mageia

Comment 19 Lewis Smith 2020-07-26 11:31:34 CEST
*** Bug 27001 has been marked as a duplicate of this bug. ***

CC: (none) => guillomovitch

Comment 20 Lewis Smith 2020-07-26 11:39:16 CEST
See the duplicate bug:
"the posttrans scriptlet force activation of the following services, whatever their current state:
- network
- network-up
- partmon
- netconsole
Updating the package should honour current service activation setting, and not reactive unwanted services."

Can this not be fixed? It is an old issue causing increasing unrest.

Summary: Initscripts update enables network & network-up services although system has switched to use NetworkManager => Initscripts update enables network, network-up, partmon & netconsole services when disabled/de-activated, as when system has switched to use NetworkManager

Comment 21 Olav Vitters 2020-07-26 13:01:36 CEST
From initscripts.spec:
> # The restart part in the real _post_service doesn't work with netfs and isn't needed
> # for other scripts
> %define _mypost_service() /sbin/chkconfig --add %{1};
[..]
> if [ $1 -eq 1 ]; then
> 
> %_mypost_service network
> 
> %_mypost_service network-up
> 
> fi
[..]
> %_mypost_service partmon
> 
> %_mypost_service netconsole

I'm working on cleaning up the Mageia initscripts fork. Seems above bit from the spec file is the cause; taking the bug.

I also fixed a few bugs and was worried this was a new bug. It's sort of nice to know I didn't cause any regressions.

Status: REOPENED => ASSIGNED
Assignee: basesystem => olav
CC: (none) => olav

Comment 22 Olav Vitters 2020-07-26 15:14:22 CEST
The comment from the initscripts.spec file doesn't apply anymore. When the comment was added there was an netfs service as well. However, the bug will not be fixed by switching over to the %_post_service script. It'll still call pretty much the same command, then it seems it'll restart network, network-up, partmon and netconsole. So in brief: I cannot use %_post_service, it'll be even more buggy.

The upstream/Fedora initscripts make it possible to uninstall these network scripts (they have them in a separate package). Aside from that it also uses the alternative system. So to properly fix this I think Mageia should be closer aligned for how Fedora dealt with this.

Fixing this is quite a bit more involved than it should be. Our initscripts are a fork of Fedora. The fork has quite a lot of old stuff there. It's not easy to figure out what is ancient and what is needed. I wanted to make the switch to a new initscripts easier by releasing a lot of intermediate initscripts versions. However, that'll trigger this bug each and every time.

I need to check if can add a temporary hack.
Comment 23 Guillaume Rousse 2020-07-26 20:30:02 CEST
> I wanted to make the switch to a new initscripts easier by releasing a lot of intermediate initscripts versions. However, that'll trigger this bug each and every time.
No need to waste your time with a temporary hack. We are living with the problem since several years already, it doesn't really matter if the problem is triggered a few times more, as long it get fixed in the end.
Comment 24 Morgan Leijström 2020-07-26 20:42:23 CEST
Could it be developed and tested incrementally, then we test if it is possible to jump directly from now current to fully fixed, and then release that?
Comment 25 Olav Vitters 2020-07-27 10:33:25 CEST
I think I see the cause.

The %_mypost_service macro is called within a %posttrans

This change was made to fix bug 23482. Basically: using %post too much caused bugs during install time. The order of the various scripts are documented here:
  https://docs.fedoraproject.org/en-US/packaging-guidelines/Scriptlets/

There's probably loads of commits, but I see e.g.:
http://svnweb.mageia.org/packages?view=revision&revision=1237259
http://svnweb.mageia.org/packages?view=revision&revision=1237259

From the packaging guideline documentation:
> When scriptlets are called, they will be supplied with an argument. This
> argument, accessed via $1 (for shell scripts) is the number of packages of this
> name which will be left on the system when the action completes, except for
> %pretrans and %posttrans which are always run with $1 as 0.

From the initscripts spec file:
> if [ $1 -eq 1 ]; then
> 
> %_mypost_service network
> 
> %_mypost_service network-up
> 
> fi

At one point various attempts were made to fix this bug and only call chkconfig --add network (and network-up) on initial installation, not on upgrade. This is usually done by code I quoted above ($1 -eq 1). But due to changing the %post to a %posttrans there's no ability to see (in %posttrans) if initscripts was upgraded or not ($1 will always be equal to 1). I cannot move the chkconfig -add code from %posttrans to %post as that will likely reintroduce bug 23482.

Alternatively, I think another "solution" is to do something such as:
> %post
> if [ $1 -eq 1 ]; then
>   mkdir -p -m 700 "/run/rpm-script-hacks/%{name}.install"
> fi
> 
> %posttrans
> if [ -d "/run/rpm-script-hacks/%{name}.install" ]; then
>   %_mypost_service network
>   %_mypost_service network-up
>   rmdir "/run/rpm-script-hacks/%{name}.install"
> fi

Plus move partmon and netconsole inside above check as well.

I need to check if such a "solution" was ever used before and reuse that logic.

There's also complaints about "mandrake_everytime" being re-enabled every time. One thing at a time ;)
Comment 26 Martin Whitaker 2020-07-27 11:59:25 CEST
A similar "solution" is used in the grub2 package. I think I used it somewhere else, but can't remember where now.

CC: (none) => mageia

Comment 27 Olav Vitters 2020-07-27 13:55:00 CEST
Hi Martin,

Thanks, unfortunately I saw that too late. I spend a while using grep and so on.

I found a various other cases where:
- similar workarounds are used
- a similar bug exists (ouch)

To see the other problems I suggest from the 'all packages' directory:
  rg '%posttrans' -A10 --color always --heading |less -R

You'll need ripgrep for this, though it's not unique to ripgrep (I like the speed and way it outputs the matches).

Regarding initscripts and this bug:
I've added something similar to what I found in roundcubemail-plugins-kolab. I've added the fix in initscripts-9.78-19.mga8. I tested the logic with a custom package. I didn't test initscripts-9.78-19.mga8 myself (now doubting myself about that!).

I'm going to mark it fixed. Please reopen if there are problems.

Resolution: (none) => FIXED
Status: ASSIGNED => RESOLVED

Comment 28 Guillaume Rousse 2020-07-27 17:46:04 CEST
Actually, I'd rather question the usefulness of activating any service at installation time for this specific package. The whole justification of this policy ("if a user install package X, it is probably intending to use it") makes sense for specialized package, with a single service, such as a database server, for instance, but far less for such generic set of loosely related services as initscripts. Especially as initscripts is a mandatory depdency of basesystem, and is never intentionally installed.

So, I'd suggest simplifying the problem, ie not activating any service here, and let user manage their system state using their usual configuration tools (drakxservice, chkconfig, whathever).
Comment 29 Olav Vitters 2020-07-28 17:24:50 CEST
(In reply to Guillaume Rousse from comment #28)
> Actually, I'd rather question the usefulness of activating any service at
> installation time for this specific package. The whole justification of this

The only bits that really get (forcefully) activated is anything sysvinit. An systemd service relies on the preset functionality. Basically: which service should be started on install time depends on some text files. So the policy isn't coded in the spec file, it's somewhere else. So then a user/admin/distro can easily change the policy. The preset functionality was broken due to this bug though.

Fedora split off a lot of the services into the right packages. I'm going to replicate those changes. It seems best to first replicate moving some files around (and getting feedback on that), before actually switching to the latest initscripts.

For sysvinit the scriptlet seems to always re-enable the service. Stuff that is sysvinit: network, network-up, partmon, netconsole. Some of this might be better off in their own packages. But that's a dev decision.

> So, I'd suggest simplifying the problem, ie not activating any service here,
> and let user manage their system state using their usual configuration tools
> (drakxservice, chkconfig, whathever).

These services do not get magically activated by the installer AFAIK. It'll likely break the whole networking bits. Though maybe I could use "$DURING_INSTALL".

This discussion is more for the dev mailing list though. It's probably the way that it is for a reason, so before changing anything I'd rather have someone confirm. The initscripts maintainer shows as Colin. He hasn't been around in years.

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