# Have to reset eth0 every reboot

## micro8safe

I'm not sure how this happened or what I emerged to caused this, but now every time I reboot I have to reset the network card or it will not work. I have DHCP set for boot, but it always fails with "waiting for carrier".

I'm able to get DHCP to work once I set 

```

mii-tool --reset eth0

ethtool -s eth0 speed 100 duplex full

/etc/init.d/net.eth0 start

```

I would really like to get it function normally and automatically as it was before a week ago. The only thing I think I emerged that could have changed it was dbus or udev. I was having problems with dbus-python and reinstalled both udev and dbus. 

I've switched the cable and it still is acting the same. I dual boot with win7 and no problems; I was watching the Olympics just fine this weekend in windows. It also works just fine with a Fedora live stick. I've upgraded the Kernel and no change. It's a realtek internal card.

----------

## ali3nx

Could you post the details from lspci and emerge --info?

I'm curious of this could be related to missing PHY driver or something with the kernel config. do you configure your own kernel or use genkernel?

Which motherboard is in this computer your having problems with as well? 

Is the NIC card on board or added into the motherboard's expansion slot? 

Which model of network switch or router do you have the nic connected to?

I'm fairly experienced with Cisco networking and some switches can take a long time to "online" the switch port every time the NIC is reset. i thought this may be related if it's even a remote possibility.

This bit of background info would definitely help try and get to the bottom of the problem at hand.

----------

## micro8safe

 *ali3nx wrote:*   

> Could you post the details from lspci and emerge --info?
> 
> I'm curious of this could be related to missing PHY driver or something with the kernel config. do you configure your own kernel or use genkernel?
> 
> Which motherboard is in this computer your having problems with as well? 
> ...

 

Thanks for trying to help! I've not made any hardware changes. It worked fine until Sat. then just stopped working automatically.  Always had a fast DHCP resolution before. 

I do my own kernel and it was working automatically then stopped working without making any kernel changes on 3.2.12. Still is not working automatically on 3.3.8.

It's an on board card that works fine with windows/Fedora live. Mobo is GA-MA785G-UDH3. Router is DIR-655. Everything is Cat6.

LSPCI:

```

00:00.0 Host bridge: Advanced Micro Devices [AMD] RS880 Host Bridge

00:02.0 PCI bridge: Advanced Micro Devices [AMD] RS780 PCI to PCI bridge (ext gfx port 0)

00:0a.0 PCI bridge: Advanced Micro Devices [AMD] RS780/RS880 PCI to PCI bridge (PCIE port 5)

00:11.0 SATA controller: Advanced Micro Devices [AMD] nee ATI SB7x0/SB8x0/SB9x0 SATA Controller [IDE mode]

00:12.0 USB controller: Advanced Micro Devices [AMD] nee ATI SB7x0/SB8x0/SB9x0 USB OHCI0 Controller

00:12.1 USB controller: Advanced Micro Devices [AMD] nee ATI SB7x0 USB OHCI1 Controller

00:12.2 USB controller: Advanced Micro Devices [AMD] nee ATI SB7x0/SB8x0/SB9x0 USB EHCI Controller

00:13.0 USB controller: Advanced Micro Devices [AMD] nee ATI SB7x0/SB8x0/SB9x0 USB OHCI0 Controller

00:13.1 USB controller: Advanced Micro Devices [AMD] nee ATI SB7x0 USB OHCI1 Controller

00:13.2 USB controller: Advanced Micro Devices [AMD] nee ATI SB7x0/SB8x0/SB9x0 USB EHCI Controller

00:14.0 SMBus: Advanced Micro Devices [AMD] nee ATI SBx00 SMBus Controller (rev 3c)

00:14.1 IDE interface: Advanced Micro Devices [AMD] nee ATI SB7x0/SB8x0/SB9x0 IDE Controller

00:14.2 Audio device: Advanced Micro Devices [AMD] nee ATI SBx00 Azalia (Intel HDA)

00:14.3 ISA bridge: Advanced Micro Devices [AMD] nee ATI SB7x0/SB8x0/SB9x0 LPC host controller

00:14.4 PCI bridge: Advanced Micro Devices [AMD] nee ATI SBx00 PCI to PCI Bridge

00:14.5 USB controller: Advanced Micro Devices [AMD] nee ATI SB7x0/SB8x0/SB9x0 USB OHCI2 Controller

00:18.0 Host bridge: Advanced Micro Devices [AMD] Family 10h Processor HyperTransport Configuration

00:18.1 Host bridge: Advanced Micro Devices [AMD] Family 10h Processor Address Map

00:18.2 Host bridge: Advanced Micro Devices [AMD] Family 10h Processor DRAM Controller

00:18.3 Host bridge: Advanced Micro Devices [AMD] Family 10h Processor Miscellaneous Control

00:18.4 Host bridge: Advanced Micro Devices [AMD] Family 10h Processor Link Control

01:00.0 VGA compatible controller: nVidia Corporation G92 [GeForce GTS 250] (rev a2)

02:00.0 Ethernet controller: Realtek Semiconductor Co., Ltd. RTL8111/8168B PCI Express Gigabit Ethernet controller (rev 02)

03:0e.0 FireWire (IEEE 1394): Texas Instruments TSB43AB23 IEEE-1394a-2000 Controller (PHY/Link)

```

