# [Solved] Strange networking behaviour

## creaker

Hi.

I just finished installation (the very basic system, kernel+grub) and rebooted. After reboot I found a strange problem with networking.

Or maybe it is a modules problem. Or maybe it is a kernel problem.

The thing is lsmod shows nothing. Module for Ethernet was built (r8169) and installed, but not loaded. ifconfig -a shows net.lo interface only.

After "modprobe r8169" new interface appears in ifconfig output. But it's name is not enp4s0 (as was during system install). It has an old name: eth0 ... I can start it: "/etc/init.d/net.eth0 start" and and get internet connection. On next boot I have to do all the steps again: modprobe + eth0 start. Though I tried to add eth0 to default runlevel.

My .config: http://pastebin.com/M88z3rGA

What's wrong here?Last edited by creaker on Sun Nov 17, 2013 8:57 am; edited 1 time in total

----------

## Hu

Why did you make your network driver a module?  That seems like a feature you would want to have builtin to the kernel.

If the module is not automatically loaded, then you cannot have the interface automatically start at boot, since the interface will not exist.  I suggest making the network driver builtin, then investigating whether other problems remain.

----------

## NeddySeagoon

creaker,

udev is renaming eth0 for you. Its a feature.

If you want to use eth0, tell udev not to use the new name, otherwise use enp4s0 everywhere you would use eth0

----------

## creaker

I always had r8169 as module (CONFIG_R8169=m) and it worked.

I'll try to build it into kernel...

----------

## creaker

I built r8169 into kernel. Networking starts, but it takes a lot: about 50 seconds(!) to bring it up. As well as if I starting networking manually.

I checked messages but nothing helpful.

----------

## creaker

another one problem: with built-in r8169 system hangs on halt/reboot

It seems I have to do a thorough audit of kernel config. Probably I removed too much options.

----------

## Gusar

 *creaker wrote:*   

> I built r8169 into kernel. Networking starts, but it takes a lot: about 50 seconds(!) to bring it up. As well as if I starting networking manually.

 

You're missing firmware. The kernel fails to load it, so it asks udev to do it. Udev will then try to load the firmware until a timeout (60 sec) expires and only then bring up the interface. Networking will still work because this firmware is optional.

You have two choices:

a) Check dmesg to see which firmware file failed to load and include it in the kernel. This way the kernel will be able to load it. You'll find it in the linux-firmware package.

b) Disable the the userspace firmware helper in the kernel. That way, when the kernel fails to load firmware, it will not ask udev to do it, so no waiting for a timeout.

----------

## creaker

NeddySeagoon

I know about interface renaming. I expected it will be renamed to enp4s0 and I configured conf.d/net accordingly. But for unknown reason interface was not renamed and I got an old name: eth0. 

Gusar

I checked dmesg for firmware - nothing.

Userspace firmware helper hard enabled (marked as -*-), I can't to disable it.

----------

## creaker

Seems it is not .config issue. I copied .config from another gentoo box (that works fine) and rebuilt kernel - the same problem:

1. No r8169 module loaded at boot

2. On "modprobe r8169" I get old-fashioned named (eth0) interface

3. When trying to start eth0 I have to wait for 50 seconds to get networking ready

As well it is not a hardware problem: I tested it by booting arch usb stick: arch boots in 8 seconds and I have internet connected immediately after booting.

May be it is a kernel ? This machine runs 3.10.17 kernel. Machine where I copied .config runs 3.10.7 kernel. Is it worth to try to install older kernel (3.10.7)?

----------

## NeddySeagoon

creaker,

The wait is the firmware loading timeout.

dmesg will tell the firmware file name.

If r8169 is built into the kernel, the firmware must be too.

----------

## Gusar

Did you check dmesg after those 50 sec? That's when the message about failing to load firmware will appear. It's there for sure, it'll be something like rtl_nic/rtl8168e-3.fw (that's the file I need, there are several files in the rtl_nic directory of the linux-firmware package). Did you install the linux-firmware package yet? It seems not, because that should actually get rid of the delay already.

@NeddySeagoon: Nowadays firmware does not need to be in the kernel anymore if the driver is. That's because it will not be loaded when the driver starts, but when you want to bring the interface up. There might be devices where it's still needed (I have no idea about radeon for example), but for network cards firmware can be in userspace if the kernel has the userspace helper activated.

----------

## creaker

I tried to get networking with older kernel (3.10.7) but fails with the same result. Kernel 3.10.7 + OpenRC 0.11.8 + r8169 works just fine at one machine and refuses to work at another similar box.

I decided to reinstall the system and totally stuck after unpacking stage tarball: can't even emerge gentoo-sources due to sys-devel/bc versions mismatch. 

Emerge requires bc-1.06.95.tar.bz2 but fails after checking a lot of mirrors: no such file... I checked some of the mirrors - it is really does not exists. All messed up. What's going on?

 :Rolling Eyes: 

may be I have had to try linux-firmware, but I never used it before, so why I have to use it now?

Anyway right now I can't to fetch gentoo-sources. Looks like portage tree was updated before mirrors was populated with required packages.

----------

## NeddySeagoon

Gusar,

My experience with network card firmware, also for a r1869 card, is limited to diskless systems.

With root over NFS, choices are limited.  :)

creaker,

linux-firmware is a huge collection of firmware files. You can configure what you install.  Firmware files are also available separately.

Which cards need firmware seems to vary and all the r8169 cards operate without it but if the driver tries to load it and fails, the timeout is 60 sec.

----------

## creaker

It seems that the gods turned their backs on me  :Very Happy: 

They won't I'll install gentoo.

I found bc-1.06.95.tar.bz2 on the net, downloaded it and put it under distfiles. But still can't emerge gentoo-sources:

```
>>>> Downloading 'http://distfiles.gentoo.org/distfiles/linux-3.10.tar.xz'

--2013-11-16 18:19:57-- http://distfiles.gentoo.org/distfiles/linux-3.10.tar.xz

Resolving distfiles.gentoo.org... failed: Name or service not known.

wget: unable to resolve host address 'distfiles.gentoo.org'
```

at the same time:

```
ping distfiles.gentoo.org

PING distfiles.gentoo.org (140.211.166.134) 56(84) bytes of data.

64 bytes from ftp-osl.osuosl.org (140.211.166.134): icmp_seq=1 ttl=44 time=258ms

64 bytes from ftp-osl.osuosl.org (140.211.166.134): icmp_seq=2 ttl=44 time=258ms

```

```
cat /etc/resolv.conf

nameserver 8.8.8.8
```

but I can download these packages if I out of chroot (directly from live media).

----------

## Hu

What is the output of ls -l on your in-chroot /etc/resolv.conf?

----------

## creaker

Hu

Yeah, it is: wrong permissions:

```
ls -l /etc/resolv.conf

-rw------- 1 root root 19 Nov 16 16:14
```

I recreated resolv.conf and got

```
-rw-r--r--
```

I be able to emerge gentoo-sources and can continue to deal with kernel, modules and firmwares.

Lets see if module problem will appear again

----------

## creaker

So, I've reinstalled the system. Still have no r8169 loaded at boot.

I had to add it to /etc/conf.d/modules and emerge linux-firmware. It helped. But is it a new way to go now?

And why old eth0 name came back?

----------

## creaker

And still can't to halt the system: after killing remaining processes and remounting / read only machine just hangs. Is it related to linux-firmware or module r8169?

Reboot works fine.

----------

## creaker

Halt issue fixed as well by enabling kernel APM (advanced power management) option.

Just out of curiosity: why I had to use stuffs that I never used before - linux-firmware and APM?

I would understood it if it was some new features, but it is not...

Thanks for helping, guys!

----------

## Hu

APM is very old and is superseded by ACPI.  You should use ACPI if possible.

----------

