Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
USB ethernet fails to start automatically
View unanswered posts
View posts from last 24 hours

 
Reply to topic    Gentoo Forums Forum Index Kernel & Hardware
View previous topic :: View next topic  
Author Message
grant123
l33t
l33t


Joined: 23 Mar 2005
Posts: 989

PostPosted: Sat May 10, 2014 2:57 pm    Post subject: USB ethernet fails to start automatically Reply with quote

I'm having a problem with my USB ethernet interface not starting automatically in the default runlevel. It tries but fails:

* Bringing up interface enp0s20u2u2
* ERROR: interface enp0s20u2u2 does not exist
* Ensure that you have loaded the correct kernel module for your hardware
* ERROR: net.enp0s20u2u2 failed to start

Once the system is booted, I can run 'rc' and it starts fine every time. I have 5 identical laptops (with no built-in ethernet) set up this way and they all exhibit the problem. I just upgraded to udev-212-r1 which I was hoping would fix the problem but it has not. Everything comes up OK if I use rc_hotplug="net.*" because other services call on net.enp0s20u2u2 to start after it initially fails, but I'd rather not enable hotplug.

I worked on this in another thread here:

https://forums.gentoo.org/viewtopic-t-989698.html

but we hit a dead-end and I have a clearer picture of what's happening now so I thought I would start a more focused thread.


Last edited by grant123 on Mon May 12, 2014 4:58 pm; edited 2 times in total
Back to top
View user's profile Send private message
Hu
Moderator
Moderator


Joined: 06 Mar 2007
Posts: 13990

PostPosted: Sat May 10, 2014 3:46 pm    Post subject: Reply with quote

My first guess would be that your unpredictable interface names are not appearing in time, so at the time that net.enp0s20u2u2 is activated, the interface is still named eth0. Later, udev renames it to enp0s20u2u2, after which starting it will succeed. You could test this by modifying the net startup script to log the output of ip l prior to bringing up each interface.
Back to top
View user's profile Send private message
grant123
l33t
l33t


Joined: 23 Mar 2005
Posts: 989

PostPosted: Sat May 10, 2014 3:48 pm    Post subject: Reply with quote

Judging by what I've seen in the logs, I think you are 100% correct. What can I do to fix this?
Back to top
View user's profile Send private message
Jaglover
Watchman
Watchman


Joined: 29 May 2005
Posts: 7136
Location: Saint Amant, Acadiana

PostPosted: Sat May 10, 2014 4:01 pm    Post subject: Reply with quote

Add net.ifnames=0 to kernel command line or switch to eudev. You will have predictable nodes again.
_________________
Please learn how to denote units correctly!
Back to top
View user's profile Send private message
NeddySeagoon
Administrator
Administrator


Joined: 05 Jul 2003
Posts: 43412
Location: 56N 3W

PostPosted: Sat May 10, 2014 4:03 pm    Post subject: Reply with quote

grant123,

Tell udev to leave the kernel assigned names alone.
Append net.ifnames=0 to your kernel line in grub.conf.

Jaglover wins by 2 min :)
_________________
Regards,

NeddySeagoon

Computer users fall into two groups:-
those that do backups
those that have never had a hard drive fail.
Back to top
View user's profile Send private message
grant123
l33t
l33t


Joined: 23 Mar 2005
Posts: 989

PostPosted: Sat May 10, 2014 4:56 pm    Post subject: Reply with quote

Can I fix this and keep the current naming behavior?
Back to top
View user's profile Send private message
Jaglover
Watchman
Watchman


Joined: 29 May 2005
Posts: 7136
Location: Saint Amant, Acadiana

PostPosted: Sat May 10, 2014 5:15 pm    Post subject: Reply with quote

There are probably many ways to do that, one of them would be to bring it up in /etc/local.d.
_________________
Please learn how to denote units correctly!
Back to top
View user's profile Send private message
grant123
l33t
l33t


Joined: 23 Mar 2005
Posts: 989

PostPosted: Sat May 10, 2014 5:30 pm    Post subject: Reply with quote

But in the default runlevel there are several services which depend on the network.
Back to top
View user's profile Send private message
NeddySeagoon
Administrator
Administrator


Joined: 05 Jul 2003
Posts: 43412
Location: 56N 3W

PostPosted: Sat May 10, 2014 9:18 pm    Post subject: Reply with quote

grant123,

You don't really want to for USB network interfaces. enp0s20u2u2 is named after the USB port your USB network interface is plugged into, so plug it into a different port and it will get a new name.

You can try to get USB networking up faster by building everything it needs into the kernel.
_________________
Regards,

NeddySeagoon

Computer users fall into two groups:-
those that do backups
those that have never had a hard drive fail.
Back to top
View user's profile Send private message
grant123
l33t
l33t


Joined: 23 Mar 2005
Posts: 989

PostPosted: Sat May 10, 2014 9:25 pm    Post subject: Reply with quote

You mean instead of loading modules? I actually don't load any modules that I know of.

I've gotten used to the new network names. It is nice to be able to plug any USB network adapter into a particular USB port to give it the same name.

Am I out of luck?
Back to top
View user's profile Send private message
NeddySeagoon
Administrator
Administrator


Joined: 05 Jul 2003
Posts: 43412
Location: 56N 3W

PostPosted: Sat May 10, 2014 9:31 pm    Post subject: Reply with quote

grant123,

The hotplug system will load modules for you. What does
Code:
lsmod
show?
_________________
Regards,

NeddySeagoon