Emerge Info:

```

Portage 2.1.10.65 (default/linux/amd64/10.0/desktop, gcc-4.5.3, glibc-2.14.1-r3, 3.3.8-gentoo x86_64)

=================================================================

System uname: Linux-3.3.8-gentoo-x86_64-AMD_Phenom-tm-_II_X2_550_Processor-with-gentoo-2.1

Timestamp of tree: Tue, 31 Jul 2012 07:15:01 +0000

app-shells/bash:          4.2_p20

dev-lang/python:          2.6.6-r2, 2.7.3-r2, 3.1.4-r3, 3.2.3

dev-util/cmake:           2.8.7-r5

dev-util/pkgconfig:       0.26

sys-apps/baselayout:      2.1-r1

sys-apps/openrc:          0.9.8.4

sys-apps/sandbox:         2.5

sys-devel/autoconf:       2.13, 2.68

sys-devel/automake:       1.9.6-r3, 1.10.3, 1.11.1

sys-devel/binutils:       2.21.1-r1

sys-devel/gcc:            4.4.5, 4.5.3-r2

sys-devel/gcc-config:     1.6

sys-devel/libtool:        2.4-r1

sys-devel/make:           3.82-r1

sys-kernel/linux-headers: 3.4-r2 (virtual/os-headers)

sys-libs/glibc:           2.14.1-r3

Repositories: gentoo piczu x-portage

ACCEPT_KEYWORDS="amd64"

ACCEPT_LICENSE="*"

CBUILD="x86_64-pc-linux-gnu"

CFLAGS="-march=amdfam10 -O2 -pipe"

CHOST="x86_64-pc-linux-gnu"

CONFIG_PROTECT="/etc /usr/share/gnupg/qualified.txt"

CONFIG_PROTECT_MASK="/etc/ca-certificates.conf /etc/dconf /etc/env.d /etc/fonts/fonts.conf /etc/gconf /etc/gentoo-release /etc/revdep-rebuild /etc/sandbox.d /etc/terminfo"

CXXFLAGS="-march=amdfam10 -O2 -pipe"

DISTDIR="/usr/portage/distfiles"

FCFLAGS="-O2 -pipe"

FEATURES="assume-digests binpkg-logs config-protect-if-modified distlocks ebuild-locks fixlafiles news parallel-fetch parse-eapi-ebuild-head protect-owned sandbox sfperms strict unknown-features-warn unmerge-logs unmerge-orphans userfetch"

FFLAGS="-O2 -pipe"

GENTOO_MIRRORS="http://chi-10g-1-mirror.fastsoft.net/pub/linux/gentoo/gentoo-distfiles/ ftp://chi-10g-1-mirror.fastsoft.net/pub/linux/gentoo/gentoo-distfiles/ http://www.gtlib.gatech.edu/pub/gentoo ftp://ftp.gtlib.gatech.edu/pub/gentoo http://lug.mtu.edu/gentoo/ ftp://lug.mtu.edu/gentoo/ ftp://gentoo.netnitco.net/pub/mirrors/gentoo/source/ http://gentoo.netnitco.net ftp://mirror.iawnet.sandia.gov/pub/gentoo/ http://mirror.iawnet.sandia.gov/gentoo/ ftp://ftp.lug.udel.edu/pub/gentoo/ http://mirror.lug.udel.edu/pub/gentoo/"

LANG="en_US.UTF-8"

LDFLAGS="-Wl,-O1 -Wl,--as-needed"

LINGUAS="en"

MAKEOPTS="-j3"

PKGDIR="/usr/portage/packages"

PORTAGE_CONFIGROOT="/"

PORTAGE_RSYNC_OPTS="--recursive --links --safe-links --perms --times --compress --force --whole-file --delete --stats --human-readable --timeout=180 --exclude=/distfiles --exclude=/local --exclude=/packages"

PORTAGE_TMPDIR="/var/tmp"

PORTDIR="/usr/portage"

PORTDIR_OVERLAY="/var/lib/layman/piczu /usr/local/portage"

SYNC="rsync://rsync.us.gentoo.org/gentoo-portage"

USE="3dnow 3dnowext X a52 aac acl acpi alsa amd64 amr aspell berkdb branding bzip2 cairo cdda cddb cdparanoia cdr cli consolekit cracklib crypt cups cxx dbus dts dvd dvdr emboss encode exif fam ffmpeg firefox flac fortran gdbm gif glx gnome gpm gtk iconv ithreads jpeg lame lcms libmpeg2 libnotify mad mmx mmxext mng modules mp3 mp4 mpeg mpg123 mplayer mtp mudflap multilib ncurses nls nptl nvidia ogg opengl openmp pam pango pcre pdf png policykit ppds pppd qt3support qt4 readline sdl session spell sse sse2 ssl startup-notification svg tcpd tiff truetype udev udisks unicode upower usb v4l v4l2 vdpau vim-syntax vorbis wxwidgets x264 xcb xml xscreensaver xv xvid xvmc zlib" ALSA_CARDS="ali5451 als4000 atiixp atiixp-modem bt87x ca0106 cmipci emu10k1x ens1370 ens1371 es1938 es1968 fm801 hda-intel intel8x0 intel8x0m maestro3 trident usb-audio via82xx via82xx-modem ymfpci" ALSA_PCM_PLUGINS="adpcm alaw asym copy dmix dshare dsnoop empty extplug file hooks iec958 ioplug ladspa lfloat linear meter mmap_emul mulaw multi null plug rate route share shm softvol" APACHE2_MODULES="actions alias auth_basic authn_alias authn_anon authn_dbm authn_default authn_file authz_dbm authz_default authz_groupfile authz_host authz_owner authz_user autoindex cache cgi cgid dav dav_fs dav_lock deflate dir disk_cache env expires ext_filter file_cache filter headers include info log_config logio mem_cache mime mime_magic negotiation rewrite setenvif speling status unique_id userdir usertrack vhost_alias" CALLIGRA_FEATURES="kexi words flow plan sheets stage tables krita karbon braindump" CAMERAS="canon directory spca50x" COLLECTD_PLUGINS="df interface irq load memory rrdtool swap syslog" ELIBC="glibc" GPSD_PROTOCOLS="ashtech aivdm earthmate evermore fv18 garmin garmintxt gpsclock itrax mtk3301 nmea ntrip navcom oceanserver oldstyle oncore rtcm104v2 rtcm104v3 sirf superstar2 timing tsip tripmate tnt ubx" INPUT_DEVICES="mouse keyboard" KERNEL="linux" LCD_DEVICES="bayrad cfontz cfontz633 glk hd44780 lb216 lcdm001 mtxorb ncurses text" LIBREOFFICE_EXTENSIONS="presenter-console presenter-minimizer" LINGUAS="en" PHP_TARGETS="php5-3" PYTHON_TARGETS="python3_2 python2_7" RUBY_TARGETS="ruby18 ruby19" SANE_BACKENDS="epjitsu fujitsu" USERLAND="GNU" VIDEO_CARDS="nvidia" XTABLES_ADDONS="quota2 psd pknock lscan length2 ipv4options ipset ipp2p iface geoip fuzzy condition tee tarpit sysrq steal rawnat logmark ipmark dhcpmac delude chaos account"

Unset:  CPPFLAGS, CTARGET, EMERGE_DEFAULT_OPTS, INSTALL_MASK, LC_ALL, PORTAGE_BUNZIP2_COMMAND, PORTAGE_COMPRESS, PORTAGE_COMPRESS_FLAGS, PORTAGE_RSYNC_EXTRA_OPTS, USE_PYTHON

```

