Bug 895447 - yast2 lan leaves part of NetworkManager running
Summary: yast2 lan leaves part of NetworkManager running
Status: RESOLVED FIXED
: 893678 902771 (view as bug list)
Alias: None
Product: openSUSE Tumbleweed
Classification: openSUSE
Component: YaST2 (show other bugs)
Version: 201409*
Hardware: x86-64 openSUSE 13.2
: P2 - High : Normal (vote)
Target Milestone: ---
Assignee: Michal Filka
QA Contact: Jiri Srain
URL: https://trello.com/c/v0Z2A8sJ
Whiteboard:
Keywords:
Depends on:
Blocks: 893678
  Show dependency treegraph
 
Reported: 2014-09-06 04:23 UTC by Bernhard Wiedemann
Modified: 2019-02-11 10:59 UTC (History)
11 users (show)

See Also:
Found By: Development
Services Priority:
Business Priority:
Blocker: ---
Marketing QA Status: ---
IT Deployment: ---


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Bernhard Wiedemann 2014-09-06 04:23:21 UTC
on Factory 20140901
when using yast2 lan to switch from NetworkManager to wicked,
it tries to stop NetworkManager, but leaves its dhclient process around.

in systemctl it all looks good:

# before
> systemctl status NetworkManager.service
NetworkManager.service - Network Manager
   Loaded: loaded (/usr/lib/systemd/system/NetworkManager.service; enabled)
   Active: active (running) since Sat 2014-09-06 06:12:32 CEST; 33s ago
 Main PID: 2239 (NetworkManager)
   CGroup: /system.slice/NetworkManager.service
           ├─2239 /usr/sbin/NetworkManager --no-daemon
           └─2510 /sbin/dhclient -d -sf /usr/lib/nm-dhcp-helper -pf /var/run/...

# after
> systemctl status NetworkManager.service                 
NetworkManager.service - Network Manager
   Loaded: loaded (/usr/lib/systemd/system/NetworkManager.service; disabled)
   Active: inactive (dead) since Sat 2014-09-06 06:13:39 CEST; 31s ago
 Main PID: 2239 (code=exited, status=0/SUCCESS)

# yet there is still this process left:
> ps ax|grep -e Netw -e nm-
 2510 ?        S      0:00 /sbin/dhclient -d -sf /usr/lib/nm-dhcp-helper -pf /var/run/dhclient-enp1s0.pid -lf /var/lib/NetworkManager/dhclient-9e24fd05-237d-44d1-9352-af334d569f57-enp1s0.lease -cf /var/lib/NetworkManager/dhclient-enp1s0.conf enp1s0

and I guess this leftover process can make trouble for some people 
who will then need to reboot, before everything is right
Comment 1 Dominique Leuenberger 2014-09-30 21:19:43 UTC
NetworkManager.service contains:

# NM doesn't want systemd to kill its children for it
KillMode=process

this obviously is the reason for dhclient to stick around... question would be why this was decided... will inquire about the full rationale.
Comment 2 Marius Tomaschewski 2014-09-30 21:22:52 UTC
This is quite important to not have multiple network services / dhcp clients
running at same time. They conflict with each other -- not other because they
try to configure the same interfaces but also: one client sends message, the
other gets the responses (e.g. ipv6 multicasts).

See also: https://bugzilla.suse.com/show_bug.cgi?id=893678#c17
Comment 3 Marius Tomaschewski 2014-09-30 21:24:56 UTC
(In reply to Dominique Leuenberger from comment #1)
> NetworkManager.service contains:
> 
> # NM doesn't want systemd to kill its children for it
> KillMode=process

Ah... thanks -- this explains a lot :-)

> this obviously is the reason for dhclient to stick around... question would
> be why this was decided... will inquire about the full rationale.

Thanks!
Comment 4 Dominique Leuenberger 2014-09-30 21:28:10 UTC
http://cgit.freedesktop.org/NetworkManager/NetworkManager/commit/data/NetworkManager.service.in?id=1d89bc0004ec27fbc0c89f17861118c78d7eeab5 and the referenced bug (https://bugzilla.redhat.com/show_bug.cgi?id=876218#c49) have a very nice story why NM is not tearing down the network on 'systemctl stop NetworkManager'

=> on a shutdown, if you have a NFS mounted root, the root 'disappears' on you and the shutdown hangs...
Comment 5 Marius Tomaschewski 2014-09-30 21:36:38 UTC
I'd guess the reason for KillMode=process was the following:

On update, you want to restart NetworkManager, but not break the network
connectivity if possible [and thus probably the update].

A SIGTERM sent to dhclient would cause that it deconfigure the interface,
except it is stopped using "dhclient -x ifname" or kill -SIGKILL.

