You are not logged in.
Hi all!
To avoid the XY problem, I'm explaining the original issue. My laptop apparently has issue with its NIC, and the wifi gives troubles at boot, and every time I resume from sleep (by opening the laptop's lid). Specifically, it can't connect, popping out some GNOME notifications. Turned out (thanks to the amazing community) I can simply solve the problem by issuing
modprobe -r mt76x0e
modprobe mt76x0eIt stops to work when I update the kernel, but alas.
A similar thing happens with the ethernet connection, but this time, almost only at startup. I can solve by issuing
ethtool -s enp2s0 speed 100 duplex fullNow, it's quite tedious to always type this commands (even put in a bash script, they still require root access). So my question is: how can I make them run automatically every time the PC boots and/or when I open the lid?
I thought to use a systemd service, but I have been suggested that udev is a better choice to control an hardware thing like the opening of the lid. The point is, I don't know how to write such a udev rule. Note that, in contrast, to run the scripts at boot maybe systemd would be better, so that I can wait for the network interface to be fired up (with network-online.target?)
Any help would be greatly appreciated, even a redirection to where I can read about these specific types of udev rules.
Thanks!
We are still learning
- wise people
Offline
I resume from sleep (by opening the laptop's lid)
You're actually not interested in the LID…
=> https://wiki.archlinux.org/title/Power_ … stem-sleep
Likewise blacklisting mt76x0e and explicitly loading it w/ a service (eg. after the multi-user.target) and having that service maybe also setting the enp2s0 speed will do.
What kind of udev event would you listen for "during boot"? When the NIC shows up on the bus? That's when the module is implcitily loaded anyway.
2 more things:
1. if you've a parallel windows installation, 3rd link below. Mandatory.
Disable it (it's NOT the BIOS setting!) and reboot windows and linux twice for voodo reasons.
2. because of the ethernet device: what does ethtool report on the NIC before you run that?
This kind of explicit speed configuration suggests there's an issue w/ the carrier stability and that almost always means "with the cable" (or the plugs)
Offline
Thanks!
Putting the script for the WiFi in /usr/lib/systemd/system-sleep (and modifying it accordingly) did the trick. That should be sufficient since WiFi is on when the PC boots.
For Windows start boot, I think I disabled it (but I can check), note however that Windows is on a different disk, and I boot Arch selecting the disk via UEFI (so that GRUB doesn't even see it). In this case, may it still be a problem?
Ethtool at boot report:
[alessandro@commodoroII ~]$ ethtool enp2s0
Settings for enp2s0:
Supported ports: [ TP MII ]
Supported link modes: 10baseT/Half 10baseT/Full
100baseT/Half 100baseT/Full
1000baseT/Full
Supported pause frame use: Symmetric Receive-only
Supports auto-negotiation: Yes
Supported FEC modes: Not reported
Advertised link modes: 10baseT/Half 10baseT/Full
100baseT/Half 100baseT/Full
1000baseT/Full
Advertised pause frame use: Symmetric Receive-only
Advertised auto-negotiation: Yes
Advertised FEC modes: Not reported
Speed: Unknown!
Duplex: Unknown! (255)
Auto-negotiation: on
master-slave cfg: preferred slave
master-slave status: unknown
Port: Twisted Pair
PHYAD: 0
Transceiver: external
MDI-X: Unknown
netlink error: Operation not permitted
Link detected: noNote that after a while I gave the same command
[alessandro@commodoroII ~]$ ethtool enp2s0
Settings for enp2s0:
Supported ports: [ TP MII ]
Supported link modes: 10baseT/Half 10baseT/Full
100baseT/Half 100baseT/Full
1000baseT/Full
Supported pause frame use: Symmetric Receive-only
Supports auto-negotiation: Yes
Supported FEC modes: Not reported
Advertised link modes: 10baseT/Half 10baseT/Full
100baseT/Half 100baseT/Full
1000baseT/Full
Advertised pause frame use: Symmetric Receive-only
Advertised auto-negotiation: Yes
Advertised FEC modes: Not reported
Speed: Unknown!
Duplex: Unknown! (255)
Auto-negotiation: on
master-slave cfg: preferred slave
master-slave status: unknown
Port: Twisted Pair
PHYAD: 0
Transceiver: external
MDI-X: Unknown
netlink error: Operation not permitted
Link detected: noand somehow the ethernet connection went up (the GNOME icon showed up). In fact, running it one more time gives:
[alessandro@commodoroII ~]$ ethtool enp2s0
Settings for enp2s0:
Supported ports: [ TP MII ]
Supported link modes: 10baseT/Half 10baseT/Full
100baseT/Half 100baseT/Full
1000baseT/Full
Supported pause frame use: Symmetric Receive-only
Supports auto-negotiation: Yes
Supported FEC modes: Not reported
Advertised link modes: 10baseT/Half 10baseT/Full
100baseT/Half 100baseT/Full
1000baseT/Full
Advertised pause frame use: Symmetric Receive-only
Advertised auto-negotiation: Yes
Advertised FEC modes: Not reported
Link partner advertised link modes: 10baseT/Half 10baseT/Full
100baseT/Half 100baseT/Full
1000baseT/Half 1000baseT/Full
Link partner advertised pause frame use: No
Link partner advertised auto-negotiation: Yes
Link partner advertised FEC modes: Not reported
Speed: 100Mb/s
Duplex: Full
Auto-negotiation: on
master-slave cfg: preferred slave
master-slave status: slave
Port: Twisted Pair
PHYAD: 0
Transceiver: external
MDI-X: Unknown
netlink error: Operation not permitted
Link detected: yesI use this PC as a workstation, so there's no much difference about when in the boot process I need the ethernet to be activated, I simply thought network-online.target would have been the most logical place. Am I wrong (highly probable)?
Thanks
We are still learning
- wise people
Offline
Link detected: no
that almost always means "with the cable" (or the plugs)
Edit
For Windows start boot, I think I disabled it (but I can check), note however that Windows is on a different disk, and I boot Arch selecting the disk via UEFI (so that GRUB doesn't even see it). In this case, may it still be a problem?
Check, windows keeps re-enabling that w/ updates and regardless of the situation at hand, this will cause trouble.
The disk is completely irrelevant itr, windows (any hibernatiing OS) leaves the HW in an undefined state.
Last edited by seth (2023-03-03 22:04:52)
Offline