Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 401269 - sys-apps/openrc-0.9.8.2: net.* are not stopped while shutting down
Summary: sys-apps/openrc-0.9.8.2: net.* are not stopped while shutting down
Status: RESOLVED FIXED
Alias: None
Product: Gentoo Hosted Projects
Classification: Unclassified
Component: OpenRC (show other bugs)
Hardware: All Linux
: Normal normal (vote)
Assignee: OpenRC Team
URL:
Whiteboard: openrc:oldnet
Keywords:
Depends on:
Blocks: 399185 401555 401593
  Show dependency tree
 
Reported: 2012-01-29 09:39 UTC by Miguel Sanjurjo
Modified: 2013-04-25 23:08 UTC (History)
1 user (show)

See Also:
Package list:
Runtime testing required: ---


Attachments
doc.patch (doc.patch,1.03 KB, text/plain)
2012-01-30 04:03 UTC, William Hubbs
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Miguel Sanjurjo 2012-01-29 09:39:09 UTC
after updating yesterday OpenRC from version 0.9.4 to 0.9.8.2 I noticed that the network interfaces are not being shut down anymore, no matter in what runlevel the scripts are (in my case net.lo in the boot runlevel, net.eth0 in the default runlevel).

The problem I'm facing is that the postdown() section of /etc/conf.d/net is of course not being called, and so my WOL-Settings not applied.

Is this a bug? Any workarounds? Using the deprecated /etc/init.d/network with the shutdown_network=YES setting had no effect. All other services are shut down properly by OpenRC.

I should mention that I use rc_parallel=YES, and that this setting is not the source of the problem. Deactivating it has no effect on this issue.

Reproducible: Always

Steps to Reproduce:
1.rc-update add net.eth0 default
2.Reboot => net.eth0 will be brought up
3.Shutdown => net.eth0 won't be brought down
Actual Results:  
postdown() section of /etc/conf.d/net is ignored

Expected Results:  
postdown() section of /etc/conf.d/net will be called

rc.log (shutdown process) before I updated OpenRC (note how net.lo and net.eth0 are shut down):

rc shutdown logging started at Fri Jan 27 04:01:25 2012

local           | * Stopping local
local           | [ ok ]
vsftpd          | * Stopping vsftpd ...
urandom         | * Saving random seed ...
svnserve        | * Stopping svnserve ...
cupsd           | * Stopping cupsd ...
swap            | * Deactivating swap devices ...
netmount        | * Unmounting network filesystems ...
dcron           | * Stopping dcron ...
ntpd            | * Stopping ntpd ...
heyu            | * Stopping heyu ...
minidlna        | * Stopping MiniDLNA ...
sshd            | * Stopping sshd ...
sobexsrv        | * Stopping sobexsrv ...
autofs          | * Stopping automounter ...
syslog-ng       | * Stopping syslog-ng ...
acpid           | * Stopping acpid ...
nfs             | * Stopping NFS mountd ...
boinc           | * Stopping boinc ...
samba           | * samba -> stop: smbd ...
vsftpd          | [ ok ]
svnserve        | [ ok ]
urandom         | [ ok ]
alsasound       | * Storing ALSA Mixer Levels ...
sshd            | [ ok ]
dcron           | [ ok ]
net.eth0        | * Bringing down interface eth0
netmount        | [ ok ]
heyu            | [ ok ]
acpid           | [ ok ]
ntpd            | [ ok ]
alsasound       | [ ok ]
cupsd           | [ ok ]
autofs          | [ ok ]
sobexsrv        | [ ok ]
nfs             | [ ok ]
nfs             | * Stopping NFS daemon ...
nfs             | [ ok ]
samba           | [ ok ]
samba           | * samba -> stop: nmbd ...
syslog-ng       | [ ok ]
bluetooth       | * Shutting down Bluetooth ...
net.lo          | * net.lo: waiting for minidlna (50 seconds)
bluetooth       | [ ok ]
dbus            | * Stopping D-BUS system messagebus ...
rpc.statd       | * rpc.statd: waiting for nfs (50 seconds)
portmap         | * portmap: waiting for nfs (50 seconds)
samba           | [ ok ]
boinc           | [ ok ]
nfs             | * Unexporting NFS directories ...
swap            | [ ok ]
nfs             | [ ok ]
rpc.statd       | * Stopping NFS statd ...
dbus            | [ ok ]
rpc.statd       | [ ok ]
net.eth0        | *   Removing addresses
portmap         | * Stopping portmap ...
portmap         | [ ok ]
net.eth0        | *     192.168.1.2/24
minidlna        | [ ok ]
net.lo          | * Bringing down interface lo
net.eth0        | *     Running postdown ...
net.lo          | *   Removing addresses
net.lo          | *     Running postdown ...
localmount      | * Unmounting loop devices
localmount      | * Unmounting filesystems
localmount      | *   Unmounting /mnt/sata-2 ...
localmount      | [ ok ]
localmount      | *   Unmounting /mnt/sata-1 ...
localmount      | [ ok ]
udev            | * Stopping udevd ...
hwclock         | * Setting hardware clock using the system clock [UTC] ...
udev            | [ ok ]
hwclock         | [ ok ]

