Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!

Bug 366653

Summary: sys-apps/openrc - "/lib/rc/net/bonding.sh: line 106: echo: write error: Device or resource busy"
Product: Gentoo Linux Reporter: Kfir Lavi <lavi.kfir>
Component: [OLD] Core systemAssignee: OpenRC Team <openrc>
Status: RESOLVED FIXED    
Severity: normal    
Priority: Normal    
Version: unspecified   
Hardware: All   
OS: Linux   
Whiteboard:
Package list:
Runtime testing required: ---
Attachments: add a check before adding an interface as a slave
refreshed patch for checking before adding an interface as a slave

Description Kfir Lavi 2011-05-09 22:00:08 UTC
Created attachment 272679 [details]
add a check before adding an interface as a slave

Hi,
/lib/rc/net/bonding.sh tries to add interface as a slave when slaves are already added. 
I have added a check with grep, so if interface is already there, then no addition will be made. 

Regards,
Kfir
Comment 1 Anthony Basile gentoo-dev 2011-05-16 12:54:59 UTC
Yep, this needs to be fixed.  Here's what I found:

In my /etc/conf.d/net:

config_eth0="192.168.100.221 netmask 255.255.255.0"
routes_eth0="default via 192.168.100.9"

config_bond0="192.168.0.2 netmask 255.255.255.0"
slaves_bond0="eth1 eth2 eth3"

Start up bonding, zap it to zero, even though the bond is up, try to restart:

/etc/init.d/net.bond0 start
/etc/init.d/net.bond0 zap
/etc/init.d/net.bond0 start

and you get:

 * Bringing up interface bond0
 *   Adding slaves to bond0 ...
 *     eth1 eth2 eth3
/lib64/rc/net/bonding.sh: line 106: echo: write error: Operation not permitted
/lib64/rc/net/bonding.sh: line 106: echo: write error: Operation not permitted
/lib64/rc/net/bonding.sh: line 106: echo: write error: Operation not permitted                                         [ !! ]
 *   192.168.0.2 ...
RTNETLINK answers: File exists                                                                                         [ !! ]
 * ERROR: net.bond0 failed to start


Apply the patch, fixes bonding.sh problem.  You still get 

RTNETLINK answers: File exists                                                                                         [ !! ]
 * ERROR: net.bond0 failed to start

but that's because the bond0 master still exists.  I'm not sure we need to fix that because zapping always leaves things in a bad state.

I'll apply Kfir's patch for now to the repo.

If the team thinks we need to fix the other issue, let me know and I'll hunt that one down.
Comment 2 Anthony Basile gentoo-dev 2011-05-16 13:26:44 UTC
Created attachment 273429 [details, diff]
refreshed patch for checking before adding an interface as a slave

I forgot to add.  The original patch did not apply cleanly because it was against an older version of bonding.sh.  I refreshed it for the commit.  I'm posting it here for completeness.
Comment 3 William Hubbs gentoo-dev 2011-05-16 20:02:16 UTC
Commit db1daa5 applied your patch.

Thanks for the report and the patch. This will be part of openrc-0.8.3.
Comment 4 Kfir Lavi 2011-05-17 06:41:03 UTC
Thanks Anthony for the correction of my patch, and thanks William for applying this patch. 

Regards,
Kfir