# [SOLVED] Bridge start problems on reboot-runlevel problems?

## karatefish

Hi all,

I set up an openvpn bridge as per the instructions in the two guides in the wiki. It works really well, but after adding the relevant dependencies and scripts to the startup runlevels, the bridge doesn't come up automatically on reboot. After reboot has finished, running '/etc/init/net.br0 start' starts it fine.

Can anyone see any problems in the setup of my runlevels and such?

My default runlevel is:

```

 ~ # rc-update show default | grep default

           alsasound | default

               cupsd | default

          domainname | default

              freevo | default

            lighttpd | default

               local | default

            mldonkey | default

             net.br0 | default

            net.eth0 | default

            net.tap0 | default

        net_bridgeup | default

            netmount | default

          ntp-client | default

                ntpd | default

             openvpn | default

              rsyncd | default

               samba | default

                sshd | default

          vixie-cron | default

```

The (partial) contents of my /etc/conf.d/net are:

```

config_eth0=( "null" )

config_tap0=( "0.0.0.0" )

bridge_br0=( "eth0 tap0" )

config_br0=( "dhcp" )

dhcpcd_br0="-N"

depend_br0() {

  need net.tap0 net.eth0 net_bridgeup

}

```

The /etc/init.d/net_bridgeup script contains the commands that the wiki guide says have to be run each time before starting the bridge:

```

depend() {

        after net.eth0 net.tap0

        before net.br0

}

start() {

        logger "Running net_bridgeup"

        ebegin "Running commands to setup bridge connection"

        /usr/sbin/openvpn --mktun --dev tap0

        brctl addbr br0

        brctl addif br0 eth0

        brctl addif br0 tap0

        ifconfig tap0 0.0.0.0 promisc up

        eend $?

}

```

/var/log/messages contains the following after startup:

```

Mar  6 21:42:07 hostname logger: Running net_bridgeup

Mar  6 21:42:08 hostname device eth0 entered promiscuous mode

Mar  6 21:42:08 hostname device tap0 entered promiscuous mode

Mar  6 21:42:08 hostname rc-scripts: net.br0: cannot start until the runlevel boot has completed

Mar  6 21:42:09 hostname init: Entering runlevel: 3

Mar  6 21:42:15 hostname eth0: link up, 100Mbps, full-duplex, lpa 0x45E1

Mar  6 21:42:15 hostname eth0: Promiscuous mode enabled.

Mar  6 21:42:15 hostname eth0: Promiscuous mode enabled.

Mar  6 21:42:15 hostname eth0: Promiscuous mode enabled.

Mar  6 21:42:19 hostname device eth0 left promiscuous mode

Mar  6 21:42:19 hostname br0: port 1(eth0) entering disabled state

Mar  6 21:42:19 hostname device tap0 left promiscuous mode

Mar  6 21:42:19 hostname br0: port 2(tap0) entering disabled state

Mar  6 21:42:19 hostname eth0: Promiscuous mode enabled.

Mar  6 21:42:19 hostname device eth0 entered promiscuous mode

Mar  6 21:42:19 hostname device tap0 entered promiscuous mode

Mar  6 21:42:19 hostname br0: port 2(tap0) entering learning state

Mar  6 21:42:19 hostname br0: port 1(eth0) entering learning state

Mar  6 21:42:21 hostname br0: port 2(tap0) entering disabled state

Mar  6 21:42:21 hostname br0: port 1(eth0) entering disabled state

Mar  6 21:42:21 hostname dhcpcd[7272]: recvfrom: Network is down

Mar  6 21:42:21 hostname dhcpcd[7272]: sendto: Network is down

Mar  6 21:42:21 hostname eth0: Promiscuous mode enabled.

Mar  6 21:42:21 hostname device eth0 left promiscuous mode

Mar  6 21:42:21 hostname br0: port 1(eth0) entering disabled state

Mar  6 21:42:21 hostname device tap0 left promiscuous mode

Mar  6 21:42:21 hostname br0: port 2(tap0) entering disabled state

```

When net.br0 is manually started after boot with '/etc/init.d/net.br0 start' :

