# [Solved] netplug stopped working

## deno

Hi,

after upgrade to baselayout-2 netplug stopped working. Now I have to wait dhcp on eth0 to time out when cable is unpluged and rc-status doesn't report eth0 as inactive but started. Any suggestions what could I do to solve this?Last edited by deno on Wed Apr 16, 2008 5:47 pm; edited 1 time in total

----------

## pappy_mcfae

The answers you seek are in this article.

Blessed be!

Pappy

----------

## deno

Thanks for the answer Pappy. I have read the article and unfortunately I don't see anything in it what could help me. my system boots and net.eth0 starts, but the problem is that if the cable is unpluged I have to wait dhcpd to times out.

Bfore with baselayout-1 I would always see the message 'dhcp backgrounding' or similar and booting would continue immediately. After that net.eth0 would appear in output of rc-status as inactive. when cable is pluged in service would become active and dhcp would assign an ip address.

As workaround I put dhcpcd_eth0="-t 5" in /etc/conf.f/net.

----------

## UberLord

Is net.eth0 a symlink to net.lo?

----------

## deno

Yes it is a symlink to net.lo.

----------

## UberLord

Is net.lo a symlink to /lib/rc/sh/net.sh ?

Also, run /etc/init.d/net.eth0 --debug start and post the output somewhere. Just reference it here as it will be a LOT of output.

----------

## deno

 *Quote:*   

> net.lo -> //lib/rc/sh/net.sh

 

yup

Here is the output of '/etc/init.d/net.eth0 --debug start'.'

I hope we understand each other. I didn't say net.eth0 doesn't start or it doesn't work, it is just that i have to wait for time out when cable is unpluged and I have netplug installed, which worked well with baselayout-1.

Thanks for support!

----------

## UberLord

What does this command do?

(. /lib/rc/net/ifconfig.sh; IFACE=eth0; set -x;_get_mac_address; echo $?)

----------

## deno

. /lib/rc/net/ifconfig.sh starts ifconfig.sh

IFACE=eth0 assigns IFACE variable an eth0 value.

set -x from man page: *Quote:*   

> -x     The  shell  shall write to standard error a trace for each command after it expands the command and before it exe-
> 
>               cutes it. It is unspecified whether the command that turns tracing off is traced.

 

and echo $? gives you status of executed command. if ?=0 it was successful.

----------

## UberLord

I meant what it does on your box   :Rolling Eyes: 

BTW, you forgot to explain the brackets (it runs in a subshell so it doesn't affect your shell)

I'm betting that eth0 wrong somehow. So run that command and post it's contents.

Also, post the output of `ifconfig eth0`

----------

## phuegler

I have been having the same problem with ifplugd.  Here is what I found.

The problem is that in the latest unstable version of net-tools (net-tools-1.60_p20071202044231), ifconfig used to identify the MAC address with 'HWaddr' and now identifies it with 'ether'.  The _get_mac_address() function in /lib64/rc/net/ifconfig.sh uses the following command to retrieve the MAC address:

```

   local mac=$(LC_ALL=C ifconfig "${IFACE}" | \

   sed -n -e 's/.* HWaddr \(..:..:..:..:..:..\).*/\1/p')

```

Hence the netplugd and ifplugd scripts assume that there is no MAC address and doesn't start netplugd or ifplugd.

Two quick fixes:

1) Downgrade to net-tools-1.60-r3.

2) Change 'HWaddr' in the above command (line 58 in ifconfig.sh) to 'ether'.

----------

## tarpman

 *phuegler wrote:*   

> 2) Change 'HWaddr' in the above command (line 58 in ifconfig.sh) to 'ether'.

 

This worked for me.

----------

## deno

@UberLord

 :Very Happy:  I supposed that you didn't want such answer, but how would I know what that code does on my box? Thanks for your effort!

It turned out that problem was what phuegler said. Just a notice for noobs like me  :Smile:  who use x86 arch, ifconfig.sh is in /lib/rc/net folder. Strangely 'locate ifconfig.sh' gave nothing even if /lib is not in $PRUNEPATHS in updatedb.conf.

----------