----------

## ali3nx

Here's what we know so far...

1) You updated from 3.2.12 to 3.3.8. could be something in your kernel Kconfig got messed up by the upgrade or there may have been a major change in the kernel itself related to your hardware.

When your NIC started misbehaving did you update kernel versions to 3.2.12 shortly before? 

2) The kernel config is of your own creation. 

Having a look at the kernel config would likely be advantageous to see if something might be misconfigured due to an unexpected Kconfig change. 

Pastebin would likely be best here for the full config as pasting full kernel config's slows down the forums database server or some screenshots of your kernel config sections for pci express, PHY configs. networking for the RTL8111/8168B PCI Express Gigabit Ethernet controller. If you have the NIC set to <*> or not as a module this would be best. in my experience modular kernel drivers do have advantages but they also do not work well in every scenario.

3) How do you generally go about building from an old config? 

I generally use the config file from /proc/config.gz from my running kernel whenever I build a kernel upgrade. You do have to enable this as a feature in Kconfig but it's a great feature to have on trusted linux systems. I've had undesirable results in the past from building upgrade configs with make oldconfig and as a result I personally refuse to use it.

After updating your kernel symlink to the version your going to upgrade to

```
zcat /proc/config.gz >/usr/src/linux/.config
```

This still doesn't prevent Kconfig from making any required changes to the config for the new kernel sources so reviewing your entire kernel config is something that's both annoying and absolutely needed if you want a stable system.