rc shutdown logging stopped at Fri Jan 27 04:01:47 2012

rc.log (shutdown process) after I updated OpenRC (note how net.lo and net.eth0 are mnissing):

rc shutdown logging started at Sat Jan 28 16:48:12 2012

local           | * Stopping local
vsftpd          | * Stopping vsftpd ...
svnserve        | * Stopping svnserve ...
urandom         | * Saving random seed ...
local           | [ ok ]
swap            | * Deactivating swap devices ...
sobexsrv        | * Stopping sobexsrv ...
sshd            | * Stopping sshd ...
minidlna        | * Stopping MiniDLNA ...
samba           | * samba -> stop: smbd ...
ntpd            | * Stopping ntpd ...
heyu            | * Stopping heyu ...
netmount        | * Unmounting network filesystems ...
vsftpd          | [ ok ]
dcron           | * Stopping dcron ...
svnserve        | [ ok ]
sshd            | [ ok ]
cupsd           | * Stopping cupsd ...
urandom         | [ ok ]
nfs             | * Stopping NFS mountd ...
autofs          | * Stopping automounter ...
swap            | [ ok ]
boinc           | * Stopping boinc ...
ntpd            | [ ok ]
syslog-ng       | * Stopping syslog-ng ...
acpid           | * Stopping acpid ...
alsasound       | * Storing ALSA Mixer Levels ...
dcron           | [ ok ]
netmount        | [ ok ]
heyu            | [ ok ]
autofs          | [ ok ]
syslog-ng       | [ ok ]
sobexsrv        | [ ok ]
samba           | [ ok ]
alsasound       | [ ok ]
samba           | * samba -> stop: nmbd ...
cupsd           | [ ok ]
nfs             | [ ok ]
acpid           | [ ok ]
nfs             | * Stopping NFS daemon ...
minidlna        | [ ok ]
boinc           | [ ok ]
samba           | [ ok ]
nfs             | [ ok ]
bluetooth       | * Shutting down Bluetooth ...
bluetooth       | [ ok ]
nfs             | * Unexporting NFS directories ...
nfs             | [ ok ]
dbus            | * Stopping D-BUS system messagebus ...
rpc.statd       | * Stopping NFS statd ...
dbus            | [ ok ]
rpc.statd       | [ ok ]
portmap         | * Stopping portmap ...
portmap         | [ ok ]
localmount      | * Unmounting loop devices
localmount      | * Unmounting filesystems
localmount      | *   Unmounting /mnt/sata-2 ...
localmount      | [ ok ]
localmount      | *   Unmounting /mnt/sata-1 ...
localmount      | [ ok ]
udev            | * Stopping udevd ...
udev            | [ ok ]
hwclock         | * Setting hardware clock using the system clock [UTC] ...
hwclock         | [ ok ]

rc shutdown logging stopped at Sat Jan 28 16:48:27 2012
Comment 1 Christian Ruppert (idl0r) gentoo-dev 2012-01-29 12:54:27 UTC
This is related to commit 6d5a2d5f9e5c1e3cb4c24dfc0c2ed2c118d8e64c - http://git.overlays.gentoo.org/gitweb/?p=proj/openrc.git;a=commitdiff;h=6d5a2d5f9e5c1e3cb4c24dfc0c2ed2c118d8e64c
Comment 2 William Hubbs gentoo-dev 2012-01-29 17:37:11 UTC
I can't think of a reason that yu would need your network interfaces to
actually go down when you are shutting down your system. However, I will
look over the script and see if I can make it behave the same way the
network script does.

