When USE="newnet" is enabled in sys-apps/openrc, file /etc/init.d/network is installed. There are 2 functions in /etc/init.d/udev for handling situation when sys-apps/openrc is installed with USE="newnet" and enabled in the runlevels: disable_oldnet_hotplug() { if is_service_enabled network; then # disable network hotplugging local d="/run/udev/rules.d" mkdir -p "${d}" local f="${d}/90-network.rules" echo "# This file disables network hotplug events calling" >> "${f}" echo "# old-style openrc net scripts" >> "${f}" echo "# as we use /etc/init.d/network to set up our network" >> "${f}" fi } is_service_enabled() { local svc="$1" [ ! -e "/etc/init.d/${svc}" ] && return 1 [ -e "/etc/runlevels/${RC_BOOTLEVEL}/${svc}" ] && return 0 [ -e "/etc/runlevels/${RC_DEFAULTLEVEL}/${svc}" ] && return 0 return 1 } Then disable_oldnet_hotplug() is called before udev is started to disable the netifrc udev hotplugging. These should now be part of sys-apps/openrc when USE="newnet" is enabled to prevent udev hotplugging of netifrc take place. I'm not sure which /etc/init.d script is best, but it would need to be one that is executed before 'udev' in 'sysinit' runlevel, as the dummy /run/udev/rules.d/90-network.rules it creates should be in place before udevd (systemd-udevd) starts. The init script where they go, should have a 'before udev'
More possibilities: 1. Delete the 2 functions completely. 2. Add 'newnet? ( !net-misc/netifrc )' blocker to sys-apps/openrc 3. Add '!sys-apps/openrc[newnet]' blocker to net-misc/netifrc OR 1. Delete the 2 functions completely. 2. Do nothing, and if let user set /etc/udev/rules.d/90-network.rules to override the netifrc's udev hotplugging if he wants on his own. I think I prefer the first option, to delete them altogether and add blockers, since newnet and netifrc doesn't really make sense at the same time, do they?
One more possibility: 1. Delete the functions altogether 2. Make netifrc by default install a dummy /etc/udev/rules.d/90-network.rules that has # comments inside of it, explaining it's a file that by default, disables the udev hotplugging of net.* and that user can remove it, to activate the hotplugging
(In reply to Samuli Suominen from comment #1) > More possibilities: > > 1. Delete the 2 functions completely. > 2. Add 'newnet? ( !net-misc/netifrc )' blocker to sys-apps/openrc > 3. Add '!sys-apps/openrc[newnet]' blocker to net-misc/netifrc > > OR > > 1. Delete the 2 functions completely. > 2. Do nothing, and if let user set /etc/udev/rules.d/90-network.rules to > override the netifrc's udev hotplugging if he wants on his own. > > I think I prefer the first option, to delete them altogether and add > blockers, since newnet and netifrc doesn't really make sense at the same > time, do they? Although it makes no sense to attempt to use them both at the same time (probably, i'm sure some have tried), having them both installed at the same time isn't a problem and I see no reason why we should exclude that possibility just because of these two functions. What I think would make the most sense is that we adjust the hotplugging that we just moved into netifrc to be somehow based on whether or not /etc/init.d/network is being used -- that is, check 'is_service_enabled network' somehow in the 90-network.rules itself and use that to skip hotplugging. Thoughts?
(In reply to Ian Stakenvicius from comment #3) > (In reply to Samuli Suominen from comment #1) > > More possibilities: > > > > 1. Delete the 2 functions completely. > > 2. Add 'newnet? ( !net-misc/netifrc )' blocker to sys-apps/openrc > > 3. Add '!sys-apps/openrc[newnet]' blocker to net-misc/netifrc > > > > OR > > > > 1. Delete the 2 functions completely. > > 2. Do nothing, and if let user set /etc/udev/rules.d/90-network.rules to > > override the netifrc's udev hotplugging if he wants on his own. > > > > I think I prefer the first option, to delete them altogether and add > > blockers, since newnet and netifrc doesn't really make sense at the same > > time, do they? > > Although it makes no sense to attempt to use them both at the same time > (probably, i'm sure some have tried), having them both installed at the same > time isn't a problem and I see no reason why we should exclude that > possibility just because of these two functions. > > What I think would make the most sense is that we adjust the hotplugging > that we just moved into netifrc to be somehow based on whether or not > /etc/init.d/network is being used -- that is, check 'is_service_enabled > network' somehow in the 90-network.rules itself and use that to skip > hotplugging. Thoughts? Well, all is_service_enabled() does is checks for existance of 3 files and it's possible to do that from udev .rules, I can think of eg. alsa-restore: TEST!="/etc/alsa/state-daemon.conf", RUN+="/usr/sbin/alsactl restore $attr{number}" [ ... cut ... ] So, something like: TEST=="/etc/runlevels/default/network", RUN+="/path/to/disable_oldnet_hotplug" And same for 'boot' and 'sysinit' since we can't be sure were the user has added the 'network' to. Or use ENV to set some temp. variable like ENV{DISABLE_OLDNET_HOTPLUG}="1" and combine ENV later with RUN Sorry, I don't know the exact correct syntax at this second, but I believe it should be possible
That's what I thought, too. Worst-case, it would be possible to add a wrapper within the script itself to make it a no-op if the network service is in any runlevel. Either way, it seems this is something that can be handled directly within netifrc and not require openrc or udev-init-scripts to contain anything different. I'll work on a patch today and get it committed into netifrc asap; we can strip the functions out of udev-init-scripts (and any remnants that may exist in openrc--i don't think there are though?) once said patch hits the tree. Sound good?
Created attachment 371948 [details, diff] Stop net.sh if newnet is enabled This should solve the bug. However, patching the udev rules would propably be a bit nicer, but then again, udev syntax might change in a way it breaks? Use this to close the bug, and consider futher patches as enhancements?
InVCS