Need to run a command at boot pre KDE

Hi there,

Due to a unsolved jme driver issue with my wired network adapter, I have to run a command after each boot and login to KDE in Tumbleweed. (see thread https://forums.opensuse.org/showthread.php/518397-Network-interface-(wired)-detected-by-Yast-but-not-connected-Tumbleweed)
I would love to have this command:

sudo /usr/sbin/ethtool -s enp2s0f5 speed 100 duplex full

to run as root pre KDE, so that everything including mounting remote network drives is up and running before I or other users login
.
But how do I do that in a simple way. I have tried to lookup several - for me - rather complicated scrips, so I hope someone can explain me this in a basic way or point me in the right direction.

Thank You in advance, Søren

I would use a udev rule for that.

Create the file

/etc/udevrules.d/99-my_enp2s0f5.rules

containing


ACTION=="add|change", SUBSYSTEM=="net", KERNEL=="enp2s0f5", RUN+="/usr/sbin/ethtool -s %k speed 100 duplex full"

and unload/reload the respective kernel module or reboot.

AK

ARGH

Correction, make that file name:

/etc/udev/rules.d/99-my_enp2s0f5.rules

AK

Hi AK,

Thank You for Your help and suggestion. Unfortunately it will not work - neither with wicked network management or network manager.
When I look at the output in boot.log it seems that the boot process stalls at finding the network interface.

In the **/etc/udev/rules.d **folder another - but empty - network related file is created at every boot called “70-persistent-net.rules”.

So I am still wondering what to do.

Rgds Soren

  • You could make a systemd service for it and then enable that so that it runs everytime the system boots up
  • You could put your command into a script that is run by your Display Manager

For wicked, you can add the following option in your ifcfg-* config file

ETHTOOL_OPTIONS=’autoneg off speed 100 duplex full’

Refer man ifcfg

ETHTOOL_OPTIONS suffix ]
If this variable is not empty, wicked will set these options on an ethernet type device. See the ethtool (8) manual page for
available options. If the option string starts with a ‘-’ (e.g. ‘-K iface rx on’), then the second word in the string will be
replaced with the current interface name. Otherwise (e.g. ‘autoneg off speed 10’) ifup prepends ‘-s <interface>’. The
optional variable suffix can be used to apply every setting separately, e.g.:

            ETHTOOL_OPTIONS='autoneg off speed 10'
            ETHTOOL_OPTIONS_gro='-K iface gro off'
            ETHTOOL_OPTIONS_lro='-K iface lro off'
          The NIC driver may reject settings as not supported (e.g. '-K iface lro off') or also when the link is not up.

For NetworkManager, create a dispatcher script with the ethtool command.

Thank You.
I changed to wicked and added the ETHTOOL OPTION to the config file and it works perfectly.
Thanks

Glad to have been of help.