By the way, /etc/init.d/network should not be used; that script, along
with /etc/init.d/staticroute, is deprecated and being removed in the
future.
when you are
Comment 3 Miguel Sanjurjo 2012-01-29 18:24:40 UTC
(In reply to comment #2)
> I can't think of a reason that yu would need your network interfaces to
> actually go down when you are shutting down your system. However, I will
> look over the script and see if I can make it behave the same way the
> network script does.

I explained this in the bug description:
Some NICs need the WOL-Settings applied after network disconnection. The postdown() section of a net.* script, called while shutting down the system, is ideal for that.

> By the way, /etc/init.d/network should not be used; that script, along
> with /etc/init.d/staticroute, is deprecated and being removed in the
> future.
> when you are

Yes, I know they are deprecated.

Thanks for the hint Christian Ruppert. Removing the "-shutdown" keyword from /etc/init.d/net.lo did the trick. The scripts are behaving like they should again
Comment 4 Martin Väth 2012-01-29 19:40:45 UTC
(In reply to comment #2)
> I can't think of a reason that yu would need your network interfaces to
> actually go down when you are shutting down your system.

Here is another reason for net.ppp* (though I have not checked whether
the problem appears here, too):
pppd reports the number of transferred bytes and connection time at
disconnection. With some providers, it can be quite expensive to go
over a certain limit of transferred data or connection time, so this
information must be carefully logged.
For a simple solution, a script in /etc/ppp/ip-down.d is appropriate.
This does not work if pppd does not go down regularly.
Comment 5 William Hubbs gentoo-dev 2012-01-30 04:02:14 UTC
(In reply to comment #3)
> (In reply to comment #2)
> > I can't think of a reason that yu would need your network interfaces to
> > actually go down when you are shutting down your system. However, I will
> > look over the script and see if I can make it behave the same way the
> > network script does.
> 
> I explained this in the bug description:
> Some NICs need the WOL-Settings applied after network disconnection. The
> postdown() section of a net.* script, called while shutting down the system, is
> ideal for that.
> Thanks for the hint Christian Ruppert. Removing the "-shutdown" keyword from
> /etc/init.d/net.lo did the trick. The scripts are behaving like they should
> again

Actually, you should do this without touching /etc/init.d/net.lo, as follows:

For the interfaces you need to keep up, place the following in /etc/conf.d/net:

rc_net_IFNAME_keyword="!-shutdown"

(In reply to comment #4)
> Here is another reason for net.ppp* (though I have not checked whether
> the problem appears here, too):
> pppd reports the number of transferred bytes and connection time at
> disconnection. With some providers, it can be quite expensive to go
> over a certain limit of transferred data or connection time, so this
> information must be carefully logged.
> For a simple solution, a script in /etc/ppp/ip-down.d is appropriate.
> This does not work if pppd does not go down regularly.

pppd going down is different from the ppp* interface going down. What the change does is not bring down the ppp* interfaces on shutdown, but, the pppd daemon will still be killed as usual. Does that not bring down the connection?

@robbat2:
I spoke with some folks on #gentoo-dev before I implemented this change and was told that it would be a positive/neutral change.

I have a patch which I will attach here that shows what would need to change in the documentation for folks who want to still have their interfaces go down.

Do you think we should go forward and commit the doc change or revert this commit so that all of the network interfaces always go down again?
Comment 6 William Hubbs gentoo-dev 2012-01-30 04:03:34 UTC
Created attachment 300335 [details]
doc.patch

Here is the doc change.
Comment 7 Miguel Sanjurjo 2012-01-30 06:53:29 UTC
(In reply to comment #5)
> I spoke with some folks on #gentoo-dev before I implemented this change and was
> told that it would be a positive/neutral change.

Just curiosity: What is positive about this change?

(In reply to comment #6)
> Created attachment 300335 [details]
> doc.patch
> 
> Here is the doc change.

That reference to rc_net_IFNAME_keyword="!-shutdown" is good, it should have been added in the same commit as the change. Thanks for that
Comment 8 Martin Väth 2012-01-30 13:04:29 UTC
(In reply to comment #5)
> pppd going down is different from the ppp* interface going down. What the
> change does is not bring down the ppp* interfaces on shutdown, but, the pppd
> daemon will still be killed as usual.

I cannot access my system at the moment, but if I understand correctly
you rely on pppd being killed when all processes are killed.
If this is the case, this has at least two problems:

1. Unless the behavior of pppd has changed recently,
this will not call /etc/ppp/ip-down. For the latter, pppd must be shut down
"regularly" (I do not know how openrc is doing this currently; perhaps by
sending a SIGHUP (not a SIGTERM).

2. What is more serious: Does this mean that a temporary
/etc/init.d/net.ppp0 stop does not stop the connection either,
i.e. to stop the connection you have to send SIGHUP to pppd manually
and to restart it later you have to start pppd manually?
This also means that all other dependent init-scripts
(like starting/stopping ez-ipupdate, openrdate, or similar things) will also
not work correspondingly with stop/start.
If this is the case, I am afraid that this means openrc can practically not
be used anymore for pppd or other non-permanent connections but has to
replaced completely by home-brewn scripts...
Comment 9 William Hubbs gentoo-dev 2012-01-30 16:37:51 UTC
(In reply to comment #8)
> I cannot access my system at the moment, but if I understand correctly
> you rely on pppd being killed when all processes are killed.
> If this is the case, this has at least two problems:
> 
> 1. Unless the behavior of pppd has changed recently,
> this will not call /etc/ppp/ip-down. For the latter, pppd must be shut down
> "regularly" (I do not know how openrc is doing this currently; perhaps by
> sending a SIGHUP (not a SIGTERM).

Openrc sends SIGTERM initially to ask the process to shut down, then it sends SIGKILL after  5 seconds to make it go down. Does pppd require a SIGHUP instead? If so, I may be able to make ppp interfaces go down.

> 2. What is more serious: Does this mean that a temporary
> /etc/init.d/net.ppp0 stop does not stop the connection either,
> i.e. to stop the connection you have to send SIGHUP to pppd manually
> and to restart it later you have to start pppd manually?
> This also means that all other dependent init-scripts
> (like starting/stopping ez-ipupdate, openrdate, or similar things) will also
> not work correspondingly with stop/start.
> If this is the case, I am afraid that this means openrc can practically not
> be used anymore for pppd or other non-permanent connections but has to
> replaced completely by home-brewn scripts...

No, the only thing this does is not take interfaces down when you shut down your system.
Comment 10 William Hubbs gentoo-dev 2012-01-30 18:31:15 UTC
This is reverted in commits 8a41537 and 0ff23f2.
Openrc-0.9.8.3 will be released asap.