I have a Raspbian (Debian Buster) 10 system on Raspberry Pi 4 hardware. When the system boots, I need to force the Ethernet eth0 to a speed of 100 mbps. (The equipment it connects to has a flaw in it’s ethernet controller that makes 1,000 mbps problematic.)
From my reading, it seems the proper way to do this is to create a script that sets the ethernet speed as I want it and then create a systemd service that will cause the script to be executed at boot time. I cannot get this to work.
From the command line, I can fix the speed at 100 mbps using the command:
ethtool -s eth0 speed 100 duplex full
This works fine. I can write a script with the above command in it and when executed, it works fine.
When I try to create a systemd unit file to run it at startup, it does not work. Looking at the systemd journal file it reads:
– Logs begin at Thu 2019-02-14 04:12:00 CST, end at Fri 2021-07-23 14:36:19 CDT. –
Jul 23 14:20:42 spilnx035 systemd: Starting Fix Ethernet Speed at 100 mbps…
Jul 23 14:20:42 spilnx035 fix-ethernet-speed.sh: Cannot get current device settings: Invalid argument
Jul 23 14:20:42 spilnx035 fix-ethernet-speed.sh: not setting speed
Jul 23 14:20:42 spilnx035 fix-ethernet-speed.sh: not setting duplex
Jul 23 14:20:43 spilnx035 systemd: fix-ethernet-speed.service: Succeeded.
Jul 23 14:20:43 spilnx035 systemd: Started Fix Ethernet Speed at 100 mbps.
(The second to last line above is not correct. The speed remains at 1,000 mbps)
My unit file for systemd looks like this:
[Unit] Description=Fix Ethernet Speed at 100 mbps [Service] Type=oneshot ExecStart=/usr/bin//fix-ethernet-speed.sh [Install] WantedBy=multi-user.target
Before rebooting I have run the command:
Note: I have no experience in creating these systemd service entries. I expect that is where my error is but do not know that for sure.
Thank you in advance for any help.