You are not logged in.

#1 2016-01-21 19:27:25

mouseman
Member
From: Outta nowhere
Registered: 2014-04-04
Posts: 291

[Solved] modprobe and new_id -> how do I make this permanent?

I have a Qualcomm Atheros E2400 NIC (also called Killer NIC) that's not supported by default. I see posts here and on the internet about compiling a module or applying kernel patches, but I found a much more elegant way by scrolling down on the askubuntu forums.

# modprobe alx
# echo 1969 e0a1 > /sys/bus/pci/drivers/alx/new_id
[  102.690627] alx 0000:04:00.0 eth0: Qualcomm Atheros AR816x/AR817x Ethernet [40:8d:5c:50:9f:a8]
[  102.692102] alx 0000:04:00.0 enp4s0: renamed from eth0
[  102.715048] IPv6: ADDRCONF(NETDEV_UP): enp4s0: link is not ready
[  102.716121] IPv6: ADDRCONF(NETDEV_UP): enp4s0: link is not ready
[  105.708564] alx 0000:04:00.0 enp4s0: NIC Up: 1 Gbps Full
[  105.709137] IPv6: ADDRCONF(NETDEV_CHANGE): enp4s0: link becomes ready

Voila! It works.

After a reboot though, this is gone. I can simply put this in some script but I'm sure there's a better way to make this stick. What's the proper way of making this permanent?

Thanks!

Last edited by mouseman (2016-01-24 08:15:23)

Offline

#2 2016-01-21 19:30:09

Slithery
Administrator
From: Norfolk, UK
Registered: 2013-12-01
Posts: 5,776

Re: [Solved] modprobe and new_id -> how do I make this permanent?

This will do the first part...
https://wiki.archlinux.org/index.php/Ke … e_handling

I'm not sure about the second part though.


No, it didn't "fix" anything. It just shifted the brokeness one space to the right. - jasonwryan
Closing -- for deletion; Banning -- for muppetry. - jasonwryan

aur - dotfiles

Offline

#3 2016-01-21 19:38:57

mouseman
Member
From: Outta nowhere
Registered: 2014-04-04
Posts: 291

Re: [Solved] modprobe and new_id -> how do I make this permanent?

Thanks. I knew that part too, it's the second part I'm not sure of either.

I'm sure it's fine putting it in some script somewhere, I'm not dependent on this NIC as it's the second one used by virtual machines that I only start manually.

I'm just interested to know how to do this if it were my only NIC that I wanted to load during boot time.

Offline

#4 2016-01-21 20:20:28

bart_vv
Member
From: Poland
Registered: 2011-04-12
Posts: 51

Re: [Solved] modprobe and new_id -> how do I make this permanent?

Maybe systemd oneshot service set with something like "Before=network" would do the trick?

Offline

#5 2016-01-21 21:03:20

mich41
Member
Registered: 2012-06-22
Posts: 796

Re: [Solved] modprobe and new_id -> how do I make this permanent?

I think only some script launched like bart_vv suggested would work. Otherwise, you would need some special support for this feature in udev and pretty likely there is none. Though you may try your luck with google.

Anyway, it's a cool trick this new_id. I didn't know something like that exists.

Last edited by mich41 (2016-01-21 21:05:02)

Offline

#6 2016-01-22 11:14:33

mouseman
Member
From: Outta nowhere
Registered: 2014-04-04
Posts: 291

Re: [Solved] modprobe and new_id -> how do I make this permanent?

mouseman wrote:

Thanks. I knew that part too, it's the second part I'm not sure of either.

I'm sure it's fine putting it in some script somewhere, I'm not dependent on this NIC as it's the second one used by virtual machines that I only start manually.

I'm just interested to know how to do this if it were my only NIC that I wanted to load during boot time.

This is probably the best way.

I'll have a look tomorrow.

Thanks!

Offline

#7 2016-01-24 08:15:12

mouseman
Member
From: Outta nowhere
Registered: 2014-04-04
Posts: 291

Re: [Solved] modprobe and new_id -> how do I make this permanent?

Created the following file as /usr/lib/systemd/system/killer-nic.service:

[Unit]
Description=Loads alx module and inserts new id's
Before=network

[Service]
Type=oneshot
ExecStart=-/sbin/modprobe -q alx
ExecStart=/bin/bash -c "echo '1969 e0a1' > /sys/bus/pci/drivers/alx/new_id"

[Install]
WantedBy=multi-user.target

Enabled it:

# systemctl enable killer-nic.service 
Created symlink from /etc/systemd/system/multi-user.target.wants/killer-nic.service to /usr/lib/systemd/system/killer-nic.service.

Reboot, the NIC shows up smile.

Awesomeness!

Offline

#8 2016-01-24 09:55:50

ukhippo
Member
From: Non-paged pool
Registered: 2014-02-21
Posts: 366

Re: [Solved] modprobe and new_id -> how do I make this permanent?

mich41 wrote:

I think only some script launched like bart_vv suggested would work. Otherwise, you would need some special support for this feature in udev and pretty likely there is none. Though you may try your luck with google.

Anyway, it's a cool trick this new_id. I didn't know something like that exists.

You can write to sysfs in udev rules, so you could try having a rule along the lines of:

<matches>, ATTR{new_id}="whatever"

You just need to make sure your matches uniquely match the device (you wouldn't want to set new_id on wrong/parent devices!).

Edit: obviously the matches should include the old id.

Last edited by ukhippo (2016-01-24 11:07:23)

Offline

Board footer

Powered by FluxBB