Computer users fall into two groups:-
those that do backups
those that have never had a hard drive fail.
Back to top
View user's profile Send private message
grant123
l33t
l33t


Joined: 23 Mar 2005
Posts: 989

PostPosted: Sat May 10, 2014 9:50 pm    Post subject: Reply with quote

You fixed it! I had forgotten that I had xhci_hcd built as a module because previously I had needed to periodically unload and reload it to get my USB port working again but that hasn't been necessary for awhile. Thank you!
Back to top
View user's profile Send private message
grant123
l33t
l33t


Joined: 23 Mar 2005
Posts: 989

PostPosted: Mon May 12, 2014 4:57 pm    Post subject: Reply with quote

I spoke a little too soon. My system which is configured as a router with two USB ethernet interfaces still suffers from the problem:

Code:
Cannot find device "enp0s20u2u1"
 *   ERROR: interface enp0s20u2u1 does not exist
 *   Ensure that you have loaded the correct kernel module for your hardware
 * ERROR: net.enp0s20u2u1 failed to start
 * Bringing up interface enp0s20u2u2
Cannot find device "enp0s20u2u2"
 *   ERROR: interface enp0s20u2u2 does not exist
 *   Ensure that you have loaded the correct kernel module for your hardware
 * ERROR: net.enp0s20u2u2 failed to start


Code:
# lsmod
Module                  Size  Used by
#


The ethernet interfaces later come up fine if hotplug is enabled. What could it be?
Back to top
View user's profile Send private message
khayyam
Watchman
Watchman


Joined: 07 Jun 2012
Posts: 6228
Location: Room 101

PostPosted: Mon May 12, 2014 10:13 pm    Post subject: Reply with quote

grant123 wrote:
The ethernet interfaces later come up fine if hotplug is enabled. What could it be?

grant123 ... udev.

Arch Udev Wiki wrote:
Udev loads kernel modules by utilizing coding parallelism to provide a potential performance advantage versus loading these modules serially. The modules are therefore loaded asynchronously. The inherent disadvantage of this method is that udev does not always load modules in the same order on each boot.

... in your case udev is loading the drivers for the usb ethernet cards, but as it is "parallelised" it doesn't pause to allow that to happen, the entire boot process continues. At some point it tries to rename the devices but by this time the boot process has already arrived at "default" and the network interfaces are brought up, except those names don't exist (yet). So, if you want this not to happen, either disable "(non-)predictable device names" or build the drivers for these network devices into the kernel.

best ... khay
Back to top
View user's profile Send private message
grant123
l33t
l33t


Joined: 23 Mar 2005
Posts: 989

PostPosted: Mon May 12, 2014 10:51 pm    Post subject: Reply with quote

The drivers are actually built into the kernel. I don't have any modules loaded at all:

Code:
# lsmod
Module                  Size  Used by
#


I'm running 5 hardware-identical laptops like this but one is still struggling with the issue:

Code:
Cannot find device "enp0s20u2u1"
 *   ERROR: interface enp0s20u2u1 does not exist
 *   Ensure that you have loaded the correct kernel module for your hardware
 * ERROR: net.enp0s20u2u1 failed to start
 * Bringing up interface enp0s20u2u2
Cannot find device "enp0s20u2u2"
 *   ERROR: interface enp0s20u2u2 does not exist
 *   Ensure that you have loaded the correct kernel module for your hardware
 * ERROR: net.enp0s20u2u2 failed to start
Back to top
View user's profile Send private message
khayyam
Watchman
Watchman


Joined: 07 Jun 2012
Posts: 6228
Location: Room 101

PostPosted: Tue May 13, 2014 2:25 am    Post subject: Reply with quote

grant123 wrote:
The drivers are actually built into the kernel. I don't have any modules loaded at all

grant123 ... oh, in which case the ghost in the machine is parallelised to reach causal unpredictability :)

grant123 wrote:
I'm running 5 hardware-identical laptops like this but one is still struggling with the issue

Not "hardware-identical" in that all have 2x USB ethernet devices I assume?

best ... khay
Back to top
View user's profile Send private message
grant123
l33t
l33t


Joined: 23 Mar 2005
Posts: 989

PostPosted: Tue May 13, 2014 11:11 am    Post subject: Reply with quote

Quote:
Not "hardware-identical" in that all have 2x USB ethernet devices I assume?


No but another system does have two of them and works fine. They're all Dell XPS 13.
Back to top
View user's profile Send private message
khayyam
Watchman
Watchman


Joined: 07 Jun 2012
Posts: 6228
Location: Room 101

PostPosted: Tue May 13, 2014 1:30 pm    Post subject: Reply with quote

grant123 ... not sure this will work but you might try adding a delay ...

/etc/conf.d/net
Code:
preup() {
   if [ ! -d /sys/class/net/${IFACE} ]; then
     timeout="5"
     while { [ $timeout -gt 0 ] && [ ! -d /sys/class/net/${IFACE} ]; }; do
     timeout=$((timeout - 1)) ; sleep 1
   done
return 0
}

... thats *untested* so it may not work as expected, but hopefully it does provide a small delay, at least enough for the rename.

HTH & best ... khay
Back to top
View user's profile Send private message
grant123
l33t
l33t


Joined: 23 Mar 2005
Posts: 989

PostPosted: Wed May 21, 2014 12:47 pm    Post subject: Reply with quote

I ended up adding the delay with rootdelay=5 in the kernel command and everything works now. Thank you for your help!
Back to top
View user's profile Send private message
Display posts from previous:   
Reply to topic    Gentoo Forums Forum Index Kernel & Hardware All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum