There is something odd with your installation.
I just tried myself to "apt remove ethercat-master ethercat-dkms" followed by "apt install ethercat-master ethercat-dkms" and it worked just fine.
I do not get the "tainted kernel" message.
Can it be that you have compiled the ethercat master yourself at one point? And that the runnning ethercat master is looking for ec_generic in a place where it isn't?
It's a bit of guesswork and searching now.
Can you the command "sudo service ethercat status" and compare the ouput with mine?
Code:
debian@plasma:~$ sudo service ethercat status
● ethercat.service - EtherCAT Master Kernel Modules
Loaded: loaded (/lib/systemd/system/ethercat.service; enabled; preset: enabled)
Active: active (exited) since Thu 2025-05-08 20:32:57 CEST; 7min ago
Process: 78578 ExecStart=/usr/sbin/ethercatctl start (code=exited, status=0/SUCCESS)
Main PID: 78578 (code=exited, status=0/SUCCESS)
CPU: 25ms
maj 08 20:32:57 plasma systemd[1]: Starting ethercat.service - EtherCAT Master Kernel Modules...
maj 08 20:32:57 plasma systemd[1]: Finished ethercat.service - EtherCAT Master Kernel Modules.
Edit. Can you also repeat the search for ec_generic, but this time search for ec_master, in the same way?
Edit 2. No need to search. Instead show the output of the command "sudo modinfo ec_master", especially the first filename line.