# OpenRC, bonding issues

## yzh

I have two main problems when migrated to newest baselayout and OpenRC:

 When stopping the bond interface, it will stop all network services such as "sshd"

 When stopping the bond interface, it will show weird errors/warnings/messages

Example with weird messages:

```

# /etc/init.d/net.bond0 stop

* Bringing down interface bond0

*   Removing slaves from bond0 ...

*     eth0.17 eth0.24 eth1.17 eth1.24                                                                                                                                         [ ok ]

Cannot find device "bond0"

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

* Bringing up interface bond0

*   Adding slaves to bond0 ...

*     eth0.17 eth0.24 eth1.17 eth1.24                                                                                                                                         [ ok ]

*   null ...                    

```

As you can see it will print "Cannot find device bond0" and "null" when starting and stopping the interface.

In this case I use eth0 as the management interface, it's anoying that when I stop the bond interface that it will also stop "sshd". 

My /etc/conf.d/net config looks like this:

```

# External interface

config_eth5="10.0.8.41 netmask 255.255.255.0 brd 10.0.8.255"

routes_eth5="default gw 10.0.8.1"

config_lo="10.1.1.208"

# bond0 config

slaves_bond0="eth0.17 eth0.24 eth1.17 eth1.24 "

config_bond0="null"

config_eth0="null"

config_eth0_17="null"

config_eth0="null"

config_eth0_24="null"

config_eth1="null"

config_eth1_17="null"

config_eth1="null"

config_eth1_24="null"

RC_NEED_bond0="net.eth0 net.eth0 net.eth1 net.eth1 "

vlans_eth1="17 24 "

vlans_eth0="17 24 "

```

----------

## richard.scott

have you loaded the bonding module?

----------

## yzh

 *richard.scott wrote:*   

> have you loaded the bonding module?

 

Yup

```

$ zcat /proc/config.gz | grep BONDING

CONFIG_BONDING=y

```

----------

## ebprorules

 *Quote:*   

> Cannot find device "bond0" 

 

This seems to be caused by a the command  *Quote:*   

> ip route flush table cache dev bond0

  performed by the init.d script- in your case /etc/init.d/net.lo:

 *Quote:*   

> 
> 
> + '[' vlan_post_stop = vlan_post_stop ']'
> 
> + vlan_post_stop
> ...

 

Since the bond has already been removed by the time its executed, we get this particular output. This command seems to originate in /lib/rc/net/iproute2.sh.

----------

## yzh

I found the causes of the prints:

The null print is caused in /etc/init.d/net.lo on line 542:

```

        while true; do

                eval config=\$config_${config_index}

                [ -z "${config}" ] && break

                set -- ${config}

                ebegin "$1"

                eindent

```

This prints the variable in config_bond0="null", even if this is null.. so a fix would be to not print anything if this is null..

--

The "Cannot find device "bond0" is caused in /lib/rc/net/iproute2.sh by iproute2_post_stop(), it does not check if the device exists and then performs: "ip route flush table cache dev "${IFACE}". This could be easily fixed by using the "_exists()" function before running the routine like this:

```

iproute2_post_stop()

{

        _exists || return

```

----------

## yzh

Files two bugs with patches:

379575 - sys-apps/openrc-0.8.3-r1: Cannot find device "bond0" upon stopping the interface

379577 - sys-apps/openrc-0.8.3-r1: "null" is printed when starting a network interface

----------

