LinuxCNC from boot
- ALAN_AT_H3D
- Offline
- New Member
Less
More
- Posts: 2
- Thank you received: 1
04 Nov 2022 01:58 #255886
by ALAN_AT_H3D
LinuxCNC from boot was created by ALAN_AT_H3D
Hi There...I would like linuxcnc to start from boot or restart without user intervention.
Has anyone done this before that can offer any guidance?
Thanks for any help!
This is the version information I have...let me know if more is needed...
:/opt/scripts/tools$ sudo ./version.sh
git:/opt/scripts/:[5b2e16aa1e5c0f627f1d48a6dd1c13b446b9f53b]
eeprom:[A335BNLT00C02217SBB27636]
model:[TI_AM335x_BeagleBone_Black]
dogtag:[Machinekit Debian Image 2019-09-15]
bootloader:[microSD-(push-button)]:[/dev/mmcblk0]:[U-Boot 2019.04-00002-gbb4af0f50f]:[location: dd MBR]
kernel:[4.19.71-bone-rt-r38]
I have tried implementing a systemd service. At this point I am unable to even start the systemd service manually (systemctl start linuxcnc.service). I can run the /home/machinekit/linuxcnc_start.sh without systemd and linuxcnc starts up without issue.
Nov 04 01:34:52 beaglebone systemd[1]: linuxcnc.service: Passing 0 fds to service
Nov 04 01:34:52 beaglebone systemd[1]: linuxcnc.service: About to execute: /home/machinekit/linuxcnc_start.sh
Nov 04 01:34:52 beaglebone systemd[1]: linuxcnc.service: Forked /home/machinekit/linuxcnc_start.sh as 4263
Nov 04 01:34:52 beaglebone systemd[1]: linuxcnc.service: Changed failed -> start
Nov 04 01:34:52 beaglebone systemd[1]: Starting linuxcnc.service...
Nov 04 01:34:52 beaglebone systemd[4263]: linuxcnc.service: Executing: /home/machinekit/linuxcnc_start.sh
Nov 04 01:34:52 beaglebone systemd[1]: linuxcnc.service: User lookup succeeded: uid=1000 gid=1000
Nov 04 01:34:55 beaglebone sudo[4361]: machinekit : TTY=unknown ; PWD=/home/machinekit/machinekit/configs/Turny ; USER=root ; COMMAND=/usr/bin/config-pin -f -
Nov 04 01:34:55 beaglebone sudo[4361]: pam_unix(sudo:session): session opened for user root by (uid=0)
Nov 04 01:34:55 beaglebone sudo[4361]: pam_unix(sudo:session): session closed for user root
Nov 04 01:35:02 beaglebone rtapi:0[4338]: unload: '' not loaded
Nov 04 01:35:02 beaglebone rtapi:0[4338]: unload: '' not loaded
Nov 04 01:35:02 beaglebone rtapi:0[4338]: unload: '' not loaded
Nov 04 01:35:02 beaglebone rtapi:0[4338]: unload: '' not loaded
Nov 04 01:35:03 beaglebone msgd:0[4333]: rtapi_app exit detected - scheduled shutdown
Nov 04 01:35:05 beaglebone msgd:0[4333]: msgd shutting down
Nov 04 01:35:05 beaglebone systemd[1]: linuxcnc.service: Child 4263 belongs to linuxcnc.service
Nov 04 01:35:05 beaglebone systemd[1]: linuxcnc.service: Main process exited, code=exited, status=1/FAILURE
Nov 04 01:35:05 beaglebone systemd[1]: linuxcnc.service: Changed start -> failed
Nov 04 01:35:05 beaglebone systemd[1]: linuxcnc.service: Job linuxcnc.service/start finished, result=failed
Nov 04 01:35:05 beaglebone systemd[1]: Failed to start linuxcnc.service.
Nov 04 01:35:05 beaglebone systemd[1]: linuxcnc.service: Unit entered failed state.
Nov 04 01:35:05 beaglebone systemd[1]: linuxcnc.service: Failed with result 'exit-code'.
Nov 04 01:35:05 beaglebone systemd[1]: linuxcnc.service: cgroup is empty
cat /etc/systemd/system/linuxcnc.service
[Unit]
Description=linuxcnc.service
[Service]
Type=oneshot
ExecStart=/home/machinekit/linuxcnc_start.sh
WorkingDirectory=/home/machinekit
User=machinekit
[Install]
WantedBy=multi-user.target
(I have also tried WantedBy=graphical.target)
Has anyone done this before that can offer any guidance?
Thanks for any help!
This is the version information I have...let me know if more is needed...
:/opt/scripts/tools$ sudo ./version.sh
git:/opt/scripts/:[5b2e16aa1e5c0f627f1d48a6dd1c13b446b9f53b]
eeprom:[A335BNLT00C02217SBB27636]
model:[TI_AM335x_BeagleBone_Black]
dogtag:[Machinekit Debian Image 2019-09-15]
bootloader:[microSD-(push-button)]:[/dev/mmcblk0]:[U-Boot 2019.04-00002-gbb4af0f50f]:[location: dd MBR]
kernel:[4.19.71-bone-rt-r38]
I have tried implementing a systemd service. At this point I am unable to even start the systemd service manually (systemctl start linuxcnc.service). I can run the /home/machinekit/linuxcnc_start.sh without systemd and linuxcnc starts up without issue.
Nov 04 01:34:52 beaglebone systemd[1]: linuxcnc.service: Passing 0 fds to service
Nov 04 01:34:52 beaglebone systemd[1]: linuxcnc.service: About to execute: /home/machinekit/linuxcnc_start.sh
Nov 04 01:34:52 beaglebone systemd[1]: linuxcnc.service: Forked /home/machinekit/linuxcnc_start.sh as 4263
Nov 04 01:34:52 beaglebone systemd[1]: linuxcnc.service: Changed failed -> start
Nov 04 01:34:52 beaglebone systemd[1]: Starting linuxcnc.service...
Nov 04 01:34:52 beaglebone systemd[4263]: linuxcnc.service: Executing: /home/machinekit/linuxcnc_start.sh
Nov 04 01:34:52 beaglebone systemd[1]: linuxcnc.service: User lookup succeeded: uid=1000 gid=1000
Nov 04 01:34:55 beaglebone sudo[4361]: machinekit : TTY=unknown ; PWD=/home/machinekit/machinekit/configs/Turny ; USER=root ; COMMAND=/usr/bin/config-pin -f -
Nov 04 01:34:55 beaglebone sudo[4361]: pam_unix(sudo:session): session opened for user root by (uid=0)
Nov 04 01:34:55 beaglebone sudo[4361]: pam_unix(sudo:session): session closed for user root
Nov 04 01:35:02 beaglebone rtapi:0[4338]: unload: '' not loaded
Nov 04 01:35:02 beaglebone rtapi:0[4338]: unload: '' not loaded
Nov 04 01:35:02 beaglebone rtapi:0[4338]: unload: '' not loaded
Nov 04 01:35:02 beaglebone rtapi:0[4338]: unload: '' not loaded
Nov 04 01:35:03 beaglebone msgd:0[4333]: rtapi_app exit detected - scheduled shutdown
Nov 04 01:35:05 beaglebone msgd:0[4333]: msgd shutting down
Nov 04 01:35:05 beaglebone systemd[1]: linuxcnc.service: Child 4263 belongs to linuxcnc.service
Nov 04 01:35:05 beaglebone systemd[1]: linuxcnc.service: Main process exited, code=exited, status=1/FAILURE
Nov 04 01:35:05 beaglebone systemd[1]: linuxcnc.service: Changed start -> failed
Nov 04 01:35:05 beaglebone systemd[1]: linuxcnc.service: Job linuxcnc.service/start finished, result=failed
Nov 04 01:35:05 beaglebone systemd[1]: Failed to start linuxcnc.service.
Nov 04 01:35:05 beaglebone systemd[1]: linuxcnc.service: Unit entered failed state.
Nov 04 01:35:05 beaglebone systemd[1]: linuxcnc.service: Failed with result 'exit-code'.
Nov 04 01:35:05 beaglebone systemd[1]: linuxcnc.service: cgroup is empty
cat /etc/systemd/system/linuxcnc.service
[Unit]
Description=linuxcnc.service
[Service]
Type=oneshot
ExecStart=/home/machinekit/linuxcnc_start.sh
WorkingDirectory=/home/machinekit
User=machinekit
[Install]
WantedBy=multi-user.target
(I have also tried WantedBy=graphical.target)
Please Log in or Create an account to join the conversation.
- tommylight
- Away
- Moderator
Less
More
- Posts: 19196
- Thank you received: 6434
04 Nov 2022 10:06 #255892
by tommylight
Replied by tommylight on topic LinuxCNC from boot
What Linux does MachineKit use as a base?
Most Linux distros have a startup apps in the main menu>preferences, there you can add anything and it will start after getting to run level 5 or Desktop.
That is what i use in Linux Mint to start LinuxCNC at boot, also i use a script by PCW to ping the Mesa ethernet board and postpone the LinuxCNC start till Mesa is powered up.
Most Linux distros have a startup apps in the main menu>preferences, there you can add anything and it will start after getting to run level 5 or Desktop.
That is what i use in Linux Mint to start LinuxCNC at boot, also i use a script by PCW to ping the Mesa ethernet board and postpone the LinuxCNC start till Mesa is powered up.
Please Log in or Create an account to join the conversation.
- ALAN_AT_H3D
- Offline
- New Member
Less
More
- Posts: 2
- Thank you received: 1
04 Nov 2022 20:27 #255957
by ALAN_AT_H3D
Replied by ALAN_AT_H3D on topic LinuxCNC from boot
Hi Tommy...this is a debian installation on a Beaglebone.
Thanks,
Alan
Thanks,
Alan
Please Log in or Create an account to join the conversation.
- tommylight
- Away
- Moderator
Less
More
- Posts: 19196
- Thank you received: 6434
04 Nov 2022 23:34 #255979
by tommylight
Replied by tommylight on topic LinuxCNC from boot
OK, if there is nothing in the menus, search for using rc.local or some better idea to start stuff in Linux.
rc.local, not a good idea, but it does work, i have it on several PC in daily use, but it is being depreciated and i have no idea what is used instead.
rc.local, not a good idea, but it does work, i have it on several PC in daily use, but it is being depreciated and i have no idea what is used instead.
Please Log in or Create an account to join the conversation.
- ALAN_AT_H3D
- Offline
- New Member
Less
More
- Posts: 2
- Thank you received: 1
22 Nov 2022 00:57 #257275
by ALAN_AT_H3D
Replied by ALAN_AT_H3D on topic LinuxCNC from boot
I was able to do achieve most of what I needed using systemd.
If you want to replicate this here is what I've done...
Note...I was unable to post the needed files here with their original suffixes:
linuxcnc.service Place in /etc/systemd/system
linuxcnc_start.sh Place in /home/machinekit/ Check that it is executable
I then used sudo systemctl enable linuxcnc.service.
The *.ini file I had to modify in the following manner:
# Name of display program, e.g., tkemc
#DISPLAY = keystick
#DISPLAY = axis
#DISPLAY = tklinuxcnc
#https://forum.linuxcnc.org/38-general-linuxcnc-questions/38332-run-linuxcnc-from-python-interface-without-axis-gui
DISPLAY = halui
further down...
#HALUI = halui
This has gotten me pretty close, but not quite where I want to be. If I use VNC and run a python program that imports linuxcnc, I can then communicate in subsequent SSH sessions. However, if I only SSH, then only the first session works. If anyone knows why this is I would be glad to know.
Thanks for the help, both in this post and others in this forum...Alan
If you want to replicate this here is what I've done...
Note...I was unable to post the needed files here with their original suffixes:
linuxcnc.service Place in /etc/systemd/system
linuxcnc_start.sh Place in /home/machinekit/ Check that it is executable
I then used sudo systemctl enable linuxcnc.service.
The *.ini file I had to modify in the following manner:
# Name of display program, e.g., tkemc
#DISPLAY = keystick
#DISPLAY = axis
#DISPLAY = tklinuxcnc
#https://forum.linuxcnc.org/38-general-linuxcnc-questions/38332-run-linuxcnc-from-python-interface-without-axis-gui
DISPLAY = halui
further down...
#HALUI = halui
This has gotten me pretty close, but not quite where I want to be. If I use VNC and run a python program that imports linuxcnc, I can then communicate in subsequent SSH sessions. However, if I only SSH, then only the first session works. If anyone knows why this is I would be glad to know.
Thanks for the help, both in this post and others in this forum...Alan
The following user(s) said Thank You: tommylight
Please Log in or Create an account to join the conversation.
- tommylight
- Away
- Moderator
Less
More
- Posts: 19196
- Thank you received: 6434
22 Nov 2022 01:27 #257276
by tommylight
Replied by tommylight on topic LinuxCNC from boot
For SSH you can use screen:
sudo apt install screen
but i am pretty sure it will not help with VLC.
VLC should work as a real PC with the included latency, but might have issues with running OpenGL stuff.
Sorry for not being of much help, but looooong time since i used those.
sudo apt install screen
but i am pretty sure it will not help with VLC.
VLC should work as a real PC with the included latency, but might have issues with running OpenGL stuff.
Sorry for not being of much help, but looooong time since i used those.
Please Log in or Create an account to join the conversation.
Time to create page: 0.129 seconds