4) I checked your motherboard for any available bios updates and it does have those available. Ideally your bios version should be at version F4. There is a beta bios available but I wouldn't advise using it unless you absolutely have a reason for it and fully understand the consequences.

http://www.gigabyte.com/products/product-page.aspx?pid=3138#bios

5) You could also check if your router has any firmware updates available. as remote as it may be that your router firmware is causing a problem it's always worth checking just to eliminate any contributing possibilities.

6) I also should ask how you have your network config setup? 

There was a couple fairly recent changes to both udev related to the kernel version requirements as well as baselayout/openrc for the network config. eselect news should have alerted you to those changes. If you still have the news in your eselect news list they would offer further details.

The major change to the baselayout/openrc is the depreciation of /etc/conf.d/network which no longer works correctly. The change has had all users go back to the traditional gentoo network setup. If you still have any custom entries in /etc/conf.d/network you should update your network scripts to use /etc/conf.d/net and delete the depreciated "network" file.

----------

## ali3nx

Just a side note I thought i would add in to share some wisdom imparted upon me almost ten years ago with regards to configuring kernel configurations or gentoo in general. 

I don't recall which gentoo developer shared this with me but it's a sentence that's definitely aided me in managing gentoo linux...

 *Quote:*   

> I enabled it because it looked cool!

 

Naturally this is some wise sarcasm but it's also the most valuable lesson i've ever learned in my 20 year career in IT   :Wink: 

----------

## ali3nx

One other valuable asset that could help you with your current issue is Pappy's kernel seeds...

http://kernel-seeds.org

----------

## micro8safe

Thanks, but I really don't think this is the kernel. One day it worked fine, rebooted with the same exact kernel that was solid for months, then it stops working automatically. The card works if I do the manual steps listed above, so the drivers are ok. I just really don't want to manually reset the card every time I reboot. 

I've tried updated the kernel just to make sure it wasn't the driver (I just copy my .config files to start make menuconfig). Updating the kernel made no difference.

/etc/conf.d/net 

```
config_eth0="dhcp"
```

----------

## jathlon

I notice you have a Realtek.

```
02:00.0 Ethernet controller: Realtek Semiconductor Co., Ltd. RTL8111/8168B PCI Express Gigabit Ethernet controller (rev 02)
```

Some recent versions have the "ability" to use a firmware blob.  Were you using the firmware?  Do you happen to have  sys-kernel/linux-firmware installed? Perhaps you were using the firmware without knowing about it. Was it updated/installed/removed recently on your machine?

My two previous gentoo boxes had realteks in them.  In both cases the network connection became increasingly unreliable as time and upgrades went by.  Both were upgraded with Intel PCIe nics and all networking problems disappeared.  The one motherboard I still have (downgraded to my windows machine) retains the Intel nic.

For an interesting poll about nics on a site that feature predominantly windows users;

http://techreport.com/forums/viewtopic.php?f=36&t=81669

joe

----------