```

Mar  6 21:43:11 hostname eth0: Promiscuous mode enabled.

Mar  6 21:43:11 hostname device eth0 entered promiscuous mode

Mar  6 21:43:11 hostname device tap0 entered promiscuous mode

Mar  6 21:43:12 hostname br0: port 2(tap0) entering learning state

Mar  6 21:43:12 hostname br0: port 1(eth0) entering learning state

Mar  6 21:43:27 hostname br0: topology change detected, propagating

Mar  6 21:43:27 hostname br0: port 2(tap0) entering forwarding state

Mar  6 21:43:27 hostname br0: topology change detected, propagating

Mar  6 21:43:27 hostname br0: port 1(eth0) entering forwarding state

```

The boot runlevel is:

```

~ # rc-update show boot | grep boot

            bootmisc | boot

             checkfs | boot

           checkroot | boot

               clock | boot

         consolefont | boot

            hostname | boot

             keymaps | boot

          localmount | boot

             modules | boot

              net.lo | boot

           rmnologin | boot

              serial | boot

           syslog-ng | boot

             urandom | boot

```

I've tried shifting other services to start before br0 using the after keyword in the depends, thinking that it might delay the start enough to work, but it doesn't seem to make any difference. I thought that the runlevel system should prevent br0 starting until boot had finished?

I'm using baselayout-1.11.14-r5 - I don't know what other programs might make a difference...

Anyone have any ideas on how to fix this problem?Last edited by karatefish on Tue May 02, 2006 2:53 pm; edited 1 time in total

----------

## karatefish

Ok. I fixed the problem, eventually. I'll document what was wrong here in case anyone else has a similar problem at some time. NB: The commented lines in the config files are to show the differences. Your rc-file config may not parse correctly if you leave them in.

The problem was a combination of runlevel issues and network issues. My runlevels had too much information in them. I removed a few depends and services that weren't needed. My runlevels now look like:

boot:

```

 ~ # rc-update show boot | grep boot

            bootmisc | boot

             checkfs | boot

           checkroot | boot

               clock | boot

         consolefont | boot

            hostname | boot

             keymaps | boot

          localmount | boot

             modules | boot

           rmnologin | boot

              serial | boot

           syslog-ng | boot

             urandom | boot

```

(net.lo shifted to default removed the error message about 'net.br0: cannot start until the runlevel boot has completed')

default:

```

 ~ # rc-update show default | grep default

           alsasound | default

            bitlbeed | default

               cupsd | default

            ddclient | default

          domainname | default

              freevo | default

            lighttpd | default

               local | default

            mldonkey | default

               mysql | default

             net.br0 | default

              net.lo | default

        net_bridgeup | default

            netmount | default

          ntp-client | default

                ntpd | default

             openvpn | default

             privoxy | default

              rsyncd | default

               samba | default

                sshd | default

                 tor | default

          vixie-cron | default

```

(removed net.eth0 and net.tap0 from runlevels altogether. They are in the config of the net.br0 interface, so aren't needed in the services to be started as well)

These changes stopped a lot of the error messages, but the services still wouldn't start on boot. For this I had to modify the network services settings.

/etc/conf.d/net  (partial):

```

config_eth0=( "null" )

config_tap0=( "0.0.0.0" )

bridge_br0=( "eth0 tap0" )

config_br0=( "dhcp" )

dhcpcd_br0="-N"

depend_br0() {

#  need net.tap0 net.eth0 net_bridgeup

  need net_bridgeup

}

```

I removed net.eth0 and net.tap0 from the depends for the bridge. The bridge_br0 config line above already says that these are part of br0, so it's not necessary to start them separately.

I also modified the net_bridgeup script:

```

# depend() {

#        after net.eth0 net.tap0

#        before net.br0

# }

start() {

  logger "Running net_bridgeup"

  ebegin "Running commands to setup bridge connection"

  /usr/sbin/openvpn --mktun --dev tap0

#        brctl addbr br0

#        brctl addif br0 eth0

#        brctl addif br0 tap0

#        ifconfig tap0 0.0.0.0 promisc up

  eend $?

}

```

The before and after lines just weren't needed. The commands to add interfaces to the bridge I think got in the way, because the config lines in /etc/conf.d/net already do this, and I think the two were clashing. All that's needed is to create the tap0 interface.

When these changes were made, the services start flawlessly. My initial setup just contained too much information because I didn't really understand what each step was doing. When I stopped and thought about it and removed duplicate lines, it all works perfectly.

I hope this helps someone else, but at the least it removes my post from the unanswered posts list  :Smile: 

----------

## magic919

If you edit your first post subject and add [SOLVED] it will help future generations too  :Smile: 

----------

## karatefish

Done. Thanks    :Smile: 

----------

