- Posts: 12160
- Thank you received: 0
Ethercat installation from repositories - how to step by step
4 years 7 months ago #237098
by rodw
Update June 2026
Several things have happened recently:
1. the ethercat repository is not compiling the dkms module correctly.
2. A number of ethercat specific improvements involving changes to LinuxCNC (2.10), the linuxcnc-ethercat driver (2.98, 2.10) and the ethercat master have been made
3. A linuxcnc specific version of the ethercat master is now available at github.com/linuxcnc-ethercat/apt
Until these changes are incorporated into the LinuxCNC installer, Ensure secure boot (UEFI) is disabled in your BIOS) and after installing LinuxCNC from the downloads page at
linuxcnc.org/downloads/
please proceed as follows
1. Remove the iGh repsitories
2. Follow the instructions at github.com/linuxcnc-ethercat/apt to install ethercat
If this stil fails you may have UEFI (Secure boot) on your PC with the preempt_rt kernel (installed with linuxcnc) you need to do a bit more work. Open the spoiler:
If you have Secure Boot enabled (can be checked with mokutil --sb-state), some extra steps may be needed. AFAIK, the DKMS modules are signed with a generated key (/var/lib/dkms/mok.pub), this key needs to be enrolled as a Machine Owner Key (MOK).
on the General settings tab add the following to the kernel parameters
reboot and enter these commands. Do not forget the password
reboot again. This time the MOK Management Utility is used to enroll the key into the EFI environment.
Select enrol MOK from this menu, enter your password and answer the questions. (Some help prompts are displayed at the top of the screen)
After that, a SecureBoot-Enabled PREEMPT_RT Kernel is able to load DKMS modules.
obtain your mac address
Save the MAC address of the NIC to be used for ethercat
Update the ethercat config file to use that MAC address
set your Master0 device to your MAC address and device modules to generic. Make these edits
Note at this stage only the generic driver is available under the Bookworm kernel
save and close geany
Note, we have found in some circumstances ethercat master wants to use the first NIC listed in ip a if multiple NIC's are installed
If you experience problems after installation is complere, swap your network cables around and edit the MAC address in ethercat.conf
Enter these commands to start the ethercat service.
Ethercat should be running. If the above command is not found, you have a problem
You can list the slaves if you type
To ensure the ethercat port has permissions on startup. Create a udev rule
Add the following:
and reboot your computer.
Without this, on a restart, you always needed to chmod the ethercat port.
If you are using cia402 compatible drives:
so to test its working from Linuxcnc
If you don't have an xml config file yet (preferred), download an ethercat config file of mine from
github.com/rodw-au/linuxcnc-cia402/blob/main/ethercat-conf.xml
in that folder type:
You should see this and hopefully a few other pins displayed
Let us know how you get on.
Several things have happened recently:
1. the ethercat repository is not compiling the dkms module correctly.
2. A number of ethercat specific improvements involving changes to LinuxCNC (2.10), the linuxcnc-ethercat driver (2.98, 2.10) and the ethercat master have been made
3. A linuxcnc specific version of the ethercat master is now available at github.com/linuxcnc-ethercat/apt
Until these changes are incorporated into the LinuxCNC installer, Ensure secure boot (UEFI) is disabled in your BIOS) and after installing LinuxCNC from the downloads page at
linuxcnc.org/downloads/
please proceed as follows
1. Remove the iGh repsitories
Code:
sudo rm /etc/apt/sources.list.d/science_EtherLab.list
2. Follow the instructions at github.com/linuxcnc-ethercat/apt to install ethercat
If this stil fails you may have UEFI (Secure boot) on your PC with the preempt_rt kernel (installed with linuxcnc) you need to do a bit more work. Open the spoiler:
Warning: Spoiler!
If you have Secure Boot enabled (can be checked with mokutil --sb-state), some extra steps may be needed. AFAIK, the DKMS modules are signed with a generated key (/var/lib/dkms/mok.pub), this key needs to be enrolled as a Machine Owner Key (MOK).
Code:
sudo grub-customizer
Code:
efi=runtime
reboot and enter these commands. Do not forget the password
Code:
sudo mokutil --import /var/lib/dkms/mok.pub
input password:
input password again:
reboot again. This time the MOK Management Utility is used to enroll the key into the EFI environment.
Select enrol MOK from this menu, enter your password and answer the questions. (Some help prompts are displayed at the top of the screen)
After that, a SecureBoot-Enabled PREEMPT_RT Kernel is able to load DKMS modules.
obtain your mac address
Code:
ip a
Save the MAC address of the NIC to be used for ethercat
Update the ethercat config file to use that MAC address
Code:
sudo geany /etc/ethercat.conf
set your Master0 device to your MAC address and device modules to generic. Make these edits
Note at this stage only the generic driver is available under the Bookworm kernel
Code:
MASTER0_DEVICE="xx:aa:yy:zz:bb:cc"
DEVICE_MODULES="generic"
save and close geany
Note, we have found in some circumstances ethercat master wants to use the first NIC listed in ip a if multiple NIC's are installed
If you experience problems after installation is complere, swap your network cables around and edit the MAC address in ethercat.conf
Enter these commands to start the ethercat service.
Code:
sudo systemctl enable ethercat.service
sudo systemctl start ethercat.service
sudo systemctl status ethercat.service
sudo chmod 666 /dev/EtherCAT0
Ethercat should be running. If the above command is not found, you have a problem
You can list the slaves if you type
Code:
ethercat slaves
To ensure the ethercat port has permissions on startup. Create a udev rule
Code:
sudo geany /etc/udev/rules.d/99-ethercat.rules
Add the following:
Code:
KERNEL=="EtherCAT[0-9]", MODE="0777"
[code]
Save and exit, then type
[code]
sudo udevadm control --reload-rules
and reboot your computer.
Without this, on a restart, you always needed to chmod the ethercat port.
If you are using cia402 compatible drives:
Code:
cd ~/dev
git clone https://github.com/dbraun1981/hal-cia402
cd hal-cia402
sudo halcompile --install cia402.comp
so to test its working from Linuxcnc
If you don't have an xml config file yet (preferred), download an ethercat config file of mine from
github.com/rodw-au/linuxcnc-cia402/blob/main/ethercat-conf.xml
in that folder type:
Code:
halcmd loadusr -W lcec_conf ethercat-conf.xml
halcmd show pin lcec
You should see this and hopefully a few other pins displayed
Code:
Component Pins:
Owner Type Dir Value Name
4 u32 OUT 0x00000001 lcec.conf.master-count
4 u32 OUT 0x00000004 lcec.conf.slave-count
Let us know how you get on.
Please Log in to join the conversation.
4 years 7 months ago #237567
by rodw
Replied by rodw on topic Ethercat installation from repositories - how to step by step
UPDATE: Following the release Of linuxCNC 2.9.2 install linuxcnc from the downloads page
linuxcnc.org/downloads/
After installation, refer to the brief instructions in your home folder.
Recently the linuxcnc hal ethercat driver has moved and is actively maintained. It is now hosted by iGh on their repository. This repository is installed by the 2.9.2 ISO.
Open a terminal and type the following
This should work as all the ethercat stuff is now set as dependencies.
If that fails, try this complete command:
If this stil fails you may have UEFI (Secure boot) on your PC with the preempt_rt kernel (installed with linuxcnc) you need to do a bit more work. Open the spoiler:
If you have Secure Boot enabled (can be checked with mokutil --sb-state), some extra steps may be needed. AFAIK, the DKMS modules are signed with a generated key (/var/lib/dkms/mok.pub), this key needs to be enrolled as a Machine Owner Key (MOK).
on the General settings tab add the following to the kernel parameters
reboot and enter these commands. Do not forget the password
reboot again. This time the MOK Management Utility is used to enroll the key into the EFI environment.
Select enrol MOK from this menu, enter your password and answer the questions. (Some help prompts are displayed at the top of the screen)
After that, a SecureBoot-Enabled PREEMPT_RT Kernel is able to load DKMS modules.
obtain your mac address
Save the MAC address of the NIC to be used for ethercat
Update the ethercat config file to use that MAC address
set your Master0 device to your MAC address and device modules to generic. Make these edits
Note at this stage only the generic driver is available under the Bookworm kernel
save and close geany
Note, we have found in some circumstances ethercat master wants to use the first NIC listed in ip a if multiple NIC's are installed
If you experience problems after installation is complere, swap your network cables around and edit the MAC address in ethercat.conf
Enter these commands to start the ethercat service.
Ethercat should be running. If the above command is not found, you have a problem
You can list the slaves if you type
If you are using cia402 compatible drives:
so to test its working from Linuxcnc
If you don't have an xml config file yet (preferred), download an ethercat config file of mine from
github.com/rodw-au/linuxcnc-cia402/blob/main/ethercat-conf.xml
in that folder type:
You should see this and hopefully a few other pins displayed
To ensure the ethercat port has permissions on startup. Create a udev rule
Add the following:
Save and exit, then type
and reboot your computer.
Without this, on a restart, you always needed to chmod the ethercat port.
Let us know how you get on.
linuxcnc.org/downloads/
After installation, refer to the brief instructions in your home folder.
Recently the linuxcnc hal ethercat driver has moved and is actively maintained. It is now hosted by iGh on their repository. This repository is installed by the 2.9.2 ISO.
Open a terminal and type the following
Code:
sudo apt update
sudo apt install linuxcnc-ethercat
If that fails, try this complete command:
Code:
sudo apt install ethercat-master libethercat-dev linuxcnc-ethercat
If this stil fails you may have UEFI (Secure boot) on your PC with the preempt_rt kernel (installed with linuxcnc) you need to do a bit more work. Open the spoiler:
Warning: Spoiler!
If you have Secure Boot enabled (can be checked with mokutil --sb-state), some extra steps may be needed. AFAIK, the DKMS modules are signed with a generated key (/var/lib/dkms/mok.pub), this key needs to be enrolled as a Machine Owner Key (MOK).
Code:
sudo grub-customizer
Code:
efi=runtime
Code:
sudo mokutil --import /var/lib/dkms/mok.pub
input password:
input password again:
Select enrol MOK from this menu, enter your password and answer the questions. (Some help prompts are displayed at the top of the screen)
After that, a SecureBoot-Enabled PREEMPT_RT Kernel is able to load DKMS modules.
obtain your mac address
Code:
ip a
Update the ethercat config file to use that MAC address
Code:
sudo geany /etc/ethercat.conf
Note at this stage only the generic driver is available under the Bookworm kernel
Code:
MASTER0_DEVICE="xx:aa:yy:zz:bb:cc"
DEVICE_MODULES="generic"
Note, we have found in some circumstances ethercat master wants to use the first NIC listed in ip a if multiple NIC's are installed
If you experience problems after installation is complere, swap your network cables around and edit the MAC address in ethercat.conf
Enter these commands to start the ethercat service.
Code:
sudo systemctl enable ethercat.service
sudo systemctl start ethercat.service
sudo systemctl status ethercat.service
sudo chmod 666 /dev/EtherCAT0
You can list the slaves if you type
Code:
ethercat slaves
If you are using cia402 compatible drives:
Code:
cd ~/dev
git clone https://github.com/dbraun1981/hal-cia402
cd hal-cia402
sudo halcompile --install cia402.comp
If you don't have an xml config file yet (preferred), download an ethercat config file of mine from
github.com/rodw-au/linuxcnc-cia402/blob/main/ethercat-conf.xml
in that folder type:
Code:
halcmd loadusr -W lcec_conf ethercat-conf.xml
halcmd show pin lcec
Code:
Component Pins:
Owner Type Dir Value Name
4 u32 OUT 0x00000001 lcec.conf.master-count
4 u32 OUT 0x00000004 lcec.conf.slave-count
To ensure the ethercat port has permissions on startup. Create a udev rule
Code:
sudo geany /etc/udev/rules.d/99-ethercat.rules
Add the following:
Code:
KERNEL=="EtherCAT[0-9]", MODE="0777"
Save and exit, then type
Code:
sudo udevadm control --reload-rules
and reboot your computer.
Without this, on a restart, you always needed to chmod the ethercat port.
Let us know how you get on.
Please Log in to join the conversation.
4 years 6 months ago #241740
by rodw
Replied by rodw on topic Ethercat installation from repositories - how to step by step
One more update to ensure the ethercat port has permissions on startup. Create a udev rule
Add the following:
Save and exit, then type
and reboot your computer.
Without this, on a restart, you always needed to chmod the ethercat port.
Code:
sudo nano /etc/udev/rules.d/99-ethercat.rules
Add the following:
Code:
KERNEL=="EtherCAT[0-9]", MODE="0777"
Save and exit, then type
Code:
sudo udevadm control --reload-rules
and reboot your computer.
Without this, on a restart, you always needed to chmod the ethercat port.
Please Log in to join the conversation.
4 years 5 months ago #243096
by rodw
Replied by rodw on topic Ethercat installation from repositories - how to step by step
In the two steps above where we wget the security key and edit sources.list, you will see we used Debian_10 (which is buster)
For later Debian distros, If you get security issues, replace Debian_10 as follows
For more info review the repo notes (click on show more):
build.opensuse.org/project/show/home:bon...hes:science:EtherLab
For later Debian distros, If you get security issues, replace Debian_10 as follows
Code:
Bullseye: Debian_11
Testing (aka currently Bookworm): Debian_Testing
For more info review the repo notes (click on show more):
build.opensuse.org/project/show/home:bon...hes:science:EtherLab
Please Log in to join the conversation.
4 years 3 months ago #246380
by DmitryKV
Replied by DmitryKV on topic Ethercat installation from repositories - how to step by step
Hello.
Tell me, is there a description of the rules for compiling an xml file or a schema? Intuitively, of course, it is clear what data is described in xml. But if there is a scheme, this would help to avoid mistakes in names. It would be nice to know what names are available for description. For example, there is a line in xml <dcConf assignActivate="300" sync0Cycle="*1" sync0Shift="0"/>
Probably dcConf is Distributed Clocks, very similar. It would be nice if didn't have to guess.
For me, this topic is new, maybe I do not know the obvious things. Please be understanding.
Regards, Dmitry
Tell me, is there a description of the rules for compiling an xml file or a schema? Intuitively, of course, it is clear what data is described in xml. But if there is a scheme, this would help to avoid mistakes in names. It would be nice to know what names are available for description. For example, there is a line in xml <dcConf assignActivate="300" sync0Cycle="*1" sync0Shift="0"/>
Probably dcConf is Distributed Clocks, very similar. It would be nice if didn't have to guess.
For me, this topic is new, maybe I do not know the obvious things. Please be understanding.
Regards, Dmitry
Please Log in to join the conversation.
4 years 3 months ago #248388
by kangkang
Replied by kangkang on topic Ethercat installation from repositories - how to step by step
hello!!
EtherCAT installation is in progress using LinuxCNC 2.8.2 Debian 10 Buster PREEMPT-RT ISO provided on LinuxCNC official website.
EtherCAT was installed by referring to the well described installation process.
After that, the systemctl start ethercat.service command was executed, but an error occurred.
If execute the sudo systemctl status ethercat.service command, the following error message is displayed.
● ethercat.service - EtherCAT Master Kernel Modules
Loaded: loaded (/lib/systemd/system/ethercat.service; enabled; vendor preset: enabled)
Active: failed (Result: exit-code) since Wed 2022-07-27 14:08:46 KST; 4min 14s ago
Process: 2355 ExecStart=/usr/sbin/ethercatctl start (code=exited, status=1/FAILURE)
Main PID: 2355 (code=exited, status=1/FAILURE)
Jul 27 14:08:46 192 systemd[1]: Starting EtherCAT Master Kernel Modules...
Jul 27 14:08:46 192 ethercatctl[2355]: modprobe: FATAL: Module ec_master not found in directory /lib/modules/4.19.0-17-rt-amd64
Jul 27 14:08:46 192 systemd[1]: ethercat.service: Main process exited, code=exited, status=1/FAILURE
Jul 27 14:08:46 192 systemd[1]: ethercat.service: Failed with result 'exit-code'.
Jul 27 14:08:46 192 systemd[1]: Failed to start EtherCAT Master Kernel Modules.
Is there any way to solve the following error?
Thank you!!
EtherCAT installation is in progress using LinuxCNC 2.8.2 Debian 10 Buster PREEMPT-RT ISO provided on LinuxCNC official website.
EtherCAT was installed by referring to the well described installation process.
After that, the systemctl start ethercat.service command was executed, but an error occurred.
If execute the sudo systemctl status ethercat.service command, the following error message is displayed.
● ethercat.service - EtherCAT Master Kernel Modules
Loaded: loaded (/lib/systemd/system/ethercat.service; enabled; vendor preset: enabled)
Active: failed (Result: exit-code) since Wed 2022-07-27 14:08:46 KST; 4min 14s ago
Process: 2355 ExecStart=/usr/sbin/ethercatctl start (code=exited, status=1/FAILURE)
Main PID: 2355 (code=exited, status=1/FAILURE)
Jul 27 14:08:46 192 systemd[1]: Starting EtherCAT Master Kernel Modules...
Jul 27 14:08:46 192 ethercatctl[2355]: modprobe: FATAL: Module ec_master not found in directory /lib/modules/4.19.0-17-rt-amd64
Jul 27 14:08:46 192 systemd[1]: ethercat.service: Main process exited, code=exited, status=1/FAILURE
Jul 27 14:08:46 192 systemd[1]: ethercat.service: Failed with result 'exit-code'.
Jul 27 14:08:46 192 systemd[1]: Failed to start EtherCAT Master Kernel Modules.
Is there any way to solve the following error?
Thank you!!
Please Log in to join the conversation.
4 years 2 months ago #248724
by andypugh
Replied by andypugh on topic Ethercat installation from repositories - how to step by step
Do you have anything in /lib/modules with a slightly different name?
Please Log in to join the conversation.
4 years 2 months ago #248747
by rodw
Replied by rodw on topic Ethercat installation from repositories - how to step by step
Did you read this post earlier in this thread?
forum.linuxcnc.org/ethercat/45336-etherc...-step-by-step#237567
That should fix it.
forum.linuxcnc.org/ethercat/45336-etherc...-step-by-step#237567
That should fix it.
Please Log in to join the conversation.
4 years 1 month ago #251037
by CORBETT
Replied by CORBETT on topic Ethercat installation from repositories - how to step by step
Rod,
Things have changed in the last year or so... Yesterday was my birthday so I decided to do a full EtherCAT build from scratch. Put on Buster 10, then RIP of LCNC, Started to build the EC-Debianize and then found that the Mercurial servers were not there.... Got confused..
Then looked up that it has migrated to Gitlab.
So, I decided to follow your path and it was seamless, very easy. Put the master on in no time and have slaves recognized. Will build the driver tonight.
Anyway, will be hard not to do a
sudo update-ethercat-config
after adding the hardware address... it's burned in my brain LOL
Robert
Things have changed in the last year or so... Yesterday was my birthday so I decided to do a full EtherCAT build from scratch. Put on Buster 10, then RIP of LCNC, Started to build the EC-Debianize and then found that the Mercurial servers were not there.... Got confused..
Then looked up that it has migrated to Gitlab.
So, I decided to follow your path and it was seamless, very easy. Put the master on in no time and have slaves recognized. Will build the driver tonight.
Anyway, will be hard not to do a
sudo update-ethercat-config
after adding the hardware address... it's burned in my brain LOL
Robert
Please Log in to join the conversation.
- sqmathlete
- Offline
- Premium Member
-
Less
More
- Posts: 118
- Thank you received: 0
4 years 4 weeks ago #253270
by sqmathlete
Replied by sqmathlete on topic Ethercat installation from repositories - how to step by step
Hi Rod,
I followed these instructions several times and, everything worked perfectly. Tried to install today and I get an error saying that no public key is available. Any idea if something has something changed? This is a fresh install of the Debian buster Linuxcnc iso.
Kind regards,
Dan
I followed these instructions several times and, everything worked perfectly. Tried to install today and I get an error saying that no public key is available. Any idea if something has something changed? This is a fresh install of the Debian buster Linuxcnc iso.
Kind regards,
Dan
Please Log in to join the conversation.
Time to create page: 0.295 seconds