I'd say, we can reassign this bug to NetworkManager to handle the stop
and update cases properly.
Comment 6 Marius Tomaschewski 2014-09-30 21:38:38 UTC
(In reply to Dominique Leuenberger from comment #4)
> http://cgit.freedesktop.org/NetworkManager/NetworkManager/commit/data/
> NetworkManager.service.in?id=1d89bc0004ec27fbc0c89f17861118c78d7eeab5 and
> the referenced bug (https://bugzilla.redhat.com/show_bug.cgi?id=876218#c49)
> have a very nice story why NM is not tearing down the network on 'systemctl
> stop NetworkManager'
> 
> => on a shutdown, if you have a NFS mounted root, the root 'disappears' on
> you and the shutdown hangs...

Ah... yes. Then I'd say: kill -9 dhclient in this case would do the right
thing (same as sysconfig were doing before ;-)
Comment 7 Dominique Leuenberger 2014-09-30 21:43:48 UTC
(In reply to Marius Tomaschewski from comment #6)
> (In reply to Dominique Leuenberger from comment #4)
> > http://cgit.freedesktop.org/NetworkManager/NetworkManager/commit/data/
> > NetworkManager.service.in?id=1d89bc0004ec27fbc0c89f17861118c78d7eeab5 and
> > the referenced bug (https://bugzilla.redhat.com/show_bug.cgi?id=876218#c49)
> > have a very nice story why NM is not tearing down the network on 'systemctl
> > stop NetworkManager'
> > 
> > => on a shutdown, if you have a NFS mounted root, the root 'disappears' on
> > you and the shutdown hangs...
> 
> Ah... yes. Then I'd say: kill -9 dhclient in this case would do the right
> thing (same as sysconfig were doing before ;-)

done by what? if we don't want it and do not care for remote FS root, then we can disable this and simply kill the network on the go;

Question would be: what is more common:
- User switching NM off completely to switch to wicked
  (if done through Yast, yast should  be able to take care of terminating dhclient as well)
  if done by means of services, well, the user better know what he does :)

of

updating NetworkManager package and triggering a restart (on Factory this happens often... )

=> I'm in favor of keeping NM the way it is; and for the case of a user switching between NM and wicked, have yast to the right things (which would mean for this bug: 'wontfix'...it actually does not describe an explicit issue after all
Comment 8 Marius Tomaschewski 2014-09-30 21:58:32 UTC
(In reply to Dominique Leuenberger from comment #7)
> (In reply to Marius Tomaschewski from comment #6)
> > (In reply to Dominique Leuenberger from comment #4)
> > > http://cgit.freedesktop.org/NetworkManager/NetworkManager/commit/data/
> > > NetworkManager.service.in?id=1d89bc0004ec27fbc0c89f17861118c78d7eeab5 and
> > > the referenced bug (https://bugzilla.redhat.com/show_bug.cgi?id=876218#c49)
> > > have a very nice story why NM is not tearing down the network on 'systemctl
> > > stop NetworkManager'
> > > 
> > > => on a shutdown, if you have a NFS mounted root, the root 'disappears' on
> > > you and the shutdown hangs...
> > 
> > Ah... yes. Then I'd say: kill -9 dhclient in this case would do the right
> > thing (same as sysconfig were doing before ;-)
> 
> done by what? if we don't want it and do not care for remote FS root, then
> we can disable this and simply kill the network on the go;

By NM when there is a remote FS.
 
> Question would be: what is more common:
> - User switching NM off completely to switch to wicked
>   (if done through Yast, yast should  be able to take care of terminating
> dhclient as well)
>   if done by means of services, well, the user better know what he does :)

Skilled user -- perhaps: when he notices this left over. Otherwise there
is dhclient running and breaking the currently used network service.

> of
> 
> updating NetworkManager package and triggering a restart (on Factory this
> happens often... )
> 
> => I'm in favor of keeping NM the way it is; and for the case of a user
> switching between NM and wicked, have yast to the right things (which would
> mean for this bug: 'wontfix'...it actually does not describe an explicit
> issue after all

It is IMO definitely not a WONTFIX as it breaks networking. The new service
isn't able to work properly when the old leaves running dhcp clients.

The problem is also: when you start dhclient again, the dhclient script
_may_ deconfigure the interface / address family it currently handles;
this depends on the script implementation of course.
Comment 9 Dominique Leuenberger 2014-09-30 22:05:17 UTC
(In reply to Marius Tomaschewski from comment #8)
> (In reply to Dominique Leuenberger from comment #7)
> > (In reply to Marius Tomaschewski from comment #6)
> > > (In reply to Dominique Leuenberger from comment #4)
> > > > http://cgit.freedesktop.org/NetworkManager/NetworkManager/commit/data/
> > > > NetworkManager.service.in?id=1d89bc0004ec27fbc0c89f17861118c78d7eeab5 and
> > > > the referenced bug (https://bugzilla.redhat.com/show_bug.cgi?id=876218#c49)
> > > > have a very nice story why NM is not tearing down the network on 'systemctl
> > > > stop NetworkManager'
> > > > 
> > > > => on a shutdown, if you have a NFS mounted root, the root 'disappears' on
> > > > you and the shutdown hangs...
> > > 
> > > Ah... yes. Then I'd say: kill -9 dhclient in this case would do the right
> > > thing (same as sysconfig were doing before ;-)
> > 
> > done by what? if we don't want it and do not care for remote FS root, then
> > we can disable this and simply kill the network on the go;
> 
> By NM when there is a remote FS.

if NM were to do that: then the shutdown issue as described in the referenced git commit will be happening: once the network is down, you don't have access to those remote FS anymore (and if this is the wish, then we simply patch out the KillMode=Process away)


> > Question would be: what is more common:
> > - User switching NM off completely to switch to wicked
> >   (if done through Yast, yast should  be able to take care of terminating
> > dhclient as well)
> >   if done by means of services, well, the user better know what he does :)
> 
> Skilled user -- perhaps: when he notices this left over. Otherwise there
> is dhclient running and breaking the currently used network service.

The not skilled user would switch using Yast... which should have the knowledge of what to do to properly switch... switching is certainly  not the daily task...

> > of
> > 
> > updating NetworkManager package and triggering a restart (on Factory this
> > happens often... )
> > 
> > => I'm in favor of keeping NM the way it is; and for the case of a user
> > switching between NM and wicked, have yast to the right things (which would
> > mean for this bug: 'wontfix'...it actually does not describe an explicit
> > issue after all
> 
> It is IMO definitely not a WONTFIX as it breaks networking. The new service
> isn't able to work properly when the old leaves running dhcp clients.

switching is not a daily task and should get it's sep handling in the switching code... there I don't object it terminating more tasks.. on a simple restart of the NM service, it just sounds wrong.
Comment 10 Marius Tomaschewski 2014-10-01 05:50:08 UTC
The only possibility to workaround it in yast2-network I currently see,
would be to implement the "switch away from NM" like this -- and also
to document in the release notes (for users doing it manually):

  # bnc#895447: NetworkManager does not cleanup on stop
  # Ensure it is gone along with conflicting dhclients,
  # ... before we switch over to another network.service.
  systemctl --kill-who=all kill NetworkManager.service
  systemctl stop NetworkManager.service
  systemctl disable NetworkManager.service

Is this the way preferred by the NetworkManager?
Comment 14 Dominique Leuenberger 2014-10-04 16:10:30 UTC
(In reply to Marius Tomaschewski from comment #10)
> The only possibility to workaround it in yast2-network I currently see,
> would be to implement the "switch away from NM" like this -- and also
> to document in the release notes (for users doing it manually):
> 
>   # bnc#895447: NetworkManager does not cleanup on stop
>   # Ensure it is gone along with conflicting dhclients,
>   # ... before we switch over to another network.service.
>   systemctl --kill-who=all kill NetworkManager.service
>   systemctl stop NetworkManager.service
>   systemctl disable NetworkManager.service
> 
> Is this the way preferred by the NetworkManager?

Yes - the switching between Network services is a special thing and deserves special handling, without breaking more normal use cases.
Comment 15 Marius Tomaschewski 2014-10-27 15:16:52 UTC
*** Bug 893678 has been marked as a duplicate of this bug. ***
Comment 16 Bernhard Wiedemann 2015-01-13 20:00:07 UTC
This is an autogenerated message for OBS integration:
This bug (895447) was mentioned in
https://build.opensuse.org/request/show/281060 13.2 / sysconfig
Comment 18 Swamp Workflow Management 2015-01-23 10:09:15 UTC
openSUSE-RU-2015:0124-1: An update that has three recommended fixes can now be installed.

Category: recommended (moderate)
Bug References: 895447,900982,912891
CVE References: 
Sources used:
openSUSE 13.2 (src):    sysconfig-0.83.8-5.1
Comment 19 Marius Tomaschewski 2015-01-26 09:42:45 UTC
*** Bug 902771 has been marked as a duplicate of this bug. ***
Comment 22 Swamp Workflow Management 2015-07-01 10:05:33 UTC
SUSE-RU-2015:1163-1: An update that has 5 recommended fixes can now be installed.

Category: recommended (moderate)
Bug References: 895447,900982,909307,912891,930309
CVE References: 
Sources used:
SUSE Linux Enterprise Server 12 (src):    sysconfig-0.83.8-7.1
SUSE Linux Enterprise Desktop 12 (src):    sysconfig-0.83.8-7.1
Comment 23 Graham Davis 2015-09-05 12:46:30 UTC
This bug may - or may not - have been fixed. I know that bug #893678 is fixed, an alleged duplicate of this one, but I can't say for sure whether this one is. My own opinion is that the two bugs were unrelated.
Comment 24 Knut Alejandro Anderssen González 2019-02-11 10:59:27 UTC
As part of these two bugs (bsc#1117636, bsc#1122194), we were testing if YaST or NM was leaving some process around (dhclient):


https://bugzilla.suse.com/show_bug.cgi?id=1117636
https://bugzilla.opensuse.org/show_bug.cgi?id=1122194

That seems to not be the case, and what was suggested at #10 was not needed at all.

So closing it as fixes for TW.

Fell free to reopen it if you found that there is anything still wrong which yast-network should do better.

Thnx!